From 77fb7ce4a41b97b6e5c6e6fe3faa5ff34166e119 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Tue, 11 Dec 2012 20:16:46 +0000 Subject: fixed szProto variable overloading git-svn-id: http://svn.miranda-ng.org/main/trunk@2728 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/WhenWasIt/src/utils.cpp | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'plugins/WhenWasIt/src') 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) -- cgit v1.2.3