summaryrefslogtreecommitdiff
path: root/plugins/Variables
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Variables')
-rw-r--r--plugins/Variables/src/contact.cpp22
-rw-r--r--plugins/Variables/src/contact.h6
-rw-r--r--plugins/Variables/src/dbhelpers.h18
-rw-r--r--plugins/Variables/src/help.cpp12
-rw-r--r--plugins/Variables/src/parse_metacontacts.cpp12
-rw-r--r--plugins/Variables/src/parse_miranda.cpp26
-rw-r--r--plugins/Variables/src/variables.h6
7 files changed, 51 insertions, 51 deletions
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp
index 2299324552..a655d799ae 100644
--- a/plugins/Variables/src/contact.cpp
+++ b/plugins/Variables/src/contact.cpp
@@ -75,7 +75,7 @@ static builtinCnfs[] =
typedef struct {
TCHAR* tszContact;
- HANDLE hContact;
+ HCONTACT hContact;
DWORD flags;
} CONTACTCE; /* contact cache entry */
@@ -104,7 +104,7 @@ BYTE getContactInfoType(TCHAR* type)
/*
returns info about a contact as a string
*/
-TCHAR* getContactInfoT(BYTE type, HANDLE hContact)
+TCHAR* getContactInfoT(BYTE type, HCONTACT hContact)
{
/* returns dynamic allocated buffer with info, or NULL if failed */
TCHAR *res = NULL;
@@ -216,7 +216,7 @@ int getContactFromString(CONTACTSINFO *ci)
for (int i=0; i < cacheSize; i++) {
if ((!_tcscmp(cce[i].tszContact, tszContact)) && (ci->flags == cce[i].flags)) {
/* found in cache */
- ci->hContacts = (HANDLE*)mir_alloc(sizeof(HANDLE));
+ ci->hContacts = (HCONTACT*)mir_alloc(sizeof(HCONTACT));
if (ci->hContacts == NULL)
return -1;
@@ -227,7 +227,7 @@ int getContactFromString(CONTACTSINFO *ci)
}
/* contact was not in cache, do a search */
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
char *szProto = GetContactProto(hContact);
if (szProto == NULL)
continue;
@@ -325,7 +325,7 @@ int getContactFromString(CONTACTSINFO *ci)
}
}
if (bMatch) {
- ci->hContacts = (HANDLE*)mir_realloc(ci->hContacts, (count+1)*sizeof(HANDLE));
+ ci->hContacts = (HCONTACT*)mir_realloc(ci->hContacts, (count + 1)*sizeof(HCONTACT));
if (ci->hContacts == NULL)
return -1;
@@ -353,7 +353,7 @@ int getContactFromString(CONTACTSINFO *ci)
static int contactSettingChanged(WPARAM wParam, LPARAM lParam)
{
DBCONTACTWRITESETTING *dbw = (DBCONTACTWRITESETTING*)lParam;
- HANDLE hContact = (HANDLE) wParam;
+ HCONTACT hContact = (HCONTACT)wParam;
mir_cslock lck(csContactCache);
for (int i=0; i < cacheSize; i++) {
@@ -407,7 +407,7 @@ int deinitContactModule()
// returns a string in the form <PROTOID:UNIQUEID>, cannot be _HANDLE_!
// result must be freed
-TCHAR *encodeContactToString(HANDLE hContact)
+TCHAR* encodeContactToString(HCONTACT hContact)
{
char *szProto = GetContactProto(hContact);
TCHAR *tszUniqueId = getContactInfoT(CNF_UNIQUEID, hContact);
@@ -423,16 +423,16 @@ TCHAR *encodeContactToString(HANDLE hContact)
// returns a contact from a string in the form <PROTOID:UNIQUEID>
// returns INVALID_HANDLE_VALUE in case of an error.
-HANDLE *decodeContactFromString(TCHAR *tszContact)
+HCONTACT decodeContactFromString(TCHAR *tszContact)
{
- HANDLE hContact = INVALID_HANDLE_VALUE;
+ HCONTACT hContact = (HCONTACT)INVALID_HANDLE_VALUE;
CONTACTSINFO ci = { sizeof(ci) };
ci.tszContact = tszContact;
ci.flags = CI_PROTOID|CI_TCHAR;
int count = getContactFromString( &ci );
if (count != 1) {
mir_free(ci.hContacts);
- return (HANDLE*)hContact;
+ return hContact;
}
if (ci.hContacts != NULL) {
@@ -440,5 +440,5 @@ HANDLE *decodeContactFromString(TCHAR *tszContact)
mir_free(ci.hContacts);
}
- return (HANDLE*)hContact;
+ return hContact;
}
diff --git a/plugins/Variables/src/contact.h b/plugins/Variables/src/contact.h
index 5e5eae2e69..0a81df4d1f 100644
--- a/plugins/Variables/src/contact.h
+++ b/plugins/Variables/src/contact.h
@@ -83,7 +83,7 @@ typedef struct {
WCHAR *wszContact;
TCHAR *tszContact;
};
- HANDLE *hContacts; // (output) Array of contacts found.
+ HCONTACT *hContacts; // (output) Array of contacts found.
DWORD flags; // Contact details that will be matched with the search
// string (flags can be combined).
} CONTACTSINFO;
@@ -115,5 +115,5 @@ typedef struct {
#define CI_TCHAR 0
#endif
-TCHAR *encodeContactToString(HANDLE hContact);
-HANDLE *decodeContactFromString(TCHAR *tszContact);
+TCHAR *encodeContactToString(HCONTACT hContact);
+HCONTACT decodeContactFromString(TCHAR *tszContact);
diff --git a/plugins/Variables/src/dbhelpers.h b/plugins/Variables/src/dbhelpers.h
index cb5852de34..8cc7332a69 100644
--- a/plugins/Variables/src/dbhelpers.h
+++ b/plugins/Variables/src/dbhelpers.h
@@ -22,7 +22,7 @@
#endif
// database helpers
-static int __inline DBWriteIthSettingByte(DWORD i, HANDLE hContact,const char *szModule,const char *szSetting,BYTE val) {
+static int __inline DBWriteIthSettingByte(DWORD i, HCONTACT hContact,const char *szModule,const char *szSetting,BYTE val) {
char dbSetting[128];
@@ -30,7 +30,7 @@ static int __inline DBWriteIthSettingByte(DWORD i, HANDLE hContact,const char *s
return db_set_b(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteIthSettingWord(DWORD i, HANDLE hContact,const char *szModule,const char *szSetting,WORD val) {
+static int __inline DBWriteIthSettingWord(DWORD i, HCONTACT hContact,const char *szModule,const char *szSetting,WORD val) {
char dbSetting[128];
@@ -38,7 +38,7 @@ static int __inline DBWriteIthSettingWord(DWORD i, HANDLE hContact,const char *s
return db_set_w(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteIthSettingDword(DWORD i, HANDLE hContact,const char *szModule,const char *szSetting,DWORD val) {
+static int __inline DBWriteIthSettingDword(DWORD i, HCONTACT hContact,const char *szModule,const char *szSetting,DWORD val) {
char dbSetting[128];
@@ -46,7 +46,7 @@ static int __inline DBWriteIthSettingDword(DWORD i, HANDLE hContact,const char *
return db_set_dw(hContact, szModule, dbSetting, val);
}
-static int __inline DBWriteIthSettingString(DWORD i, HANDLE hContact,const char *szModule,const char *szSetting,const char *val) {
+static int __inline DBWriteIthSettingString(DWORD i, HCONTACT hContact,const char *szModule,const char *szSetting,const char *val) {
char dbSetting[128];
@@ -54,7 +54,7 @@ static int __inline DBWriteIthSettingString(DWORD i, HANDLE hContact,const char
return db_set_s(hContact, szModule, dbSetting, val);
}
-static int __inline DBGetIthSettingByte(DWORD i, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) {
+static int __inline DBGetIthSettingByte(DWORD i, HCONTACT hContact, const char *szModule, const char *szSetting, int errorValue) {
char dbSetting[128];
@@ -63,7 +63,7 @@ static int __inline DBGetIthSettingByte(DWORD i, HANDLE hContact, const char *sz
return db_get_b(hContact, szModule, dbSetting, errorValue);
}
-static WORD __inline DBGetIthSettingWord(DWORD i, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) {
+static WORD __inline DBGetIthSettingWord(DWORD i, HCONTACT hContact, const char *szModule, const char *szSetting, int errorValue) {
char dbSetting[128];
@@ -72,7 +72,7 @@ static WORD __inline DBGetIthSettingWord(DWORD i, HANDLE hContact, const char *s
return db_get_w(hContact, szModule, dbSetting, errorValue);
}
-static DWORD __inline DBGetIthSettingDword(DWORD i, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) {
+static DWORD __inline DBGetIthSettingDword(DWORD i, HCONTACT hContact, const char *szModule, const char *szSetting, int errorValue) {
char dbSetting[128];
@@ -81,7 +81,7 @@ static DWORD __inline DBGetIthSettingDword(DWORD i, HANDLE hContact, const char
return db_get_dw(hContact, szModule, dbSetting, errorValue);
}
-static int __inline DBGetIthSetting(DWORD i, HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) {
+static int __inline DBGetIthSetting(DWORD i, HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) {
char dbSetting[128];
@@ -90,7 +90,7 @@ static int __inline DBGetIthSetting(DWORD i, HANDLE hContact, const char *szModu
return db_get(hContact, szModule, dbSetting, dbv);
}
-static int __inline DBDeleteIthSetting(DWORD i, HANDLE hContact,const char *szModule,const char *szSetting) {
+static int __inline DBDeleteIthSetting(DWORD i, HCONTACT hContact,const char *szModule,const char *szSetting) {
char dbSetting[128];
diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp
index d19484235b..669d737aa3 100644
--- a/plugins/Variables/src/help.cpp
+++ b/plugins/Variables/src/help.cpp
@@ -140,9 +140,9 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
case VARM_SETSUBJECT: {
LPARAM res = 0;
- HANDLE hContact, hItem;
+ HCONTACT hContact, hItem;
- hContact = (HANDLE)wParam;
+ hContact = (HCONTACT)wParam;
log_debugA("VARM_SETSUBJECT: %u", hContact);
if (hContact == INVALID_HANDLE_VALUE) {
TCHAR *tszContact = db_get_tsa(NULL, MODULENAME, SETTING_SUBJECT);
@@ -154,7 +154,7 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
} }
if ((hContact != INVALID_HANDLE_VALUE) && (hContact != NULL))
- hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
+ hItem = (HCONTACT)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
else
hItem = NULL;
@@ -225,7 +225,7 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
case WM_DESTROY:
db_unset(NULL, MODULENAME, SETTING_SUBJECT);
{
- HANDLE hContact = (HANDLE)SendMessage(hwndDlg, VARM_GETSUBJECT, 0, 0);
+ HCONTACT hContact = (HCONTACT)SendMessage(hwndDlg, VARM_GETSUBJECT, 0, 0);
if (hContact != NULL) {
TCHAR *tszContact = encodeContactToString(hContact);
if (tszContact != NULL) {
@@ -726,7 +726,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
else extraText = NULL;
if (string != NULL) {
- TCHAR *newString = variables_parsedup(string, extraText, (HANDLE)SendMessage(GetParent(hwndDlg), VARM_GETSUBJECT, 0, 0));
+ TCHAR *newString = variables_parsedup(string, extraText, (HCONTACT)SendMessage(GetParent(hwndDlg), VARM_GETSUBJECT, 0, 0));
if (newString != NULL) {
TCHAR *oldString = Hlp_GetDlgItemText(hwndDlg, IDC_RESULT);
if (oldString == NULL || _tcscmp(oldString, newString))
@@ -1003,7 +1003,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
SendMessageA(hwndDlg, VARM_GETEXTRATEXT, (WPARAM)len + 1, (LPARAM)dat->vhs->fi->szExtraText);
}
}
- dat->vhs->fi->hContact = (HANDLE)SendMessage(hwndDlg, VARM_GETSUBJECT, 0, 0);
+ dat->vhs->fi->hContact = (HCONTACT)SendMessage(hwndDlg, VARM_GETSUBJECT, 0, 0);
}
// fall through
diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp
index 65ccfe638c..3cb038c029 100644
--- a/plugins/Variables/src/parse_metacontacts.cpp
+++ b/plugins/Variables/src/parse_metacontacts.cpp
@@ -24,7 +24,7 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return NULL;
- HANDLE hContact = NULL;
+ HCONTACT hContact = NULL;
CONTACTSINFO ci = { 0 };
ci.cbSize = sizeof(ci);
@@ -40,7 +40,7 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai)
return NULL;
}
- hContact = (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0);
+ hContact = (HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0);
if (hContact == NULL)
return NULL;
@@ -79,7 +79,7 @@ static TCHAR *parseGetDefault(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return NULL;
- HANDLE hContact = NULL;
+ HCONTACT hContact = NULL;
CONTACTSINFO ci = { 0 };
ci.cbSize = sizeof(ci);
@@ -95,7 +95,7 @@ static TCHAR *parseGetDefault(ARGUMENTSINFO *ai)
return NULL;
}
- hContact = (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT, (WPARAM)hContact, 0);
+ hContact = (HCONTACT)CallService(MS_MC_GETDEFAULTCONTACT, (WPARAM)hContact, 0);
if (hContact == NULL)
return NULL;
@@ -134,7 +134,7 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return NULL;
- HANDLE hContact = NULL;
+ HCONTACT hContact = NULL;
CONTACTSINFO ci = { 0 };
ci.cbSize = sizeof(ci);
@@ -150,7 +150,7 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai)
return NULL;
}
- hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0);
+ hContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0);
if (hContact == NULL)
return NULL;
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp
index f2a9a1b4e9..3c7279782c 100644
--- a/plugins/Variables/src/parse_miranda.cpp
+++ b/plugins/Variables/src/parse_miranda.cpp
@@ -99,7 +99,7 @@ static TCHAR* parseContact(ARGUMENTSINFO *ai)
mir_free(ci.hContacts);
return NULL;
}
- HANDLE hContact = ci.hContacts[n];
+ HCONTACT hContact = ci.hContacts[n];
log_debugA("contact: %x", hContact);
mir_free(ci.hContacts);
@@ -127,7 +127,7 @@ static TCHAR* parseContactInfo(ARGUMENTSINFO *ai)
if (ai->argc != 3)
return NULL;
- HANDLE hContact = NULL;
+ HCONTACT hContact = NULL;
CONTACTSINFO ci = { 0 };
ci.cbSize = sizeof(ci);
ci.tszContact = ai->targv[1];
@@ -172,7 +172,7 @@ static TCHAR* parseDBProfilePath(ARGUMENTSINFO *ai)
return mir_tstrdup(path);
}
-static TCHAR* getDBSetting(HANDLE hContact, char* module, char* setting, TCHAR* defaultValue)
+static TCHAR* getDBSetting(HCONTACT hContact, char* module, char* setting, TCHAR* defaultValue)
{
DBVARIANT dbv;
if (db_get_s(hContact, module, setting, &dbv, 0))
@@ -210,7 +210,7 @@ static TCHAR* parseDBSetting(ARGUMENTSINFO *ai)
return NULL;
TCHAR *res = NULL, *szDefaultValue = NULL;
- HANDLE hContact = NULL;
+ HCONTACT hContact = NULL;
if (_tcslen(ai->targv[1]) > 0) {
CONTACTSINFO ci = { 0 };
@@ -247,7 +247,7 @@ static TCHAR* parseLastSeenDate(ARGUMENTSINFO *ai)
if (ai->argc <= 1)
return NULL;
- HANDLE hContact = NULL;
+ HCONTACT hContact = NULL;
CONTACTSINFO ci = { 0 };
ci.cbSize = sizeof(ci);
ci.tszContact = ai->targv[1];
@@ -300,7 +300,7 @@ static TCHAR* parseLastSeenTime(ARGUMENTSINFO *ai)
if (ai->argc <= 1)
return NULL;
- HANDLE hContact = NULL;
+ HCONTACT hContact = NULL;
CONTACTSINFO ci = { 0 };
ci.cbSize = sizeof(ci);
@@ -355,7 +355,7 @@ static TCHAR* parseLastSeenStatus(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return NULL;
- HANDLE hContact = NULL;
+ HCONTACT hContact = NULL;
CONTACTSINFO ci = { 0 };
ci.cbSize = sizeof(ci);
ci.tszContact = ai->targv[1];
@@ -498,7 +498,7 @@ static BOOL isValidDbEvent(DBEVENTINFO *dbe, int flags)
return (bEventType && bEventFlags);
}
-static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags)
+static HANDLE findDbEvent(HCONTACT hContact, HANDLE hDbEvent, int flags)
{
DBEVENTINFO dbe;
BOOL bEventOk;
@@ -530,7 +530,7 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags)
hMatchEvent = hSearchEvent = NULL;
matchTimestamp = priorTimestamp = 0;
if (flags & DBE_FIRST) {
- for (HANDLE hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) {
+ for (HCONTACT hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) {
hSearchEvent = findDbEvent(hSearchContact, NULL, flags);
dbe.cbBlob = 0;
if (!db_event_get(hSearchEvent, &dbe)) {
@@ -543,7 +543,7 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags)
hDbEvent = hMatchEvent;
}
else if (flags & DBE_LAST) {
- for (HANDLE hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) {
+ for (HCONTACT hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) {
hSearchEvent = findDbEvent(hSearchContact, NULL, flags);
dbe.cbBlob = 0;
if (!db_event_get(hSearchEvent, &dbe)) {
@@ -559,7 +559,7 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags)
dbe.cbBlob = 0;
if (!db_event_get(hDbEvent, &dbe)) {
priorTimestamp = dbe.timestamp;
- for (HANDLE hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) {
+ for (HCONTACT hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) {
hSearchEvent = findDbEvent(hSearchContact, hDbEvent, flags);
dbe.cbBlob = 0;
if (!db_event_get(hSearchEvent, &dbe)) {
@@ -575,7 +575,7 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags)
else if (flags & DBE_PREV) {
if (!db_event_get(hDbEvent, &dbe)) {
priorTimestamp = dbe.timestamp;
- for (HANDLE hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) {
+ for (HCONTACT hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) {
hSearchEvent = findDbEvent(hSearchContact, hDbEvent, flags);
dbe.cbBlob = 0;
if (!db_event_get(hSearchEvent, &dbe)) {
@@ -648,7 +648,7 @@ static TCHAR* parseDbEvent(ARGUMENTSINFO *ai)
break;
}
- HANDLE hContact = NULL;
+ HCONTACT hContact = NULL;
CONTACTSINFO ci = { 0 };
ci.cbSize = sizeof(ci);
diff --git a/plugins/Variables/src/variables.h b/plugins/Variables/src/variables.h
index 2eb66836ff..a537364c84 100644
--- a/plugins/Variables/src/variables.h
+++ b/plugins/Variables/src/variables.h
@@ -122,7 +122,7 @@ For example: ?contact(miranda@hotmail.com,email) or ?contact(Miranda,nick). The
#define VARM_GETINPUTTEXT (WM_APP+13)
#define VARM_GETINPUTTEXTLENGTH (WM_APP+14)
#define VARM_SETSUBJECT (WM_APP+15)
-#define VARM_GETSUBJECT (WM_APP+16) // wParam=HANDLE hContact
+#define VARM_GETSUBJECT (WM_APP+16) // wParam=HCONTACT hContact
#define VARM_SETEXTRATEXT (WM_APP+17)
#define VARM_GETEXTRATEXT (WM_APP+18)
#define VARM_GETEXTRATEXTLENGTH (WM_APP+19)
@@ -136,7 +136,7 @@ typedef struct {
int cbSize;
char *szFormat;
char *szSource;
- HANDLE hContact;
+ HCONTACT hContact;
int pCount; // number of succesful parses
int eCount; // number of failures
} FORMATINFOV1;
@@ -172,7 +172,7 @@ int initTokenRegister();
int deinitTokenRegister();
// contact.c
BYTE getContactInfoType(TCHAR* type);
-TCHAR* getContactInfoT(BYTE type, HANDLE hContact);
+TCHAR* getContactInfoT(BYTE type, HCONTACT hContact);
int getContactFromString( CONTACTSINFO* );
int initContactModule();
int deinitContactModule();