diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2012-12-11 20:16:46 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2012-12-11 20:16:46 +0000 |
commit | 77fb7ce4a41b97b6e5c6e6fe3faa5ff34166e119 (patch) | |
tree | 8678c1edbf907834f60fe12bf8033770a29878a9 | |
parent | 3e20f63505636ca27de3f0f0703d35212544fa23 (diff) |
fixed szProto variable overloading
git-svn-id: http://svn.miranda-ng.org/main/trunk@2728 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/WhenWasIt/src/utils.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/plugins/WhenWasIt/src/utils.cpp b/plugins/WhenWasIt/src/utils.cpp index 9d59dd9067..e5ed9b9475 100644 --- a/plugins/WhenWasIt/src/utils.cpp +++ b/plugins/WhenWasIt/src/utils.cpp @@ -125,7 +125,7 @@ int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, int res = 1;
size_t len;
dbv.type = DBVT_ASCIIZ;
- if (DBGetContactSetting(hContact, szModule, szSettingName, &dbv) == 0)
+ if (db_get(hContact, szModule, szSettingName, &dbv) == 0)
{
res = 0;
size_t tmp = strlen(dbv.pszVal);
@@ -161,10 +161,10 @@ TCHAR *GetContactName(HANDLE hContact, char *szProto) {
CONTACTINFO ctInfo = { sizeof(ctInfo) };
ctInfo.szProto = (szProto) ? szProto : GetContactProto(hContact);
- ctInfo.dwFlag = CNF_DISPLAY | CNF_UNICODE;
+ ctInfo.dwFlag = CNF_DISPLAY | CNF_TCHAR;
ctInfo.hContact = hContact;
//_debug_message("retrieving contact name for %d", hContact);
- int ret = CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) &ctInfo);
+ INT_PTR ret = CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) &ctInfo);
//_debug_message(" contact name %s", ctInfo.pszVal);
TCHAR *buffer;
if ( !ret)
@@ -186,9 +186,9 @@ TCHAR *GetContactID(HANDLE hContact, char *szProto) {
CONTACTINFO ctInfo = { sizeof(ctInfo) };
ctInfo.szProto = szProto;
- ctInfo.dwFlag = CNF_UNIQUEID | CNF_UNICODE;
+ ctInfo.dwFlag = CNF_UNIQUEID | CNF_TCHAR;
ctInfo.hContact = hContact;
- int ret = CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) &ctInfo);
+ INT_PTR ret = CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) &ctInfo);
TCHAR *buffer;
if ( !ret) {
TCHAR tmp[16];
@@ -221,24 +221,21 @@ TCHAR *GetContactID(HANDLE hContact, char *szProto) HANDLE GetContactFromID(TCHAR *szID, char *szProto)
{
HANDLE hContact = db_find_first();
- TCHAR *szHandle;
- int found = 0;
while (hContact) {
- char *szProto = GetContactProto(hContact);
- szHandle = GetContactID(hContact, szProto);
- if (szHandle && !_tcsicmp(szHandle, szID) && !_stricmp(szProto, szProto))
- found = 1;
-
+ char *m_szProto = GetContactProto(hContact);
+ TCHAR *szHandle = GetContactID(hContact, szProto);
if (szHandle)
+ {
+ bool found = (!_tcsicmp(szHandle, szID) && !_stricmp(szProto, m_szProto));
free(szHandle);
-
- if (found)
- break;
+ if (found)
+ return hContact;
+ }
hContact = db_find_next(hContact);
}
- return hContact;
+ return NULL;
}
HANDLE GetContactFromID(TCHAR *szID, wchar_t *szProto)
|