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 --- protocols/FacebookRM/src/communication.cpp | 4 +- protocols/FacebookRM/src/contacts.cpp | 4 +- protocols/FacebookRM/src/db.h | 4 +- protocols/FacebookRM/src/process.cpp | 16 ++-- protocols/GTalkExt/src/tipper_items.cpp | 21 +++-- protocols/Gadu-Gadu/src/dialogs.cpp | 146 ++++++++++++++--------------- protocols/Omegle/src/communication.cpp | 4 +- protocols/Omegle/src/db.h | 4 +- protocols/Xfire/src/Xfire_base.cpp | 8 +- protocols/Xfire/src/main.cpp | 18 ++-- protocols/Yahoo/src/proto.cpp | 38 +++----- 11 files changed, 130 insertions(+), 137 deletions(-) (limited to 'protocols') diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index d6dbd885d2..8e3897e2d6 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -782,8 +782,8 @@ bool facebook_client::home( ) // Get real_name this->self_.real_name = utils::text::source_get_value( &resp.data, 2, "", "" ); if (!this->self_.real_name.empty()) { - DBWriteContactSettingUTF8String(NULL, parent->m_szModuleName, FACEBOOK_KEY_NAME, this->self_.real_name.c_str()); - DBWriteContactSettingUTF8String(NULL, parent->m_szModuleName, FACEBOOK_KEY_NICK, this->self_.real_name.c_str()); + db_set_utf(NULL, parent->m_szModuleName, FACEBOOK_KEY_NAME, this->self_.real_name.c_str()); + db_set_utf(NULL, parent->m_szModuleName, FACEBOOK_KEY_NICK, this->self_.real_name.c_str()); parent->Log(" Got self real name: %s", this->self_.real_name.c_str()); } else { client_notify(TranslateT("Something happened to Facebook. Maybe there was some major update so you should wait for an update.")); diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp index c54060a049..abea7b8f49 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -120,8 +120,8 @@ HANDLE FacebookProto::AddToContactList(facebook_user* fbu, BYTE type, bool dont_ if (strlen(new_name) > 0) { - DBWriteContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, new_name); - DBWriteContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NICK, new_name); + db_set_utf(hContact, m_szModuleName, FACEBOOK_KEY_NAME, new_name); + db_set_utf(hContact, m_szModuleName, FACEBOOK_KEY_NICK, new_name); } db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, type); diff --git a/protocols/FacebookRM/src/db.h b/protocols/FacebookRM/src/db.h index f7a3a560f3..1d309b1160 100644 --- a/protocols/FacebookRM/src/db.h +++ b/protocols/FacebookRM/src/db.h @@ -33,8 +33,8 @@ along with this program. If not, see . #define setString( setting, value ) db_set_s( NULL, m_szModuleName, setting, value ) #define getTString( setting, dest ) db_get_ts( NULL, m_szModuleName, setting, dest ) #define setTString( setting, value ) db_set_ts( NULL, m_szModuleName, setting, value ) -#define getU8String( setting, dest ) DBGetContactSettingUTF8String( NULL, m_szModuleName, setting, dest ) -#define setU8String( setting, value ) DBWriteContactSettingUTF8String( NULL, m_szModuleName, setting, value ) +#define getU8String( setting, dest ) db_get_utf( NULL, m_szModuleName, setting, dest ) +#define setU8String( setting, value ) db_set_utf( NULL, m_szModuleName, setting, value ) #define deleteSetting( setting ) db_unset( NULL, m_szModuleName, setting ) // DB keys diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index c1e4dcea1f..c362be15eb 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -97,8 +97,8 @@ void FacebookProto::ProcessBuddyList( void* data ) fbu->handle = AddToContactList(fbu, FACEBOOK_CONTACT_FRIEND); if (!fbu->real_name.empty()) { - DBWriteContactSettingUTF8String(fbu->handle,m_szModuleName,FACEBOOK_KEY_NAME,fbu->real_name.c_str()); - DBWriteContactSettingUTF8String(fbu->handle,m_szModuleName,FACEBOOK_KEY_NICK,fbu->real_name.c_str()); + db_set_utf(fbu->handle,m_szModuleName,FACEBOOK_KEY_NAME,fbu->real_name.c_str()); + db_set_utf(fbu->handle,m_szModuleName,FACEBOOK_KEY_NICK,fbu->real_name.c_str()); } } @@ -189,15 +189,15 @@ void FacebookProto::ProcessFriendList( void* data ) db_set_b(hContact, m_szModuleName, "Gender", fbu->gender); // Update real name - if ( !DBGetContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv)) + if ( !db_get_utf(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv)) { update_required = strcmp( dbv.pszVal, fbu->real_name.c_str()) != 0; db_free(&dbv); } if ( update_required ) { - DBWriteContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, fbu->real_name.c_str()); - DBWriteContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NICK, fbu->real_name.c_str()); + db_set_utf(hContact, m_szModuleName, FACEBOOK_KEY_NAME, fbu->real_name.c_str()); + db_set_utf(hContact, m_szModuleName, FACEBOOK_KEY_NICK, fbu->real_name.c_str()); } if (db_get_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND) { @@ -235,7 +235,7 @@ void FacebookProto::ProcessFriendList( void* data ) db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_NONE); std::string contactname = id; - if ( !DBGetContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv)) { + if ( !db_get_utf(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv)) { contactname = dbv.pszVal; db_free(&dbv); } @@ -260,8 +260,8 @@ void FacebookProto::ProcessFriendList( void* data ) HANDLE hContact = AddToContactList(fbu, FACEBOOK_CONTACT_FRIEND, true); // This contact is surely new db_set_b(hContact, m_szModuleName, "Gender", fbu->gender ); - DBWriteContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, fbu->real_name.c_str()); - DBWriteContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NICK, fbu->real_name.c_str()); + db_set_utf(hContact, m_szModuleName, FACEBOOK_KEY_NAME, fbu->real_name.c_str()); + db_set_utf(hContact, m_szModuleName, FACEBOOK_KEY_NICK, fbu->real_name.c_str()); db_set_s(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, fbu->image_url.c_str()); // db_set_w(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE ); } diff --git a/protocols/GTalkExt/src/tipper_items.cpp b/protocols/GTalkExt/src/tipper_items.cpp index 8acb72ce60..77c5e60e95 100644 --- a/protocols/GTalkExt/src/tipper_items.cpp +++ b/protocols/GTalkExt/src/tipper_items.cpp @@ -131,22 +131,23 @@ void AddTipperItem() for (i = 0; i < MAX_TIPPER_ITEM_PROP; i++) ShiftTipperSettings(setting, itemCount, TipperItemProps[i]); - #define WRITE_TIPPER_PROP(type, index, value)\ + #define WRITE_TIPPER_PROPS(index, value)\ sprintf(setting, TipperItemProps[##index##], 0);\ - DBWriteContactSetting##type##(0, TIPPER_ITEMS_MOD_NAME, setting, ##value##) + db_set_ts(0, TIPPER_ITEMS_MOD_NAME, setting, ##value##) + #define WRITE_TIPPER_PROPB(index, value)\ + sprintf(setting, TipperItemProps[##index##], 0);\ + db_set_b(0, TIPPER_ITEMS_MOD_NAME, setting, ##value##) LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL); db_set_ts(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label); - WRITE_TIPPER_PROP(TString, 0, label); - WRITE_TIPPER_PROP(Byte, 1, 0); - WRITE_TIPPER_PROP(Byte, 2, 0); - WRITE_TIPPER_PROP(Byte, 3, 0); - WRITE_TIPPER_PROP(TString, 4, UNREAD_THREADS_RAW); - WRITE_TIPPER_PROP(Byte, 5, 1); - - #undef WRITE_TIPPER_PROP + WRITE_TIPPER_PROPS(0, label); + WRITE_TIPPER_PROPB(1, 0); + WRITE_TIPPER_PROPB(2, 0); + WRITE_TIPPER_PROPB(3, 0); + WRITE_TIPPER_PROPS(4, UNREAD_THREADS_RAW); + WRITE_TIPPER_PROPB(5, 1); } __finally { free(setting); diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index 3f8a29053c..78acff5c01 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -48,88 +48,88 @@ static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule, dbv.type = DBVT_DELETED; if (szModule == NULL) unspecified = 1; - else unspecified = DBGetContactSettingW(hContact, szModule, szSetting, &dbv); + else unspecified = db_get(hContact, szModule, szSetting, &dbv); if (!unspecified) { switch (dbv.type) { - case DBVT_BYTE: - if (special == SVS_GENDER) { - if (dbv.cVal == 'M') ptstr = TranslateT("Male"); - else if (dbv.cVal == 'F') ptstr = TranslateT("Female"); - else unspecified = 1; - } - else if (special == SVS_MONTH) { - if (dbv.bVal > 0 && dbv.bVal <= 12) { - ptstr = str; - GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1 - 1 + dbv.bVal, str, SIZEOF(str)); - } - else unspecified = 1; - } - else if (special == SVS_TIMEZONE) { - if (dbv.cVal == -100) unspecified = 1; - else { - ptstr = str; - mir_sntprintf(str, SIZEOF(str), dbv.cVal ? _T("GMT%+d:%02d") : _T("GMT"), -dbv.cVal / 2, (dbv.cVal & 1) * 30); - } - } else { - unspecified = (special == SVS_ZEROISUNSPEC && dbv.bVal == 0); - ptstr = _itot(special == SVS_SIGNED ? dbv.cVal : dbv.bVal, str, 10); - } - break; - case DBVT_WORD: - if (special == SVS_COUNTRY) { - char* pstr = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, dbv.wVal, 0); - if (pstr == NULL){ - unspecified = 1; - } else { - ptstr = str; - mir_sntprintf(str, SIZEOF(str), _T("%S"), pstr); - } + case DBVT_BYTE: + if (special == SVS_GENDER) { + if (dbv.cVal == 'M') ptstr = TranslateT("Male"); + else if (dbv.cVal == 'F') ptstr = TranslateT("Female"); + else unspecified = 1; + } + else if (special == SVS_MONTH) { + if (dbv.bVal > 0 && dbv.bVal <= 12) { + ptstr = str; + GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1 - 1 + dbv.bVal, str, SIZEOF(str)); } + else unspecified = 1; + } + else if (special == SVS_TIMEZONE) { + if (dbv.cVal == -100) unspecified = 1; else { - unspecified = (special == SVS_ZEROISUNSPEC && dbv.wVal == 0); - ptstr = _itot(special == SVS_SIGNED ? dbv.sVal : dbv.wVal, str, 10); + ptstr = str; + mir_sntprintf(str, SIZEOF(str), dbv.cVal ? _T("GMT%+d:%02d") : _T("GMT"), -dbv.cVal / 2, (dbv.cVal & 1) * 30); } - break; - case DBVT_DWORD: - unspecified = (special == SVS_ZEROISUNSPEC && dbv.dVal == 0); - if (special == SVS_IP) { - struct in_addr ia; - ia.S_un.S_addr = htonl(dbv.dVal); - char* pstr = inet_ntoa(ia); - if (pstr == NULL){ - unspecified = 1; - } else { - ptstr = str; - mir_sntprintf(str, SIZEOF(str), _T("%S"), pstr); - } - if (dbv.dVal == 0) unspecified = 1; - } else if (special == SVS_GGVERSION) { + } else { + unspecified = (special == SVS_ZEROISUNSPEC && dbv.bVal == 0); + ptstr = _itot(special == SVS_SIGNED ? dbv.cVal : dbv.bVal, str, 10); + } + break; + case DBVT_WORD: + if (special == SVS_COUNTRY) { + char* pstr = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, dbv.wVal, 0); + if (pstr == NULL){ + unspecified = 1; + } else { ptstr = str; - mir_sntprintf(str, SIZEOF(str), _T("%S"), (char *)gg_version2string(dbv.dVal)); + mir_sntprintf(str, SIZEOF(str), _T("%S"), pstr); + } + } + else { + unspecified = (special == SVS_ZEROISUNSPEC && dbv.wVal == 0); + ptstr = _itot(special == SVS_SIGNED ? dbv.sVal : dbv.wVal, str, 10); + } + break; + case DBVT_DWORD: + unspecified = (special == SVS_ZEROISUNSPEC && dbv.dVal == 0); + if (special == SVS_IP) { + struct in_addr ia; + ia.S_un.S_addr = htonl(dbv.dVal); + char* pstr = inet_ntoa(ia); + if (pstr == NULL){ + unspecified = 1; } else { - ptstr = _itot(special == SVS_SIGNED ? dbv.lVal : dbv.dVal, str, 10); + ptstr = str; + mir_sntprintf(str, SIZEOF(str), _T("%S"), pstr); } - break; - case DBVT_ASCIIZ: - unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); - ptstr = str; - mir_sntprintf(str, SIZEOF(str), _T("%S"), dbv.pszVal); - break; - case DBVT_TCHAR: - unspecified = (special == SVS_ZEROISUNSPEC && dbv.ptszVal[0] == '\0'); - ptstr = dbv.ptszVal; - break; - case DBVT_UTF8: - unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); - valT = mir_utf8decodeT(dbv.pszVal); - ptstr = str; - _tcscpy_s(str, SIZEOF(str), valT); - mir_free(valT); - break; - default: + if (dbv.dVal == 0) unspecified = 1; + } else if (special == SVS_GGVERSION) { ptstr = str; - lstrcpy(str, _T("???")); - break; + mir_sntprintf(str, SIZEOF(str), _T("%S"), (char *)gg_version2string(dbv.dVal)); + } else { + ptstr = _itot(special == SVS_SIGNED ? dbv.lVal : dbv.dVal, str, 10); + } + break; + case DBVT_ASCIIZ: + unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); + ptstr = str; + mir_sntprintf(str, SIZEOF(str), _T("%S"), dbv.pszVal); + break; + case DBVT_TCHAR: + unspecified = (special == SVS_ZEROISUNSPEC && dbv.ptszVal[0] == '\0'); + ptstr = dbv.ptszVal; + break; + case DBVT_UTF8: + unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); + valT = mir_utf8decodeT(dbv.pszVal); + ptstr = str; + _tcscpy_s(str, SIZEOF(str), valT); + mir_free(valT); + break; + default: + ptstr = str; + lstrcpy(str, _T("???")); + break; } } diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp index ea4604b167..fa34f586b8 100644 --- a/protocols/Omegle/src/communication.cpp +++ b/protocols/Omegle/src/communication.cpp @@ -333,7 +333,7 @@ bool Omegle_client::start() else if ( db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_MEET_COMMON, 0)) { DBVARIANT dbv; - if (!DBGetContactSettingUTF8String(NULL, parent->m_szModuleName, OMEGLE_KEY_INTERESTS, &dbv)) + if (!db_get_utf(NULL, parent->m_szModuleName, OMEGLE_KEY_INTERESTS, &dbv)) { std::string topics = dbv.pszVal; std::string topic; @@ -672,7 +672,7 @@ bool Omegle_client::events( ) // We got new stranger in this event, lets say him "Hi message" if enabled if ( db_get_b( NULL, parent->m_szModuleName, OMEGLE_KEY_HI_ENABLED, 0 )) { DBVARIANT dbv; - if ( !DBGetContactSettingUTF8String( NULL, parent->m_szModuleName, OMEGLE_KEY_HI, &dbv )) { + if ( !db_get_utf( NULL, parent->m_szModuleName, OMEGLE_KEY_HI, &dbv )) { std::string *message = new std::string(dbv.pszVal); db_free(&dbv); diff --git a/protocols/Omegle/src/db.h b/protocols/Omegle/src/db.h index 6543b9f2d8..355c0061ab 100644 --- a/protocols/Omegle/src/db.h +++ b/protocols/Omegle/src/db.h @@ -33,8 +33,8 @@ along with this program. If not, see . #define setString( setting, value ) db_set_s( NULL, m_szModuleName, setting, value ) #define getTString( setting, dest ) db_get_ts( NULL, m_szModuleName, setting, dest ) #define setTString( setting, value ) db_set_ts( NULL, m_szModuleName, setting, value ) -#define getU8String( setting, dest ) DBGetContactSettingUTF8String( NULL, m_szModuleName, setting, dest ) -#define setU8String( setting, value ) DBWriteContactSettingUTF8String( NULL, m_szModuleName, setting, value ) +#define getU8String( setting, dest ) db_get_utf( NULL, m_szModuleName, setting, dest ) +#define setU8String( setting, value ) db_set_utf( NULL, m_szModuleName, setting, value ) #define deleteSetting( setting ) db_unset( NULL, m_szModuleName, setting ) // DB settings diff --git a/protocols/Xfire/src/Xfire_base.cpp b/protocols/Xfire/src/Xfire_base.cpp index 6b2e6c43d7..ff18001f25 100644 --- a/protocols/Xfire/src/Xfire_base.cpp +++ b/protocols/Xfire/src/Xfire_base.cpp @@ -137,7 +137,7 @@ void Xfire_base::readUtf8StringfromDB(char*name,unsigned int dbid,char**to) //wert aus der dblesen sprintf_s(temp,128,"%s_%i",name,dbid); - if(!DBGetContactSettingUTF8String(NULL, protocolname, temp,&dbv)) + if(!db_get_utf(NULL, protocolname, temp,&dbv)) { //string setzen setString(dbv.pszVal,to); @@ -155,7 +155,7 @@ void Xfire_base::readUtf8StringfromDB(char*name,unsigned int dbid,int id,char**t //wert aus der dblesen sprintf_s(temp,128,"%s_%i_%i",name,dbid,id); - if(!DBGetContactSettingUTF8String(NULL, protocolname, temp,&dbv)) + if(!db_get_utf(NULL, protocolname, temp,&dbv)) { //string setzen setString(dbv.pszVal,to); @@ -198,7 +198,7 @@ void Xfire_base::writeUtf8StringtoDB(char*name,unsigned int dbid,int id,char*val //wert aus der dblesen sprintf_s(temp,128,"%s_%i_%i",name,dbid,id); - DBWriteContactSettingUTF8String(NULL, protocolname, temp,val); + db_set_utf(NULL, protocolname, temp,val); } //schreibt einen stringval in die db welche unterid hat @@ -210,7 +210,7 @@ void Xfire_base::writeUtf8StringtoDB(char*name,unsigned int dbid,char*val) //wert aus der dblesen sprintf_s(temp,128,"%s_%i",name,dbid); - DBWriteContactSettingUTF8String(NULL, protocolname, temp,val); + db_set_utf(NULL, protocolname, temp,val); } diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index 0c0a76ce4b..320b2cd4c3 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -1738,7 +1738,7 @@ HANDLE CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan) if(strlen(xfc.nick)>0) { if(myClient->useutf8) - DBWriteContactSettingUTF8String(hContact, protocolname, "Nick", xfc.nick); + db_set_utf(hContact, protocolname, "Nick", xfc.nick); else db_set_s(hContact, protocolname, "Nick", mir_utf8decode(( char* )xfc.nick,NULL)); } @@ -2772,7 +2772,7 @@ void setBuddyStatusMsg(BuddyListEntry *entry) db_free(&dbv); } } - DBWriteContactSettingUTF8String(entry->hcontact, protocolname, "XStatusMsg", xstatus.str().c_str()); + db_set_utf(entry->hcontact, protocolname, "XStatusMsg", xstatus.str().c_str()); } else { @@ -2793,7 +2793,7 @@ void setBuddyStatusMsg(BuddyListEntry *entry) db_set_w(entry->hcontact, protocolname, "Status", status_id); if (!entry->statusmsg.empty()) - DBWriteContactSettingUTF8String(entry->hcontact, "CList", "StatusMsg", entry->statusmsg.c_str()); + db_set_utf(entry->hcontact, "CList", "StatusMsg", entry->statusmsg.c_str()); else db_unset(entry->hcontact, "CList", "StatusMsg"); } @@ -2884,7 +2884,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) if(nick) { if(myClient->useutf8) - DBWriteContactSettingUTF8String(hContact, protocolname, "Nick", nick); + db_set_utf(hContact, protocolname, "Nick", nick); else db_set_s(hContact, protocolname, "Nick", nick); } @@ -2892,7 +2892,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) db_set_s(hContact, protocolname, "Nick", entry->username.c_str()); //db_set_utf(hContact, protocolname, "Nick", entry->nick.c_str()); - //DBWriteContactSettingUTF8String(hContact, protocolname, "Nick", ( char* )entry->nick.c_str()); + //db_set_utf(hContact, protocolname, "Nick", ( char* )entry->nick.c_str()); } else db_set_s(hContact, protocolname, "Nick", entry->username.c_str()); @@ -2903,7 +2903,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) db_unset(hContact, protocolname, "XStatusId"); db_unset(hContact, protocolname, "XStatusName"); db_unset(hContact, "CList", "StatusMsg"); - //DBWriteContactSettingUTF8String(hContact, protocolname, "XStatusName", ""); + //db_set_utf(hContact, protocolname, "XStatusName", ""); db_unset(hContact, protocolname, "ServerIP"); db_unset(hContact, protocolname, "Port"); db_unset(hContact, protocolname, "VServerIP"); @@ -3067,7 +3067,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) //db_unset(hContact, "CList", "StatusMsg"); db_set_w(hContact, protocolname, "Status", ID_STATUS_ONLINE); - DBWriteContactSettingUTF8String(hContact, protocolname, "XStatusName", Translate("Playing")); + db_set_utf(hContact, protocolname, "XStatusName", Translate("Playing")); setBuddyStatusMsg(entry); db_set_b(hContact, protocolname, "XStatusId", xgamelist.iconmngr.getGameIconId(entry->game)+2); @@ -3120,7 +3120,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) db_set_w(hContact, protocolname, "Status", ID_STATUS_ONLINE); db_set_s(entry->hcontact, protocolname, "MirVer", "xfire"); if(clan>0) db_set_dw(hContact, protocolname, "Clan", clan); - //DBWriteContactSettingUTF8String(hContact, "CList", "StatusMsg", ""); + //db_set_utf(hContact, "CList", "StatusMsg", ""); db_unset(hContact, protocolname, "XStatusMsg"); db_unset(hContact, protocolname, "XStatusId"); db_unset(hContact, protocolname, "XStatusName"); @@ -3378,7 +3378,7 @@ static void SendAMAck( LPVOID param ) { DBVARIANT dbv; - if(!DBGetContactSettingUTF8String((HANDLE)param, protocolname, "XStatusMsg",&dbv)) + if(!db_get_utf((HANDLE)param, protocolname, "XStatusMsg",&dbv)) { ProtoBroadcastAck(protocolname, (HANDLE)param, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, LPARAM(dbv.pszVal)); } diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index fcd5827ffd..41f84eb7e7 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -210,16 +210,12 @@ int CYahooProto::Authorize( HANDLE hdbe ) /* Need to remove the buddy from our Miranda Lists */ HANDLE hContact = DbGetAuthEventContact(&dbei); if (hContact != NULL) { - char *who = DBGetString(hContact, m_szModuleName, YAHOO_LOGINID); - if (!who) return 0; - - char *myid = DBGetString(hContact, m_szModuleName, "MyIdentity"); - - DebugLog("Accepting buddy:%s", who); - accept(myid, who, GetWord(hContact, "yprotoid", 0)); - - mir_free(myid); - mir_free(who); + mir_ptr who( db_get_sa(hContact, m_szModuleName, YAHOO_LOGINID)); + if (who) { + mir_ptr myid( db_get_sa(hContact, m_szModuleName, "MyIdentity")); + DebugLog("Accepting buddy:%s", who); + accept(myid, who, GetWord(hContact, "yprotoid", 0)); + } } return 0; @@ -259,19 +255,15 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) /* Need to remove the buddy from our Miranda Lists */ HANDLE hContact = DbGetAuthEventContact(&dbei); if (hContact != NULL) { - char *who = DBGetString(hContact, m_szModuleName, YAHOO_LOGINID); - if (!who) return 0; - - char *myid = DBGetString(hContact, m_szModuleName, "MyIdentity"); - char *u_reason = mir_utf8encodeT(reason); - - DebugLog("Rejecting buddy:%s msg: %s", who, u_reason); - reject(myid, who, GetWord(hContact, "yprotoid", 0), u_reason); - CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0); - - mir_free(u_reason); - mir_free(myid); - mir_free(who); + mir_ptr who( db_get_sa(hContact, m_szModuleName, YAHOO_LOGINID)); + if (who) { + mir_ptr myid( db_get_sa(hContact, m_szModuleName, "MyIdentity")); + mir_ptr u_reason( mir_utf8encodeT(reason)); + + DebugLog("Rejecting buddy:%s msg: %s", who, u_reason); + reject(myid, who, GetWord(hContact, "yprotoid", 0), u_reason); + CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0); + } } return 0; } -- cgit v1.2.3