From 8aa669fbc78ce229f45105df09ac25a2df8b8eff Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 25 Mar 2013 09:06:37 +0000 Subject: Google contact removed from clist git-svn-id: http://svn.miranda-ng.org/main/trunk@4185 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/GTalkExt/src/db.cpp | 75 ++++--------------------------------------- 1 file changed, 7 insertions(+), 68 deletions(-) (limited to 'protocols/GTalkExt/src/db.cpp') diff --git a/protocols/GTalkExt/src/db.cpp b/protocols/GTalkExt/src/db.cpp index 5b55a9a688..d5e8e6edbc 100644 --- a/protocols/GTalkExt/src/db.cpp +++ b/protocols/GTalkExt/src/db.cpp @@ -22,79 +22,18 @@ #include "StdAfx.h" #include "options.h" -char *WtoA(LPCTSTR W) -{ - char* result = (char*)malloc(lstrlen(W) + 1); - __try { - int i; - for (i = 0; W[i]; i++) { - result[i] = W[i]; - } - - result[i] = 0; - } - __except( - free(result), - EXCEPTION_CONTINUE_SEARCH - ) {} - return result; -} - LPTSTR ReadJidSetting(LPCSTR name, LPCTSTR jid) { - char *ansiJid = WtoA(jid); - __try { - DBVARIANT dbv = {0}; - __try { - if (DBGetContactSettingTString(0, name, ansiJid, &dbv)) - { - LPTSTR result = (LPTSTR)malloc(2 * sizeof(TCHAR)); - result[0] = '0'; - result[1] = NULL; - return result; - } + DBVARIANT dbv; + if ( DBGetContactSettingTString(0, name, _T2A(jid), &dbv)) + return (LPTSTR)calloc(2, sizeof(TCHAR)); - return _tcsdup(dbv.ptszVal); - } - __finally { - DBFreeVariant(&dbv); - } - } - __finally { - free(ansiJid); - } - - assert(false); - return NULL; // relax compiler + TCHAR *result = _tcsdup(dbv.ptszVal); + db_free(&dbv); + return result; } void WriteJidSetting(LPCSTR name, LPCTSTR jid, LPCTSTR setting) { - char *ansiJid = WtoA(jid); - __try { - db_set_ts(0, name, ansiJid, setting); - } - __finally { - free(ansiJid); - } + db_set_ts(0, name, _T2A(jid), setting); } - -void RenewPseudocontactHandles() -{ - int count = 0; - PROTOACCOUNT **protos; - ProtoEnumAccounts(&count, &protos); - for (int i = 0; i < count; i++) { - db_unset(0, protos[i]->szModuleName, PSEUDOCONTACT_LINK); - db_unset(0, protos[i]->szModuleName, "GMailExtNotifyContact"); // remove this - } - - HANDLE hContact = db_find_first(); - while (hContact) { - if (db_get_b(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) { - LPCSTR proto = (LPCSTR)GetContactProto(hContact); - db_set_dw(0, proto, PSEUDOCONTACT_LINK, (DWORD)hContact); - } - hContact = db_find_next(hContact); - }; -} \ No newline at end of file -- cgit v1.2.3