From 097c52ad9a2928422084bf76cebee58958341574 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 7 Apr 2013 19:47:13 +0000 Subject: end of the old database macroses git-svn-id: http://svn.miranda-ng.org/main/trunk@4373 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/YahooGroups/src/services.cpp | 4 ++-- plugins/YahooGroups/src/utils.cpp | 46 ++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 28 deletions(-) (limited to 'plugins/YahooGroups') diff --git a/plugins/YahooGroups/src/services.cpp b/plugins/YahooGroups/src/services.cpp index b896f5598f..5334e7f4a2 100644 --- a/plugins/YahooGroups/src/services.cpp +++ b/plugins/YahooGroups/src/services.cpp @@ -101,7 +101,7 @@ void AddNewGroup(char *newGroup) wchar_t wide[MAX_SIZE] = {0}; *wide = 1; MultiByteToWideChar(currentCodePage, 0, group + 1, -1, wide + 1, MAX_SIZE - 1); - DBWriteContactSettingWString(NULL, CLIST_GROUPS, tmp, wide); + db_set_ws(NULL, CLIST_GROUPS, tmp, wide); availableGroups.Add(_strdup(group + 1)); } @@ -111,7 +111,7 @@ void AddContactToGroup(HANDLE hContact, char *group) const int MAX_SIZE = 1024; wchar_t wide[MAX_SIZE] = {0}; MultiByteToWideChar(currentCodePage, 0, group, -1, wide, MAX_SIZE); - DBWriteContactSettingWString(hContact, "CList", "Group", wide); + db_set_ws(hContact, "CList", "Group", wide); } void CreateGroup(char *group) diff --git a/plugins/YahooGroups/src/utils.cpp b/plugins/YahooGroups/src/utils.cpp index 0a77deb1e4..4c1022fd76 100644 --- a/plugins/YahooGroups/src/utils.cpp +++ b/plugins/YahooGroups/src/utils.cpp @@ -169,34 +169,28 @@ int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, int res = 1; int len; dbv.type = DBVT_WCHAR; - if (DBGetContactSettingWString(hContact, szModule, szSettingName, &dbv) == 0) - { - res = 0; - if (dbv.type != DBVT_WCHAR) - { - MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, szResult, count); - } - else{ - int tmp = wcslen(dbv.pwszVal); - len = (tmp < count - 1) ? tmp : count - 1; - wcsncpy(szResult, dbv.pwszVal, len); - szResult[len] = L'\0'; - } - mir_free(dbv.pwszVal); + if ( db_get_s(hContact, szModule, szSettingName, &dbv, 0) == 0) { + res = 0; + if (dbv.type != DBVT_WCHAR) + MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, szResult, count); + else { + int tmp = wcslen(dbv.pwszVal); + len = (tmp < count - 1) ? tmp : count - 1; + wcsncpy(szResult, dbv.pwszVal, len); + szResult[len] = L'\0'; } - else{ - res = 1; - if (szError) - { - int tmp = wcslen(szError); - len = (tmp < count - 1) ? tmp : count - 1; - wcsncpy(szResult, szError, len); - szResult[len] = L'\0'; - } - else{ - szResult[0] = L'\0'; - } + mir_free(dbv.pwszVal); + } + else { + res = 1; + if (szError) { + int tmp = wcslen(szError); + len = (tmp < count - 1) ? tmp : count - 1; + wcsncpy(szResult, szError, len); + szResult[len] = L'\0'; } + else szResult[0] = L'\0'; + } return res; } -- cgit v1.2.3