From d5d50b471277d5d69f59a8f29bf87201149ce191 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 9 Jul 2013 22:02:18 +0000 Subject: applied protocol helpers git-svn-id: http://svn.miranda-ng.org/main/trunk@5305 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/AimOscar/src/avatars.cpp | 12 +- protocols/AimOscar/src/connection.cpp | 2 +- protocols/AimOscar/src/proto.cpp | 2 +- protocols/AimOscar/src/proto.h | 30 ----- protocols/AimOscar/src/server.cpp | 12 +- protocols/AimOscar/src/ui.cpp | 9 +- protocols/AimOscar/src/utility.cpp | 113 +----------------- protocols/IRCG/src/irc.h | 22 ---- protocols/IRCG/src/tools.cpp | 83 ------------- protocols/IcqOscarJ/src/UI/loginpassword.cpp | 4 +- protocols/IcqOscarJ/src/UI/userinfotab.cpp | 4 +- protocols/IcqOscarJ/src/capabilities.cpp | 20 ++-- protocols/IcqOscarJ/src/chan_05ping.cpp | 4 +- protocols/IcqOscarJ/src/changeinfo/db.cpp | 27 ++--- protocols/IcqOscarJ/src/changeinfo/upload.cpp | 2 +- protocols/IcqOscarJ/src/cookies.cpp | 2 +- protocols/IcqOscarJ/src/directpackets.cpp | 2 +- protocols/IcqOscarJ/src/fam_01service.cpp | 30 ++--- protocols/IcqOscarJ/src/fam_02location.cpp | 4 +- protocols/IcqOscarJ/src/fam_03buddy.cpp | 64 +++++----- protocols/IcqOscarJ/src/fam_04message.cpp | 34 +++--- protocols/IcqOscarJ/src/fam_09bos.cpp | 4 +- protocols/IcqOscarJ/src/fam_13servclist.cpp | 136 +++++++++++----------- protocols/IcqOscarJ/src/fam_15icqserver.cpp | 38 +++--- protocols/IcqOscarJ/src/icq_avatar.cpp | 22 ++-- protocols/IcqOscarJ/src/icq_db.cpp | 91 +-------------- protocols/IcqOscarJ/src/icq_db.h | 8 +- protocols/IcqOscarJ/src/icq_direct.cpp | 30 ++--- protocols/IcqOscarJ/src/icq_filetransfer.cpp | 2 +- protocols/IcqOscarJ/src/icq_firstrun.cpp | 4 +- protocols/IcqOscarJ/src/icq_menu.cpp | 10 +- protocols/IcqOscarJ/src/icq_opts.cpp | 64 +++++----- protocols/IcqOscarJ/src/icq_packet.cpp | 6 +- protocols/IcqOscarJ/src/icq_popups.cpp | 98 ++++++++-------- protocols/IcqOscarJ/src/icq_proto.cpp | 32 ++--- protocols/IcqOscarJ/src/icq_proto.h | 14 --- protocols/IcqOscarJ/src/icq_server.cpp | 12 +- protocols/IcqOscarJ/src/icq_servlist.cpp | 94 +++++++-------- protocols/IcqOscarJ/src/icq_uploadui.cpp | 56 ++++----- protocols/IcqOscarJ/src/icq_xstatus.cpp | 70 +++++------ protocols/IcqOscarJ/src/icq_xtraz.cpp | 4 +- protocols/IcqOscarJ/src/icqosc_svcs.cpp | 52 ++++----- protocols/IcqOscarJ/src/init.cpp | 30 ++--- protocols/IcqOscarJ/src/log.cpp | 6 +- protocols/IcqOscarJ/src/oscar_filetransfer.cpp | 10 +- protocols/IcqOscarJ/src/stdpackets.cpp | 14 +-- protocols/IcqOscarJ/src/utilities.cpp | 154 ++++++++++++------------- protocols/JabberG/src/jabber_adhoc.cpp | 2 +- protocols/JabberG/src/jabber_archive.cpp | 6 +- protocols/JabberG/src/jabber_bookmarks.cpp | 12 +- protocols/JabberG/src/jabber_chat.cpp | 12 +- protocols/JabberG/src/jabber_console.cpp | 4 +- protocols/JabberG/src/jabber_disco.cpp | 32 ++--- protocols/JabberG/src/jabber_events.cpp | 12 +- protocols/JabberG/src/jabber_groupchat.cpp | 34 +++--- protocols/JabberG/src/jabber_icolib.cpp | 14 +-- protocols/JabberG/src/jabber_iq_handlers.cpp | 6 +- protocols/JabberG/src/jabber_iqid.cpp | 114 +++++++++--------- protocols/JabberG/src/jabber_menu.cpp | 60 +++++----- protocols/JabberG/src/jabber_misc.cpp | 58 +++++----- protocols/JabberG/src/jabber_notes.cpp | 2 +- protocols/JabberG/src/jabber_opt.cpp | 28 ++--- protocols/JabberG/src/jabber_privacy.cpp | 6 +- protocols/JabberG/src/jabber_proto.cpp | 36 +++--- protocols/JabberG/src/jabber_proto.h | 9 -- protocols/JabberG/src/jabber_rc.cpp | 8 +- protocols/JabberG/src/jabber_search.cpp | 14 +-- protocols/JabberG/src/jabber_std.cpp | 59 +--------- protocols/JabberG/src/jabber_svc.cpp | 14 +-- protocols/JabberG/src/jabber_thread.cpp | 38 +++--- protocols/JabberG/src/jabber_userinfo.cpp | 8 +- protocols/JabberG/src/jabber_util.cpp | 32 ++--- protocols/JabberG/src/jabber_vcard.cpp | 76 ++++++------ protocols/JabberG/src/jabber_xstatus.cpp | 12 +- protocols/MRA/src/MraAdvancedSearch.cpp | 44 +++---- protocols/MRA/src/MraAntiSpam.cpp | 48 ++++---- protocols/MRA/src/MraAvatars.h | 4 +- protocols/MRA/src/MraChat.cpp | 4 +- protocols/MRA/src/MraFilesQueue.cpp | 70 +++++------ protocols/MRA/src/MraMRIMProxy.cpp | 2 +- protocols/MRA/src/MraPopUp.cpp | 34 +++--- protocols/MRA/src/MraProto.cpp | 12 +- protocols/MRA/src/MraProto.h | 15 --- protocols/MRA/src/MraRTFMsg.cpp | 2 +- protocols/MRA/src/MraSendCommand.cpp | 4 +- protocols/MRA/src/Mra_functions.cpp | 68 +++++------ protocols/MRA/src/Mra_options.cpp | 70 +++++------ protocols/MRA/src/Mra_proto.cpp | 84 +++++++------- protocols/MRA/src/Mra_svcs.cpp | 10 +- protocols/MSN/src/msn_proto.h | 21 ---- protocols/MSN/src/msn_std.cpp | 80 ------------- protocols/Yahoo/src/avatar.cpp | 78 ++++++------- protocols/Yahoo/src/chat.cpp | 6 +- protocols/Yahoo/src/file_transfer.cpp | 2 +- protocols/Yahoo/src/im.cpp | 14 +-- protocols/Yahoo/src/options.cpp | 64 +++++----- protocols/Yahoo/src/proto.cpp | 40 +++---- protocols/Yahoo/src/proto.h | 19 --- protocols/Yahoo/src/services.cpp | 30 ++--- protocols/Yahoo/src/user_info.cpp | 6 +- protocols/Yahoo/src/util.cpp | 84 +------------- protocols/Yahoo/src/yahoo.cpp | 78 ++++++------- 102 files changed, 1311 insertions(+), 1933 deletions(-) (limited to 'protocols') diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp index 721488c6f2..a25188706b 100644 --- a/protocols/AimOscar/src/avatars.cpp +++ b/protocols/AimOscar/src/avatars.cpp @@ -22,12 +22,12 @@ void __cdecl CAimProto::avatar_request_thread(void* param) { HANDLE hContact = (HANDLE)param; - char *sn = getSetting(hContact, AIM_KEY_SN); + char *sn = getStringA(hContact, AIM_KEY_SN); LOG("Starting avatar request thread for %s)", sn); if (wait_conn(hAvatarConn, hAvatarEvent, 0x10)) { - char *hash_str = getSetting(hContact, AIM_KEY_AH); + char *hash_str = getStringA(hContact, AIM_KEY_AH); char type = getByte(hContact, AIM_KEY_AHT, 1); size_t len = (strlen(hash_str) + 1) / 2; @@ -67,7 +67,7 @@ void CAimProto::avatar_request_handler(HANDLE hContact, char* hash, unsigned cha type = hash_lg ? 12 : 1; } - char* saved_hash = getSetting(hContact, AIM_KEY_AH); + char* saved_hash = getStringA(hContact, AIM_KEY_AH); if (hash && _stricmp(hash, "0201d20472") && _stricmp(hash, "2b00003341")) //gaim default icon fix- we don't want their blank icon displaying. { if (_strcmps(saved_hash, hash)) @@ -82,8 +82,8 @@ void CAimProto::avatar_request_handler(HANDLE hContact, char* hash, unsigned cha { if (saved_hash) { - deleteSetting(hContact, AIM_KEY_AHT); - deleteSetting(hContact, AIM_KEY_AH); + db_unset(hContact, m_szModuleName, AIM_KEY_AHT); + db_unset(hContact, m_szModuleName, AIM_KEY_AH); ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0); } @@ -112,7 +112,7 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* hash, const _close(fileId); res = true; - char *my_sn = getSetting(AIM_KEY_SN); + char *my_sn = getStringA(AIM_KEY_SN); if (!_strcmps(sn, my_sn)) CallService(MS_AV_REPORTMYAVATARCHANGED, (WPARAM)m_szModuleName, 0); mir_free(my_sn); diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp index a7fb998ca1..327274dac4 100644 --- a/protocols/AimOscar/src/connection.cpp +++ b/protocols/AimOscar/src/connection.cpp @@ -95,7 +95,7 @@ void CAimProto::aim_connection_authorization(void) goto exit; mir_free(username); - username = getSetting(AIM_KEY_SN); + username = getStringA(AIM_KEY_SN); if (username == NULL) goto exit; diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index 2d13a60e8b..e3821fed42 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -572,7 +572,7 @@ int __cdecl CAimProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc) ForkThread(&CAimProto::msg_ack_success, msg_ack); } - char *sn = getSetting(hContact, AIM_KEY_SN); + char *sn = getStringA(hContact, AIM_KEY_SN); if (sn == NULL) { msg_ack_param *msg_ack = (msg_ack_param*)mir_calloc(sizeof(msg_ack_param)); diff --git a/protocols/AimOscar/src/proto.h b/protocols/AimOscar/src/proto.h index 3cb22c28d2..c829c64ec8 100644 --- a/protocols/AimOscar/src/proto.h +++ b/protocols/AimOscar/src/proto.h @@ -452,36 +452,6 @@ struct CAimProto : public PROTO unsigned short* get_members_of_group(unsigned short group_id, unsigned short& size); void ShowPopup( const char* msg, int flags, char* url = 0 ); - - ////////////////////////////////////////////////////////////////////////////////////// - HANDLE CreateProtoEvent(const char* szEvent); - - int deleteSetting(HANDLE hContact, const char* setting); - - bool getBool(HANDLE hContact, const char* name, bool defaultValue); - int getByte(const char* name, BYTE defaultValue ); - int getByte(HANDLE hContact, const char* name, BYTE defaultValue); - int getDword(const char* name, DWORD defaultValue); - int getDword(HANDLE hContact, const char* name, DWORD defaultValue); - int getString(const char* name, DBVARIANT*); - int getString(HANDLE hContact, const char* name, DBVARIANT*); - int getTString(const char* name, DBVARIANT*); - int getTString(HANDLE hContact, const char* name, DBVARIANT*); - WORD getWord(const char* name, WORD defaultValue); - WORD getWord(HANDLE hContact, const char* name, WORD defaultValue); - char* getSetting(HANDLE hContact, const char* setting); - char* getSetting(const char* setting); - - void setByte(const char* name, BYTE value); - void setByte(HANDLE hContact, const char* name, BYTE value); - void setDword(const char* name, DWORD value); - void setDword(HANDLE hContact, const char* name, DWORD value); - void setString(const char* name, const char* value); - void setString(HANDLE hContact, const char* name, const char* value); - void setTString(const char* name, const TCHAR* value); - void setTString(HANDLE hContact, const char* name, const TCHAR* value); - void setWord(const char* name, WORD value); - void setWord(HANDLE hContact, const char* name, WORD value); }; #endif diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index 7c42ff979b..9726d9468e 100644 --- a/protocols/AimOscar/src/server.cpp +++ b/protocols/AimOscar/src/server.cpp @@ -265,28 +265,18 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003 if (icq) setString(hContact, "Transport", "ICQ"); else - deleteSetting(hContact, "Transport" ); + db_unset(hContact, m_szModuleName, "Transport" ); if (admin_aol) - { setByte(hContact, AIM_KEY_AC, ACCOUNT_TYPE_ADMIN); - } else if (aol) - { setByte(hContact, AIM_KEY_AC, ACCOUNT_TYPE_AOL); - } else if (icq) - { setByte(hContact, AIM_KEY_AC, ACCOUNT_TYPE_ICQ); - } else if (unconfirmed) - { setByte(hContact, AIM_KEY_AC, ACCOUNT_TYPE_UNCONFIRMED); - } else - { setByte(hContact, AIM_KEY_AC, ACCOUNT_TYPE_CONFIRMED); - } if (bot) { diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp index f98f643db2..7011320cab 100644 --- a/protocols/AimOscar/src/ui.cpp +++ b/protocols/AimOscar/src/ui.cpp @@ -880,7 +880,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (strlen(str)>0) ppro->setString(AIM_KEY_SN, str); else - ppro->deleteSetting(NULL, AIM_KEY_SN); + db_unset(NULL, ppro->m_szModuleName, AIM_KEY_SN); //END SN //NK @@ -900,8 +900,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(str), (LPARAM) str); ppro->setString(AIM_KEY_PW, str); } - else - ppro->deleteSetting(NULL, AIM_KEY_PW); + else db_unset(NULL, ppro->m_szModuleName, AIM_KEY_PW); //END PW //HN @@ -909,7 +908,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (strlen(str)>0 && strcmp(str, AIM_DEFAULT_SERVER)) ppro->setString(AIM_KEY_HN, str); else - ppro->deleteSetting(NULL, AIM_KEY_HN); + db_unset(NULL, ppro->m_szModuleName, AIM_KEY_HN); //END HN //Delivery Confirmation @@ -937,7 +936,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (port > 0 && port != ppro->getByte(AIM_KEY_DSSL, 0) ? AIM_DEFAULT_PORT : AIM_DEFAULT_SSL_PORT) ppro->setWord(AIM_KEY_PN, (WORD)port); else - ppro->deleteSetting(NULL, AIM_KEY_PN); + db_unset(NULL, ppro->m_szModuleName, AIM_KEY_PN); //END PN //Disable Account Type Icons diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index be6ac0b388..db6dba0590 100644 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -112,7 +112,7 @@ void CAimProto::start_connection(void *arg) bool use_ssl = !getByte(AIM_KEY_DSSL, 0); - char* login_url = getSetting(AIM_KEY_HN); + char* login_url = getStringA(AIM_KEY_HN); if (login_url == NULL) login_url = mir_strdup(use_ssl ? AIM_DEFAULT_SERVER : AIM_DEFAULT_SERVER_NS); hServerConn = aim_connect(login_url, get_default_port(), use_ssl, login_url); @@ -292,7 +292,7 @@ void CAimProto::add_contact_to_group(HANDLE hContact, const char* new_group) LOG("Removing buddy %s:%u %s:%u from the serverside list", dbv.pszVal, item_id, old_group, old_group_id); aim_delete_contact(hServerConn, seqno, dbv.pszVal, item_id, old_group_id, 0, is_not_in_list); update_server_group(old_group, old_group_id); - deleteSetting(hContact, AIM_KEY_NIL); + db_unset(hContact, m_szModuleName, AIM_KEY_NIL); } aim_ssi_update(hServerConn, seqno, false); @@ -516,7 +516,7 @@ int CAimProto::deleteBuddyId(HANDLE hContact, int i) { char item[sizeof(AIM_KEY_BI)+10]; mir_snprintf(item, sizeof(AIM_KEY_BI)+10, AIM_KEY_BI"%d", i); - return deleteSetting(hContact, item); + return db_unset(hContact, m_szModuleName, item); } unsigned short CAimProto::getGroupId(HANDLE hContact, int i) @@ -537,7 +537,7 @@ int CAimProto::deleteGroupId(HANDLE hContact, int i) { char item[sizeof(AIM_KEY_GI)+10]; mir_snprintf(item, sizeof(AIM_KEY_GI)+10, AIM_KEY_GI"%d", i); - return deleteSetting(hContact, item); + return db_unset(hContact, m_szModuleName, item); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -699,108 +699,3 @@ unsigned short get_random(void) id &= 0x7fff; return id; } - -///////////////////////////////////////////////////////////////////////////////////////// -// Standard functions - -int CAimProto::deleteSetting(HANDLE hContact, const char* setting) -{ return db_unset(hContact, m_szModuleName, setting); -} - -bool CAimProto::getBool(HANDLE hContact, const char* name, bool defaultValue) -{ return db_get_b(hContact, m_szModuleName, name, defaultValue) != 0; -} - -int CAimProto::getByte(const char* name, BYTE defaultValue) -{ return db_get_b(NULL, m_szModuleName, name, defaultValue); -} - -int CAimProto::getByte(HANDLE hContact, const char* name, BYTE defaultValue) -{ return db_get_b(hContact, m_szModuleName, name, defaultValue); -} - -int CAimProto::getDword(const char* name, DWORD defaultValue) -{ return db_get_dw(NULL, m_szModuleName, name, defaultValue); -} - -int CAimProto::getDword(HANDLE hContact, const char* name, DWORD defaultValue) -{ return db_get_dw(hContact, m_szModuleName, name, defaultValue); -} - -int CAimProto::getString(const char* name, DBVARIANT* result) -{ return db_get_s(NULL, m_szModuleName, name, result); -} - -int CAimProto::getString(HANDLE hContact, const char* name, DBVARIANT* result) -{ return db_get_s(hContact, m_szModuleName, name, result); -} - -int CAimProto::getTString(const char* name, DBVARIANT* result) -{ return db_get_ts(NULL, m_szModuleName, name, result); -} - -int CAimProto::getTString(HANDLE hContact, const char* name, DBVARIANT* result) -{ return db_get_ts(hContact, m_szModuleName, name, result); -} - -WORD CAimProto::getWord(const char* name, WORD defaultValue) -{ return (WORD)db_get_w(NULL, m_szModuleName, name, defaultValue); -} - -WORD CAimProto::getWord(HANDLE hContact, const char* name, WORD defaultValue) -{ return (WORD)db_get_w(hContact, m_szModuleName, name, defaultValue); -} - -char* CAimProto::getSetting(HANDLE hContact, const char* setting) -{ - DBVARIANT dbv; - return db_get_s(hContact, m_szModuleName, setting, &dbv) ? - NULL : dbv.pszVal; -} - -char* CAimProto::getSetting(const char* setting) -{ - DBVARIANT dbv; - return db_get_s(NULL, m_szModuleName, setting, &dbv) ? - NULL : dbv.pszVal; -} - -void CAimProto::setByte(const char* name, BYTE value) -{ db_set_b(NULL, m_szModuleName, name, value); -} - -void CAimProto::setByte(HANDLE hContact, const char* name, BYTE value) -{ db_set_b(hContact, m_szModuleName, name, value); -} - -void CAimProto::setDword(const char* name, DWORD value) -{ db_set_dw(NULL, m_szModuleName, name, value); -} - -void CAimProto::setDword(HANDLE hContact, const char* name, DWORD value) -{ db_set_dw(hContact, m_szModuleName, name, value); -} - -void CAimProto::setString(const char* name, const char* value) -{ db_set_s(NULL, m_szModuleName, name, value); -} - -void CAimProto::setString(HANDLE hContact, const char* name, const char* value) -{ db_set_s(hContact, m_szModuleName, name, value); -} - -void CAimProto::setTString(const char* name, const TCHAR* value) -{ db_set_ts(NULL, m_szModuleName, name, value); -} - -void CAimProto::setTString(HANDLE hContact, const char* name, const TCHAR* value) -{ db_set_ts(hContact, m_szModuleName, name, value); -} - -void CAimProto::setWord(const char* name, WORD value) -{ db_set_w(NULL, m_szModuleName, name, value); -} - -void CAimProto::setWord(HANDLE hContact, const char* name, WORD value) -{ db_set_w(hContact, m_szModuleName, name, value); -} diff --git a/protocols/IRCG/src/irc.h b/protocols/IRCG/src/irc.h index a7ba4ab3bf..d347f213f9 100644 --- a/protocols/IRCG/src/irc.h +++ b/protocols/IRCG/src/irc.h @@ -505,28 +505,6 @@ struct CIrcProto : public PROTO CMString GetNextUserhostReason(int type); CMString PeekAtReasons(int type); - int getByte( const char* name, BYTE defaultValue ); - int getByte( HANDLE hContact, const char* name, BYTE defaultValue ); - int getDword( const char* name, DWORD defaultValue ); - int getDword( HANDLE hContact, const char* name, DWORD defaultValue ); - int getString( const char* name, DBVARIANT* ); - int getString( HANDLE hContact, const char* name, DBVARIANT* ); - int getTString( const char* name, DBVARIANT* ); - int getTString( HANDLE hContact, const char* name, DBVARIANT* ); - int getWord( const char* name, WORD defaultValue ); - int getWord( HANDLE hContact, const char* name, WORD defaultValue ); - - void setByte( const char* name, BYTE value ); - void setByte( HANDLE hContact, const char* name, BYTE value ); - void setDword( const char* name, DWORD value ); - void setDword( HANDLE hContact, const char* name, DWORD value ); - void setString( const char* name, const char* value ); - void setString( HANDLE hContact, const char* name, const char* value ); - void setTString( const char* name, const TCHAR* value ); - void setTString( HANDLE hContact, const char* name, const TCHAR* value ); - void setWord( const char* name, int value ); - void setWord( HANDLE hContact, const char* name, int value ); - // userinfo.cpp void __cdecl AckUserInfoSearch( void* hContact ); diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp index 0d12162854..76e89c81f0 100644 --- a/protocols/IRCG/src/tools.cpp +++ b/protocols/IRCG/src/tools.cpp @@ -21,89 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "irc.h" -///////////////////////////////////////////////////////////////////////////////////////// -// Standard functions - -int CIrcProto::getByte( const char* name, BYTE defaultValue ) -{ return db_get_b( NULL, m_szModuleName, name, defaultValue ); -} - -int CIrcProto::getByte( HANDLE hContact, const char* name, BYTE defaultValue ) -{ return db_get_b(hContact, m_szModuleName, name, defaultValue ); -} - -int CIrcProto::getDword( const char* name, DWORD defaultValue ) -{ return db_get_dw( NULL, m_szModuleName, name, defaultValue ); -} - -int CIrcProto::getDword( HANDLE hContact, const char* name, DWORD defaultValue ) -{ return db_get_dw(hContact, m_szModuleName, name, defaultValue ); -} - -int CIrcProto::getString( const char* name, DBVARIANT* result ) -{ return db_get_s( NULL, m_szModuleName, name, result ); -} - -int CIrcProto::getString( HANDLE hContact, const char* name, DBVARIANT* result ) -{ return db_get_s( hContact, m_szModuleName, name, result ); -} - -int CIrcProto::getTString( const char* name, DBVARIANT* result ) -{ return db_get_ts( NULL, m_szModuleName, name, result ); -} - -int CIrcProto::getTString( HANDLE hContact, const char* name, DBVARIANT* result ) -{ return db_get_ts( hContact, m_szModuleName, name, result ); -} - -int CIrcProto::getWord( const char* name, WORD defaultValue ) -{ return db_get_w( NULL, m_szModuleName, name, defaultValue ); -} - -int CIrcProto::getWord( HANDLE hContact, const char* name, WORD defaultValue ) -{ return db_get_w(hContact, m_szModuleName, name, defaultValue ); -} - -void CIrcProto::setByte( const char* name, BYTE value ) -{ db_set_b(NULL, m_szModuleName, name, value ); -} - -void CIrcProto::setByte( HANDLE hContact, const char* name, BYTE value ) -{ db_set_b(hContact, m_szModuleName, name, value ); -} - -void CIrcProto::setDword( const char* name, DWORD value ) -{ db_set_dw(NULL, m_szModuleName, name, value ); -} - -void CIrcProto::setDword( HANDLE hContact, const char* name, DWORD value ) -{ db_set_dw(hContact, m_szModuleName, name, value ); -} - -void CIrcProto::setString( const char* name, const char* value ) -{ db_set_s(NULL, m_szModuleName, name, value ); -} - -void CIrcProto::setString( HANDLE hContact, const char* name, const char* value ) -{ db_set_s(hContact, m_szModuleName, name, value ); -} - -void CIrcProto::setTString( const char* name, const TCHAR* value ) -{ db_set_ts(NULL, m_szModuleName, name, value ); -} - -void CIrcProto::setTString( HANDLE hContact, const char* name, const TCHAR* value ) -{ db_set_ts(hContact, m_szModuleName, name, value ); -} - -void CIrcProto::setWord( const char* name, int value ) -{ db_set_w(NULL, m_szModuleName, name, value ); -} - -void CIrcProto::setWord( HANDLE hContact, const char* name, int value ) -{ db_set_w(hContact, m_szModuleName, name, value ); -} - ///////////////////////////////////////////////////////////////////////////////////////// void CIrcProto::AddToJTemp(TCHAR op, CMString& sCommand) diff --git a/protocols/IcqOscarJ/src/UI/loginpassword.cpp b/protocols/IcqOscarJ/src/UI/loginpassword.cpp index 0699a686b4..5263af17a2 100644 --- a/protocols/IcqOscarJ/src/UI/loginpassword.cpp +++ b/protocols/IcqOscarJ/src/UI/loginpassword.cpp @@ -52,7 +52,7 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SendDlgItemMessage(hwndDlg, IDC_LOGINPW, EM_LIMITTEXT, PASSWORDMAXLEN - 1, 0); - CheckDlgButton(hwndDlg, IDC_SAVEPASS, ppro->getSettingByte(NULL, "RememberPass", 0)); + CheckDlgButton(hwndDlg, IDC_SAVEPASS, ppro->getByte("RememberPass", 0)); } break; @@ -69,7 +69,7 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA switch (LOWORD(wParam)) { case IDOK: ppro->m_bRememberPwd = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVEPASS); - ppro->setSettingByte(NULL, "RememberPass", ppro->m_bRememberPwd); + ppro->setByte("RememberPass", ppro->m_bRememberPwd); GetDlgItemTextA(hwndDlg, IDC_LOGINPW, ppro->m_szPassword, sizeof(ppro->m_szPassword)); diff --git a/protocols/IcqOscarJ/src/UI/userinfotab.cpp b/protocols/IcqOscarJ/src/UI/userinfotab.cpp index 50ee92ce24..7224196744 100644 --- a/protocols/IcqOscarJ/src/UI/userinfotab.cpp +++ b/protocols/IcqOscarJ/src/UI/userinfotab.cpp @@ -245,8 +245,8 @@ static INT_PTR CALLBACK IcqDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetValue(ppro, hwndDlg, IDC_PORT, hContact, szProto, "UserPort", SVS_ZEROISUNSPEC); SetValue(ppro, hwndDlg, IDC_VERSION, hContact, szProto, "Version", SVS_ICQVERSION); SetValue(ppro, hwndDlg, IDC_MIRVER, hContact, szProto, "MirVer", SVS_ZEROISUNSPEC); - if (ppro->getSettingByte(hContact, "ClientID", 0)) - ppro->setSettingDword(hContact, "TickTS", 0); + if (ppro->getByte(hContact, "ClientID", 0)) + ppro->setDword(hContact, "TickTS", 0); SetValue(ppro, hwndDlg, IDC_SYSTEMUPTIME, hContact, szProto, "TickTS", SVS_TIMESTAMP); SetValue(ppro, hwndDlg, IDC_STATUS, hContact, szProto, "Status", SVS_STATUSID); } diff --git a/protocols/IcqOscarJ/src/capabilities.cpp b/protocols/IcqOscarJ/src/capabilities.cpp index f994f861af..4c374ed492 100644 --- a/protocols/IcqOscarJ/src/capabilities.cpp +++ b/protocols/IcqOscarJ/src/capabilities.cpp @@ -104,7 +104,7 @@ void NetLog_CapabilityChange(CIcqProto *ppro, const char *szChange, DWORD fdwCap // Deletes all oscar capabilities for a given contact void CIcqProto::ClearAllContactCapabilities(HANDLE hContact) { - setSettingDword(hContact, DBSETTING_CAPABILITIES, 0); + setDword(hContact, DBSETTING_CAPABILITIES, 0); } @@ -112,7 +112,7 @@ void CIcqProto::ClearAllContactCapabilities(HANDLE hContact) void CIcqProto::ClearContactCapabilities(HANDLE hContact, DWORD fdwCapabilities) { // Get current capability flags - DWORD fdwContactCaps = getSettingDword(hContact, DBSETTING_CAPABILITIES, 0); + DWORD fdwContactCaps = getDword(hContact, DBSETTING_CAPABILITIES, 0); if (fdwContactCaps != (fdwContactCaps & ~fdwCapabilities)) { @@ -123,7 +123,7 @@ void CIcqProto::ClearContactCapabilities(HANDLE hContact, DWORD fdwCapabilities) fdwContactCaps &= ~fdwCapabilities; // And write it back to disk - setSettingDword(hContact, DBSETTING_CAPABILITIES, fdwContactCaps); + setDword(hContact, DBSETTING_CAPABILITIES, fdwContactCaps); } } @@ -132,7 +132,7 @@ void CIcqProto::ClearContactCapabilities(HANDLE hContact, DWORD fdwCapabilities) void CIcqProto::SetContactCapabilities(HANDLE hContact, DWORD fdwCapabilities) { // Get current capability flags - DWORD fdwContactCaps = getSettingDword(hContact, DBSETTING_CAPABILITIES, 0); + DWORD fdwContactCaps = getDword(hContact, DBSETTING_CAPABILITIES, 0); if (fdwContactCaps != (fdwContactCaps | fdwCapabilities)) { @@ -143,7 +143,7 @@ void CIcqProto::SetContactCapabilities(HANDLE hContact, DWORD fdwCapabilities) fdwContactCaps |= fdwCapabilities; // And write it back to disk - setSettingDword(hContact, DBSETTING_CAPABILITIES, fdwContactCaps); + setDword(hContact, DBSETTING_CAPABILITIES, fdwContactCaps); } } @@ -152,7 +152,7 @@ void CIcqProto::SetContactCapabilities(HANDLE hContact, DWORD fdwCapabilities) BOOL CIcqProto::CheckContactCapabilities(HANDLE hContact, DWORD fdwCapabilities) { // Get current capability flags - DWORD fdwContactCaps = getSettingDword(hContact, DBSETTING_CAPABILITIES, 0); + DWORD fdwContactCaps = getDword(hContact, DBSETTING_CAPABILITIES, 0); // Check if all requested capabilities are supported if ((fdwContactCaps & fdwCapabilities) == fdwCapabilities) @@ -221,7 +221,7 @@ DWORD GetCapabilitiesFromBuffer(BYTE *pBuffer, int nLength) void CIcqProto::AddCapabilitiesFromBuffer(HANDLE hContact, BYTE *pBuffer, int nLength) { // Get current capability flags - DWORD fdwContactCaps = getSettingDword(hContact, DBSETTING_CAPABILITIES, 0); + DWORD fdwContactCaps = getDword(hContact, DBSETTING_CAPABILITIES, 0); // Get capability flags from buffer DWORD fdwCapabilities = GetCapabilitiesFromBuffer(pBuffer, nLength); @@ -234,7 +234,7 @@ void CIcqProto::AddCapabilitiesFromBuffer(HANDLE hContact, BYTE *pBuffer, int nL fdwContactCaps |= fdwCapabilities; // And write them back to database - setSettingDword(hContact, DBSETTING_CAPABILITIES, fdwContactCaps); + setDword(hContact, DBSETTING_CAPABILITIES, fdwContactCaps); } } @@ -244,7 +244,7 @@ void CIcqProto::AddCapabilitiesFromBuffer(HANDLE hContact, BYTE *pBuffer, int nL void CIcqProto::SetCapabilitiesFromBuffer(HANDLE hContact, BYTE *pBuffer, int nLength, BOOL bReset) { // Get current capability flags - DWORD fdwContactCaps = bReset ? 0 : getSettingDword(hContact, DBSETTING_CAPABILITIES, 0); + DWORD fdwContactCaps = bReset ? 0 : getDword(hContact, DBSETTING_CAPABILITIES, 0); // Get capability flags from buffer DWORD fdwCapabilities = GetCapabilitiesFromBuffer(pBuffer, nLength); @@ -266,6 +266,6 @@ void CIcqProto::SetCapabilitiesFromBuffer(HANDLE hContact, BYTE *pBuffer, int nL fdwContactCaps |= fdwCapabilities; // And write them back to database - setSettingDword(hContact, DBSETTING_CAPABILITIES, fdwContactCaps); + setDword(hContact, DBSETTING_CAPABILITIES, fdwContactCaps); } } diff --git a/protocols/IcqOscarJ/src/chan_05ping.cpp b/protocols/IcqOscarJ/src/chan_05ping.cpp index cc28e5c185..e74071dc4b 100644 --- a/protocols/IcqOscarJ/src/chan_05ping.cpp +++ b/protocols/IcqOscarJ/src/chan_05ping.cpp @@ -40,7 +40,7 @@ void __cdecl CIcqProto::KeepAliveThread(void *arg) { serverthread_info *info = (serverthread_info*)arg; icq_packet packet; - DWORD dwInterval = getSettingDword(NULL, "KeepAliveInterval", KEEPALIVE_INTERVAL); + DWORD dwInterval = getDword("KeepAliveInterval", KEEPALIVE_INTERVAL); NetLog_Server("Keep alive thread starting."); @@ -77,7 +77,7 @@ void CIcqProto::StartKeepAlive(serverthread_info *info) if (info->hKeepAliveEvent) // start only once return; - if (getSettingByte(NULL, "KeepAlive", DEFAULT_KEEPALIVE_ENABLED)) + if (getByte("KeepAlive", DEFAULT_KEEPALIVE_ENABLED)) CloseHandle( ForkThreadEx(&CIcqProto::KeepAliveThread, info, 0)); } diff --git a/protocols/IcqOscarJ/src/changeinfo/db.cpp b/protocols/IcqOscarJ/src/changeinfo/db.cpp index ba231acebe..b5d4e81348 100644 --- a/protocols/IcqOscarJ/src/changeinfo/db.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/db.cpp @@ -27,7 +27,6 @@ // ----------------------------------------------------------------------------- #include "icqoscar.h" - void ChangeInfoData::LoadSettingsFromDb(int keepChanged) { for (int i=0; i < settingCount; i++) @@ -86,7 +85,6 @@ void ChangeInfoData::LoadSettingsFromDb(int keepChanged) } } - void ChangeInfoData::FreeStoredDbSettings(void) { for (int i=0; i < settingCount; i++ ) @@ -94,7 +92,6 @@ void ChangeInfoData::FreeStoredDbSettings(void) SAFE_FREE((void**)&settingData[i].value); } - int ChangeInfoData::ChangesMade(void) { for (int i=0; i < settingCount; i++ ) @@ -103,7 +100,6 @@ int ChangeInfoData::ChangesMade(void) return 0; } - void ChangeInfoData::ClearChangeFlags(void) { for (int i=0; i < settingCount; i++) @@ -163,17 +159,16 @@ static INT_PTR CALLBACK PwConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, return FALSE; } - int ChangeInfoData::SaveSettingsToDb(HWND hwndDlg) { int ret = 1; for (int i = 0; i < settingCount; i++) - { + { if (!settingData[i].changed) continue; if (!(setting[i].displayType & LIF_ZEROISVALID) && settingData[i].value==0) - { - ppro->deleteSetting(NULL, setting[i].szDbSetting); + { + db_unset(NULL, ppro->m_szModuleName, setting[i].szDbSetting); continue; } switch(setting[i].dbType) { @@ -198,25 +193,25 @@ int ChangeInfoData::SaveSettingsToDb(HWND hwndDlg) } else { if (*(char*)settingData[i].value) - ppro->setSettingStringUtf(NULL, setting[i].szDbSetting, (char*)settingData[i].value); + db_set_utf(NULL, ppro->m_szModuleName, setting[i].szDbSetting, (char*)settingData[i].value); else - ppro->deleteSetting(NULL, setting[i].szDbSetting); + db_unset(NULL, ppro->m_szModuleName, setting[i].szDbSetting); } break; - case DBVT_UTF8: + case DBVT_UTF8: if (*(char*)settingData[i].value) - ppro->setSettingStringUtf(NULL, setting[i].szDbSetting, (char*)settingData[i].value); + db_set_utf(NULL, ppro->m_szModuleName, setting[i].szDbSetting, (char*)settingData[i].value); else - ppro->deleteSetting(NULL, setting[i].szDbSetting); - break; + db_unset(NULL, ppro->m_szModuleName, setting[i].szDbSetting); + break; case DBVT_WORD: - ppro->setSettingWord(NULL, setting[i].szDbSetting, (WORD)settingData[i].value); + ppro->setWord(setting[i].szDbSetting, (WORD)settingData[i].value); break; case DBVT_BYTE: - ppro->setSettingByte(NULL, setting[i].szDbSetting, (BYTE)settingData[i].value); + ppro->setByte(setting[i].szDbSetting, (BYTE)settingData[i].value); break; } } diff --git a/protocols/IcqOscarJ/src/changeinfo/upload.cpp b/protocols/IcqOscarJ/src/changeinfo/upload.cpp index 165d65fa22..13d017e7cb 100644 --- a/protocols/IcqOscarJ/src/changeinfo/upload.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/upload.cpp @@ -87,7 +87,7 @@ int ChangeInfoData::UploadSettings(void) CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(ptmp), (LPARAM)ptmp); - ppro->setSettingString(NULL, "Password", ptmp); + ppro->setString("Password", ptmp); } } } diff --git a/protocols/IcqOscarJ/src/cookies.cpp b/protocols/IcqOscarJ/src/cookies.cpp index 87ffb4bc07..36aa83c329 100644 --- a/protocols/IcqOscarJ/src/cookies.cpp +++ b/protocols/IcqOscarJ/src/cookies.cpp @@ -283,7 +283,7 @@ cookie_message_data* CIcqProto::CreateMessageCookieData(BYTE bMsgType, HANDLE hC BYTE bAckType; WORD wStatus = getContactStatus(hContact); - if (!getSettingByte(hContact, "SlowSend", getSettingByte(NULL, "SlowSend", DEFAULT_SLOWSEND)) || + if (!getByte(hContact, "SlowSend", getByte("SlowSend", DEFAULT_SLOWSEND)) || (!dwUin && wStatus == ID_STATUS_OFFLINE)) bAckType = ACKTYPE_NONE; else if (bUseSrvRelay) diff --git a/protocols/IcqOscarJ/src/directpackets.cpp b/protocols/IcqOscarJ/src/directpackets.cpp index fa21a949d5..cf9f698500 100644 --- a/protocols/IcqOscarJ/src/directpackets.cpp +++ b/protocols/IcqOscarJ/src/directpackets.cpp @@ -81,7 +81,7 @@ DWORD CIcqProto::icq_sendGetAwayMsgDirect(HANDLE hContact, int type) DWORD dwCookie; cookie_message_data *pCookieData; - if (getSettingWord(hContact, "Version", 0) == 9) + if (getWord(hContact, "Version", 0) == 9) return 0; // v9 DC protocol does not support this message pCookieData = CreateMessageCookie(MTYPE_AUTOAWAY, (BYTE)type); diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp index a7c45d0e1c..3923e813c5 100644 --- a/protocols/IcqOscarJ/src/fam_01service.cpp +++ b/protocols/IcqOscarJ/src/fam_01service.cpp @@ -103,8 +103,8 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header cookie_servlist_action* ack; DWORD dwCookie; - DWORD dwLastUpdate = getSettingDword(NULL, "SrvLastUpdate", 0); - WORD wRecordCount = getSettingWord(NULL, "SrvRecordCount", 0); + DWORD dwLastUpdate = getDword("SrvLastUpdate", 0); + WORD wRecordCount = getWord("SrvRecordCount", 0); // CLI_REQLISTS - we want to use SSI #ifdef _DEBUG @@ -294,14 +294,14 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header // Save external IP dwValue = chain->getDWord(0x0A, 1); - setSettingDword(NULL, "IP", dwValue); + setDword("IP", dwValue); // Save member since timestamp dwValue = chain->getDWord(0x05, 1); - if (dwValue) setSettingDword(NULL, "MemberTS", dwValue); + if (dwValue) setDword("MemberTS", dwValue); dwValue = chain->getDWord(0x03, 1); - setSettingDword(NULL, "LogonTS", dwValue ? dwValue : time(NULL)); + setDword("LogonTS", dwValue ? dwValue : time(NULL)); disposeChain(&chain); @@ -453,7 +453,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header #endif if (m_bAvatarsEnabled && !info->bMyAvatarInited) // signal the server after login { // this refreshes avatar state - it used to work automatically, but now it does not - if (getSettingByte(NULL, "ForceOurAvatar", 0)) + if (getByte("ForceOurAvatar", 0)) { // keep our avatar TCHAR *file = GetOwnAvatarFileName(); SetMyAvatar(0, (LPARAM)file); @@ -557,18 +557,18 @@ char* CIcqProto::buildUinList(int subtype, WORD wMaxLen, HANDLE* hContactResume) { case BUL_VISIBLE: - add = ID_STATUS_ONLINE == getSettingWord(hContact, "ApparentMode", 0); + add = ID_STATUS_ONLINE == getWord(hContact, "ApparentMode", 0); break; case BUL_INVISIBLE: - add = ID_STATUS_OFFLINE == getSettingWord(hContact, "ApparentMode", 0); + add = ID_STATUS_OFFLINE == getWord(hContact, "ApparentMode", 0); break; case BUL_TEMPVISIBLE: - add = getSettingByte(hContact, "TemporaryVisible", 0); + add = getByte(hContact, "TemporaryVisible", 0); // clear temporary flag // Here we assume that all temporary contacts will be in one packet - setSettingByte(hContact, "TemporaryVisible", 0); + setByte(hContact, "TemporaryVisible", 0); break; default: @@ -577,8 +577,8 @@ char* CIcqProto::buildUinList(int subtype, WORD wMaxLen, HANDLE* hContactResume) // If we are in SS mode, we only add those contacts that are // not in our SS list, or are awaiting authorization, to our // client side list - if (m_bSsiEnabled && getSettingWord(hContact, DBSETTING_SERVLIST_ID, 0) && - !getSettingByte(hContact, "Auth", 0)) + if (m_bSsiEnabled && getWord(hContact, DBSETTING_SERVLIST_ID, 0) && + !getByte(hContact, "Auth", 0)) add = 0; // Never add hidden contacts to CS list @@ -841,7 +841,7 @@ void CIcqProto::handleServUINSettings(int nPort, serverthread_info *info) packWord(&packet, wStatus); // Status packTLVWord(&packet, 0x0008, 0x0A06); // TLV 8: Independent Status Messages packDWord(&packet, 0x000c0025); // TLV C: Direct connection info - packDWord(&packet, getSettingDword(NULL, "RealIP", 0)); + packDWord(&packet, getDword("RealIP", 0)); packDWord(&packet, nPort); packByte(&packet, DC_TYPE); // TCP/FLAG firewall settings packWord(&packet, ICQ_VERSION); @@ -877,8 +877,8 @@ void CIcqProto::handleServUINSettings(int nPort, serverthread_info *info) packBuffer(&packet, (LPBYTE)szMoodData, wStatusMoodLen); // Mood // Save current status note & mood - setSettingStringUtf(NULL, DBSETTING_STATUS_NOTE, szStatusNote); - setSettingString(NULL, DBSETTING_STATUS_MOOD, szMoodData); + db_set_utf(NULL, m_szModuleName, DBSETTING_STATUS_NOTE, szStatusNote); + setString(DBSETTING_STATUS_MOOD, szMoodData); } // Release memory SAFE_FREE(&szStatusNote); diff --git a/protocols/IcqOscarJ/src/fam_02location.cpp b/protocols/IcqOscarJ/src/fam_02location.cpp index 7687c18444..0c7c563fe3 100644 --- a/protocols/IcqOscarJ/src/fam_02location.cpp +++ b/protocols/IcqOscarJ/src/fam_02location.cpp @@ -188,7 +188,7 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, WORD wLen, DWORD dwCookie if (pTLV && pTLV->wLen > 0) // store client capabilities db_set_blob(hContact, m_szModuleName, "CapBuf", pTLV->pData, pTLV->wLen); else - deleteSetting(hContact, "CapBuf"); + db_unset(hContact, m_szModuleName, "CapBuf"); pTLV = pChain->getTLV(0x01, 1); if (pTLV && (pTLV->wLen >= 1)) @@ -212,7 +212,7 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, WORD wLen, DWORD dwCookie disposeChain(&pChain); } - setSettingString(hContact, "About", szMsg); + setString(hContact, "About", szMsg); ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1 ,0); SAFE_FREE((void**)&szMsg); diff --git a/protocols/IcqOscarJ/src/fam_03buddy.cpp b/protocols/IcqOscarJ/src/fam_03buddy.cpp index 020c8af1eb..0d5010bb74 100644 --- a/protocols/IcqOscarJ/src/fam_03buddy.cpp +++ b/protocols/IcqOscarJ/src/fam_03buddy.cpp @@ -488,26 +488,26 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) // Save contacts details in database if (hContact != NULL) { - setSettingDword(hContact, "LogonTS", dwOnlineSince); - setSettingDword(hContact, "AwayTS", dwAwaySince); - setSettingDword(hContact, "IdleTS", tIdleTS); + setDword(hContact, "LogonTS", dwOnlineSince); + setDword(hContact, "AwayTS", dwAwaySince); + setDword(hContact, "IdleTS", tIdleTS); if (dwMemberSince) - setSettingDword(hContact, "MemberTS", dwMemberSince); + setDword(hContact, "MemberTS", dwMemberSince); if (nIsICQ) { // on AIM these are not used - setSettingDword(hContact, "DirectCookie", dwDirectConnCookie); - setSettingByte(hContact, "DCType", (BYTE)nTCPFlag); - setSettingWord(hContact, "UserPort", (WORD)(dwPort & 0xffff)); - setSettingWord(hContact, "Version", wVersion); + setDword(hContact, "DirectCookie", dwDirectConnCookie); + setByte(hContact, "DCType", (BYTE)nTCPFlag); + setWord(hContact, "UserPort", (WORD)(dwPort & 0xffff)); + setWord(hContact, "Version", wVersion); } else { - deleteSetting(hContact, "DirectCookie"); - deleteSetting(hContact, "DCType"); - deleteSetting(hContact, "UserPort"); - deleteSetting(hContact, "Version"); + db_unset(hContact, m_szModuleName, "DirectCookie"); + db_unset(hContact, m_szModuleName, "DCType"); + db_unset(hContact, m_szModuleName, "UserPort"); + db_unset(hContact, m_szModuleName, "Version"); } if (!szClient) @@ -517,23 +517,23 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) } if (szClient != (char*)-1) { - setSettingStringUtf(hContact, "MirVer", szClient); - setSettingByte(hContact, "ClientID", bClientId); + db_set_utf(hContact, m_szModuleName, "MirVer", szClient); + setByte(hContact, "ClientID", bClientId); } if (wOldStatus == ID_STATUS_OFFLINE) { - setSettingDword(hContact, "IP", dwIP); - setSettingDword(hContact, "RealIP", dwRealIP); + setDword(hContact, "IP", dwIP); + setDword(hContact, "RealIP", dwRealIP); } else { // if not first notification only write significant information if (dwIP) - setSettingDword(hContact, "IP", dwIP); + setDword(hContact, "IP", dwIP); if (dwRealIP) - setSettingDword(hContact, "RealIP", dwRealIP); + setDword(hContact, "RealIP", dwRealIP); } - setSettingWord(hContact, "Status", (WORD)IcqStatusToMiranda(wStatus)); + setWord(hContact, "Status", (WORD)IcqStatusToMiranda(wStatus)); // Update info? if (dwUIN) @@ -562,12 +562,12 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) if (szClient == cliSpamBot) { - if (getSettingByte(NULL, "KillSpambots", DEFAULT_KILLSPAM_ENABLED) && db_get_b(hContact, "CList", "NotOnList", 0)) + if (getByte("KillSpambots", DEFAULT_KILLSPAM_ENABLED) && db_get_b(hContact, "CList", "NotOnList", 0)) { // kill spammer icq_DequeueUser(dwUIN); icq_sendRemoveContact(dwUIN, NULL); AddToSpammerList(dwUIN); - if (getSettingByte(NULL, "PopupsSpamEnabled", DEFAULT_SPAM_POPUPS_ENABLED)) + if (getByte("PopupsSpamEnabled", DEFAULT_SPAM_POPUPS_ENABLED)) ShowPopupMsg(hContact, LPGEN("Spambot Detected"), LPGEN("Contact deleted & further events blocked."), POPTYPE_SPAM); CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); @@ -649,8 +649,8 @@ void CIcqProto::handleUserOffline(BYTE *buf, WORD wLen) parseStatusNote(dwUIN, szUID, hContact, pChain); // Update status times - setSettingDword(hContact, "IdleTS", 0); - setSettingDword(hContact, "AwayTS", dwAwaySince); + setDword(hContact, "IdleTS", 0); + setDword(hContact, "AwayTS", dwAwaySince); // Clear custom status & mood char tmp = NULL; @@ -660,11 +660,11 @@ void CIcqProto::handleUserOffline(BYTE *buf, WORD wLen) { NetLog_Server("%s went offline.", strUID(dwUIN, szUID)); - setSettingWord(hContact, "Status", ID_STATUS_OFFLINE); + setWord(hContact, "Status", ID_STATUS_OFFLINE); // close Direct Connections to that user CloseContactDirectConns(hContact); // Reset DC status - setSettingByte(hContact, "DCStatus", 0); + setByte(hContact, "DCStatus", 0); } #ifdef _DEBUG else @@ -735,20 +735,20 @@ void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, HANDLE hContact, oscar } } // Check if the status note was changed - if (dwStatusNoteTS > getSettingDword(hContact, DBSETTING_STATUS_NOTE_TIME, 0)) + if (dwStatusNoteTS > getDword(hContact, DBSETTING_STATUS_NOTE_TIME, 0)) { DBVARIANT dbv = {DBVT_DELETED}; - if (strlennull(szStatusNote) || (!getSettingString(hContact, DBSETTING_STATUS_NOTE, &dbv) && (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8) && strlennull(dbv.pszVal))) + if (strlennull(szStatusNote) || (!getString(hContact, DBSETTING_STATUS_NOTE, &dbv) && (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8) && strlennull(dbv.pszVal))) NetLog_Server("%s changed status note to \"%s\"", strUID(dwUin, szUid), szStatusNote ? szStatusNote : ""); db_free(&dbv); if (szStatusNote) - setSettingStringUtf(hContact, DBSETTING_STATUS_NOTE, szStatusNote); + db_set_utf(hContact, m_szModuleName, DBSETTING_STATUS_NOTE, szStatusNote); else - deleteSetting(hContact, DBSETTING_STATUS_NOTE); - setSettingDword(hContact, DBSETTING_STATUS_NOTE_TIME, dwStatusNoteTS); + db_unset(hContact, m_szModuleName, DBSETTING_STATUS_NOTE); + setDword(hContact, DBSETTING_STATUS_NOTE_TIME, dwStatusNoteTS); if (getContactXStatus(hContact) != 0 || !CheckContactCapabilities(hContact, CAPF_STATUS_MESSAGES)) { setStatusMsgVar(hContact, szStatusNote, false); @@ -765,8 +765,8 @@ void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, HANDLE hContact, oscar if (getContactStatus(hContact) == ID_STATUS_OFFLINE) { setStatusMsgVar(hContact, NULL, false); - deleteSetting(hContact, DBSETTING_STATUS_NOTE); - setSettingDword(hContact, DBSETTING_STATUS_NOTE_TIME, dwStatusNoteTS); + db_unset(hContact, m_szModuleName, DBSETTING_STATUS_NOTE); + setDword(hContact, DBSETTING_STATUS_NOTE_TIME, dwStatusNoteTS); } } } diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp index f4b39dd835..f43166a10c 100644 --- a/protocols/IcqOscarJ/src/fam_04message.cpp +++ b/protocols/IcqOscarJ/src/fam_04message.cpp @@ -202,7 +202,7 @@ void CIcqProto::handleRecvServMsg(BYTE *buf, WORD wLen, WORD wFlags, DWORD dwRef char* CIcqProto::convertMsgToUserSpecificUtf(HANDLE hContact, const char *szMsg) { - WORD wCP = getSettingWord(hContact, "CodePage", m_wAnsiCodepage); + WORD wCP = getWord(hContact, "CodePage", m_wAnsiCodepage); char *usMsg = NULL; if (wCP != CP_ACP) @@ -327,7 +327,7 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, WORD wLen, DWORD dwUin, char * { // make the resulting message utf-8 encoded - need to append utf-8 encoded part if (szMsg) { // not necessary to convert - appending first part, only set flags - char *szUtfMsg = ansi_to_utf8_codepage(szMsg, getSettingWord(hContact, "CodePage", m_wAnsiCodepage)); + char *szUtfMsg = ansi_to_utf8_codepage(szMsg, getWord(hContact, "CodePage", m_wAnsiCodepage)); SAFE_FREE(&szMsg); szMsg = szUtfMsg; @@ -336,7 +336,7 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, WORD wLen, DWORD dwUin, char * } if (!bMsgPartUnicode && pre.flags == PREF_UTF) { // convert message part to utf-8 and append - char *szUtfPart = ansi_to_utf8_codepage((char*)szMsgPart, getSettingWord(hContact, "CodePage", m_wAnsiCodepage)); + char *szUtfPart = ansi_to_utf8_codepage((char*)szMsgPart, getWord(hContact, "CodePage", m_wAnsiCodepage)); SAFE_FREE(&szMsgPart); szMsgPart = szUtfPart; @@ -398,7 +398,7 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, WORD wLen, DWORD dwUin, char * NetLog_Server("Message (format 1) received"); // Save tick value - setSettingDword(hContact, "TickTS", time(NULL) - (dwMsgID1/1000)); + setDword(hContact, "TickTS", time(NULL) - (dwMsgID1/1000)); } else NetLog_Server("Message (format %u) - Ignoring empty message", 1); @@ -510,18 +510,18 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, WORD wLen, DWORD dwUin, char * WORD wPort; if (dwExternalIP = chain->getDWord(0x03, 1)) - setSettingDword(hContact, "RealIP", dwExternalIP); + setDword(hContact, "RealIP", dwExternalIP); if (dwIP = chain->getDWord(0x04, 1)) - setSettingDword(hContact, "IP", dwIP); + setDword(hContact, "IP", dwIP); if (wPort = chain->getWord(0x05, 1)) - setSettingWord(hContact, "UserPort", wPort); + setWord(hContact, "UserPort", wPort); // Save tick value - BYTE bClientID = getSettingByte(hContact, "ClientID", 0); + BYTE bClientID = getByte(hContact, "ClientID", 0); if (bClientID == CLID_GENERIC || bClientID == CLID_ICQ6) - setSettingDword(hContact, "TickTS", time(NULL) - (dwMsgID1/1000)); + setDword(hContact, "TickTS", time(NULL) - (dwMsgID1/1000)); else - setSettingDword(hContact, "TickTS", 0); + setDword(hContact, "TickTS", 0); } // Parse the next message level @@ -596,10 +596,10 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, WORD wLen, DWORD dwUin, char * unpackLEDWord(&buf, &dwPort); unpackLEWord(&buf, &wVersion); - setSettingDword(hContact, "IP", dwIp); - setSettingWord(hContact, "UserPort", (WORD)dwPort); - setSettingByte(hContact, "DCType", bMode); - setSettingWord(hContact, "Version", wVersion); + setDword(hContact, "IP", dwIp); + setWord(hContact, "UserPort", (WORD)dwPort); + setByte(hContact, "DCType", bMode); + setWord(hContact, "Version", wVersion); if (wVersion > 6) { cookie_reverse_connect *pCookie = (cookie_reverse_connect*)SAFE_MALLOC(sizeof(cookie_reverse_connect)); @@ -678,7 +678,7 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, D wLen -= 2; if (hContact != INVALID_HANDLE_VALUE) - setSettingWord(hContact, "Version", wVersion); + setWord(hContact, "Version", wVersion); unpackDWord(&pDataBuf, &dwGuid1); // plugin type GUID unpackDWord(&pDataBuf, &dwGuid2); @@ -2524,7 +2524,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d } NetLog_Server("Reverse Connect request failed"); // Set DC status to failed - setSettingByte(hContact, "DCStatus", 2); + setByte(hContact, "DCStatus", 2); ReleaseCookie(dwCookie); } @@ -2607,7 +2607,7 @@ void CIcqProto::handleRecvServMsgError(BYTE *buf, WORD wLen, WORD wFlags, DWORD break; } // TODO: this needs better solution - setSettingWord(hContact, "Status", ID_STATUS_OFFLINE); + setWord(hContact, "Status", ID_STATUS_OFFLINE); } pszErrorMessage = Translate("The user has logged off. Select 'Retry' to send an offline message.\r\nSNAC(4.1) Error x04"); break; diff --git a/protocols/IcqOscarJ/src/fam_09bos.cpp b/protocols/IcqOscarJ/src/fam_09bos.cpp index 327e045a96..daa7589c3e 100644 --- a/protocols/IcqOscarJ/src/fam_09bos.cpp +++ b/protocols/IcqOscarJ/src/fam_09bos.cpp @@ -90,7 +90,7 @@ void CIcqProto::makeContactTemporaryVisible(HANDLE hContact) DWORD dwUin; uid_str szUid; - if (getSettingByte(hContact, "TemporaryVisible", 0)) + if (getByte(hContact, "TemporaryVisible", 0)) return; // already there if (getContactUid(hContact, &dwUin, &szUid)) @@ -98,7 +98,7 @@ void CIcqProto::makeContactTemporaryVisible(HANDLE hContact) icq_sendGenericContact(dwUin, szUid, ICQ_BOS_FAMILY, ICQ_CLI_ADDTEMPVISIBLE); - setSettingByte(hContact, "TemporaryVisible", 1); + setByte(hContact, "TemporaryVisible", 1); #ifdef _DEBUG NetLog_Server("Added contact %s to temporary visible list", strUID(dwUin, szUid)); diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp index d0f61d5e7c..7f94637781 100644 --- a/protocols/IcqOscarJ/src/fam_13servclist.cpp +++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp @@ -419,7 +419,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) NetLog_Server("Contact could not be added without authorization, add with await auth flag."); - setSettingByte(sc->hContact, "Auth", 1); // we need auth + setByte(sc->hContact, "Auth", 1); // we need auth dwCookie = AllocateCookie(CKT_SERVERLIST, ICQ_LISTS_ADDTOLIST, sc->hContact, sc); icq_sendServerContact(sc->hContact, dwCookie, ICQ_LISTS_ADDTOLIST, sc->wGroupId, sc->wContactId, SSOP_ITEM_ACTION | SSOF_CONTACT, 500, NULL); @@ -440,8 +440,8 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) void* groupData; int groupSize; - setSettingWord(sc->hContact, DBSETTING_SERVLIST_ID, sc->wContactId); - setSettingWord(sc->hContact, DBSETTING_SERVLIST_GROUP, sc->wGroupId); + setWord(sc->hContact, DBSETTING_SERVLIST_ID, sc->wContactId); + setWord(sc->hContact, DBSETTING_SERVLIST_GROUP, sc->wGroupId); servlistPendingRemoveContact(sc->hContact, sc->wContactId, sc->wGroupId, PENDING_RESULT_SUCCESS); @@ -517,8 +517,8 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) void* groupData; int groupSize; - setSettingWord(sc->hContact, DBSETTING_SERVLIST_ID, 0); // clear the values - setSettingWord(sc->hContact, DBSETTING_SERVLIST_GROUP, 0); + setWord(sc->hContact, DBSETTING_SERVLIST_ID, 0); // clear the values + setWord(sc->hContact, DBSETTING_SERVLIST_GROUP, 0); FreeServerID(sc->wContactId, SSIT_ITEM); @@ -611,17 +611,17 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) { // second ack - adding failed with error 0x0E, try to add with AVAIT_AUTH flag DWORD dwCookie; - if (!getSettingByte(sc->hContact, "Auth", 0)) + if (!getByte(sc->hContact, "Auth", 0)) { // we tried without AWAIT_AUTH, try again with it NetLog_Server("Contact could not be added without authorization, add with await auth flag."); - setSettingByte(sc->hContact, "Auth", 1); // we need auth + setByte(sc->hContact, "Auth", 1); // we need auth } else { // we tried with AWAIT_AUTH, try again without NetLog_Server("Contact count not be added awaiting authorization, try authorized."); - setSettingByte(sc->hContact, "Auth", 0); + setByte(sc->hContact, "Auth", 0); } dwCookie = AllocateCookie(CKT_SERVERLIST, ICQ_LISTS_ADDTOLIST, sc->hContact, sc); icq_sendServerContact(sc->hContact, dwCookie, ICQ_LISTS_ADDTOLIST, sc->wNewGroupId, sc->wNewContactId, SSOP_ITEM_ACTION | SSOF_CONTACT, 400, NULL); @@ -651,8 +651,8 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) int groupSize; int bEnd = 1; // shall we end the sever modifications - setSettingWord(sc->hContact, DBSETTING_SERVLIST_ID, sc->wNewContactId); - setSettingWord(sc->hContact, DBSETTING_SERVLIST_GROUP, sc->wNewGroupId); + setWord(sc->hContact, DBSETTING_SERVLIST_ID, sc->wNewContactId); + setWord(sc->hContact, DBSETTING_SERVLIST_GROUP, sc->wNewGroupId); servlistPendingRemoveContact(sc->hContact, sc->wNewContactId, sc->wNewGroupId, PENDING_RESULT_SUCCESS); @@ -678,8 +678,8 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) } else // contact was deleted from server-list { - deleteSetting(sc->hContact, DBSETTING_SERVLIST_ID); - deleteSetting(sc->hContact, DBSETTING_SERVLIST_GROUP); + db_unset(sc->hContact, m_szModuleName, DBSETTING_SERVLIST_ID); + db_unset(sc->hContact, m_szModuleName, DBSETTING_SERVLIST_GROUP); FreeServerID(sc->wContactId, SSIT_ITEM); // release old contact id sc->lParam = 1; sc = NULL; // wait for second ack @@ -727,12 +727,12 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) if (sc->wGroupId) // is avatar added or updated? { FreeServerID(sc->wContactId, SSIT_ITEM); - deleteSetting(NULL, DBSETTING_SERVLIST_AVATAR); // to fix old versions + db_unset(NULL, m_szModuleName, DBSETTING_SERVLIST_AVATAR); // to fix old versions } } else { - setSettingWord(NULL, DBSETTING_SERVLIST_AVATAR, sc->wContactId); + setWord(DBSETTING_SERVLIST_AVATAR, sc->wContactId); } break; } @@ -743,7 +743,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) else { FreeServerID(sc->wContactId, SSIT_ITEM); - deleteSetting(NULL, DBSETTING_SERVLIST_AVATAR); + db_unset(NULL, m_szModuleName, DBSETTING_SERVLIST_AVATAR); } break; } @@ -758,8 +758,8 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) NetLog_Server("Re-starting import sequence failed, error %d", wError); else { - setSettingWord(NULL, "SrvImportID", 0); - deleteSetting(NULL, "ImportTS"); + setWord("SrvImportID", 0); + db_unset(NULL, m_szModuleName, "ImportTS"); } break; } @@ -934,11 +934,11 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server } // Save group and item ID - setSettingWord(hContact, DBSETTING_SERVLIST_ID, wItemId); - setSettingWord(hContact, DBSETTING_SERVLIST_GROUP, wGroupId); + setWord(hContact, DBSETTING_SERVLIST_ID, wItemId); + setWord(hContact, DBSETTING_SERVLIST_GROUP, wGroupId); ReserveServerID(wItemId, SSIT_ITEM, 0); - if (!bAdded && getSettingByte(NULL, "LoadServerDetails", DEFAULT_SS_LOAD)) + if (!bAdded && getByte("LoadServerDetails", DEFAULT_SS_LOAD)) { // check if the contact has been moved on the server if (wActiveSrvGroupId != wGroupId || !szActiveSrvGroup) { @@ -1003,7 +1003,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server bNicked = 1; // Write nickname to database - if (getSettingByte(NULL, "LoadServerDetails", DEFAULT_SS_LOAD) || bAdded) + if (getByte("LoadServerDetails", DEFAULT_SS_LOAD) || bAdded) { // if just added contact, save details always - does no harm char *szOldNick; @@ -1016,7 +1016,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server // Yes, we really do need to delete it first. Otherwise the CLUI nick // cache isn't updated (I'll look into it) db_unset(hContact,"CList","MyHandle"); - setSettingStringUtf(hContact, "CList", "MyHandle", pszNick); + db_set_utf(hContact, "CList", "MyHandle", pszNick); } } SAFE_FREE(&szOldNick); @@ -1024,7 +1024,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server else if (strlennull(pszNick) > 0) { db_unset(hContact,"CList","MyHandle"); - setSettingStringUtf(hContact, "CList", "MyHandle", pszNick); + db_set_utf(hContact, "CList", "MyHandle", pszNick); } } SAFE_FREE(&pszNick); @@ -1056,7 +1056,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server NetLog_Server("Comment is '%s'", pszComment); // Write comment to database - if (getSettingByte(NULL, "LoadServerDetails", DEFAULT_SS_LOAD) || bAdded) + if (getByte("LoadServerDetails", DEFAULT_SS_LOAD) || bAdded) { // if just added contact, save details always - does no harm char *szOldComment; @@ -1066,14 +1066,14 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server { // check if the truncated comment changed, i.e. do not overwrite locally stored longer comment if (strlennull(szOldComment) <= strlennull(pszComment) || strncmp((char*)szOldComment, (char*)pszComment, null_strcut(szOldComment, MAX_SSI_TLV_COMMENT_SIZE))) { - setSettingStringUtf(hContact, "UserInfo", "MyNotes", pszComment); + db_set_utf(hContact, "UserInfo", "MyNotes", pszComment); } } SAFE_FREE((void**)&szOldComment); } else if (strlennull(pszComment) > 0) { - setSettingStringUtf(hContact, "UserInfo", "MyNotes", pszComment); + db_set_utf(hContact, "UserInfo", "MyNotes", pszComment); } } SAFE_FREE((void**)&pszComment); @@ -1087,12 +1087,12 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server // Look for need-authorization TLV if (pChain->getTLV(SSI_TLV_AWAITING_AUTH, 1)) { - setSettingByte(hContact, "Auth", 1); + setByte(hContact, "Auth", 1); NetLog_Server("SSI contact need authorization"); } else { - setSettingByte(hContact, "Auth", 0); + setByte(hContact, "Auth", 0); } if (pTLV = pChain->getTLV(SSI_TLV_METAINFO_TOKEN, 1)) @@ -1104,8 +1104,8 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server } else { - deleteSetting(hContact, DBSETTING_METAINFO_TOKEN); - deleteSetting(hContact, DBSETTING_METAINFO_TIME); + db_unset(hContact, m_szModuleName, DBSETTING_METAINFO_TOKEN); + db_unset(hContact, m_szModuleName, DBSETTING_METAINFO_TIME); } { // store server-list item's TLV data @@ -1115,7 +1115,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server if (datalen > 0) setSettingBlob(hContact, DBSETTING_SERVLIST_DATA, data, datalen); else - deleteSetting(hContact, DBSETTING_SERVLIST_DATA); + db_unset(hContact, m_szModuleName, DBSETTING_SERVLIST_DATA); SAFE_FREE((void**)&data); } @@ -1191,10 +1191,10 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server NetLog_Server("SSI %s contact already exists '%s'", "Permit", szRecordName); // Save permit ID - setSettingWord(hContact, DBSETTING_SERVLIST_PERMIT, wItemId); + setWord(hContact, DBSETTING_SERVLIST_PERMIT, wItemId); ReserveServerID(wItemId, SSIT_ITEM, 0); // Set apparent mode - setSettingWord(hContact, "ApparentMode", ID_STATUS_ONLINE); + setWord(hContact, "ApparentMode", ID_STATUS_ONLINE); NetLog_Server("Visible-contact (%s)", szRecordName); } else @@ -1231,11 +1231,11 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server NetLog_Server("SSI %s contact already exists '%s'", "Deny", szRecordName); // Save Deny ID - setSettingWord(hContact, DBSETTING_SERVLIST_DENY, wItemId); + setWord(hContact, DBSETTING_SERVLIST_DENY, wItemId); ReserveServerID(wItemId, SSIT_ITEM, 0); // Set apparent mode - setSettingWord(hContact, "ApparentMode", ID_STATUS_OFFLINE); + setWord(hContact, "ApparentMode", ID_STATUS_OFFLINE); NetLog_Server("Invisible-contact (%s)", szRecordName); } else @@ -1254,7 +1254,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server // Look for visibility TLV if (bVisibility = pChain->getByte(SSI_TLV_VISIBILITY, 1)) { // found it, store the id, we do not need current visibility - we do not rely on it - setSettingWord(NULL, DBSETTING_SERVLIST_PRIVACY, wItemId); + setWord(DBSETTING_SERVLIST_PRIVACY, wItemId); ReserveServerID(wItemId, SSIT_ITEM, 0); NetLog_Server("Visibility is %u", bVisibility); @@ -1289,11 +1289,11 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server NetLog_Server("SSI %s contact already exists '%s'", "Ignore", szRecordName); // Save Ignore ID - setSettingWord(hContact, DBSETTING_SERVLIST_IGNORE, wItemId); + setWord(hContact, DBSETTING_SERVLIST_IGNORE, wItemId); ReserveServerID(wItemId, SSIT_ITEM, 0); // Set apparent mode & ignore - setSettingWord(hContact, "ApparentMode", ID_STATUS_OFFLINE); + setWord(hContact, "ApparentMode", ID_STATUS_OFFLINE); // set ignore all events CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, IGNOREEVENT_ALL); NetLog_Server("Ignore-contact (%s)", szRecordName); @@ -1319,8 +1319,8 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server /* time our list was first imported */ /* pszRecordName is "Import Time" */ /* data is TLV(13) {TLV(D4) {time_t importTime}} */ - setSettingDword(NULL, "ImportTS", pChain->getDWord(SSI_TLV_TIMESTAMP, 1)); - setSettingWord(NULL, "SrvImportID", wItemId); + setDword("ImportTS", pChain->getDWord(SSI_TLV_TIMESTAMP, 1)); + setWord("SrvImportID", wItemId); ReserveServerID(wItemId, SSIT_ITEM, 0); NetLog_Server("SSI %s item recognized", "first import"); } @@ -1336,12 +1336,12 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server /* cause we get the hash again after login */ if (!strcmpnull(szRecordName, "12")) { // need to handle Photo Item separately - setSettingWord(NULL, DBSETTING_SERVLIST_PHOTO, wItemId); + setWord(DBSETTING_SERVLIST_PHOTO, wItemId); NetLog_Server("SSI %s item recognized", "Photo"); } else { - setSettingWord(NULL, DBSETTING_SERVLIST_AVATAR, wItemId); + setWord(DBSETTING_SERVLIST_AVATAR, wItemId); NetLog_Server("SSI %s item recognized", "Avatar"); } ReserveServerID(wItemId, SSIT_ITEM, 0); @@ -1361,7 +1361,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server if (pTime) setSettingDouble(NULL, DBSETTING_METAINFO_TIME, pChain->getDouble(SSI_TLV_METAINFO_TIME, 1)); - setSettingWord(NULL, DBSETTING_SERVLIST_METAINFO, wItemId); + setWord(DBSETTING_SERVLIST_METAINFO, wItemId); ReserveServerID(wItemId, SSIT_ITEM, 0); NetLog_Server("SSI %s item recognized", "Meta info"); @@ -1397,7 +1397,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server NetLog_Server("Bytes left: %u", wLen); - setSettingWord(NULL, "SrvRecordCount", (WORD)(wRecord + getSettingWord(NULL, "SrvRecordCount", 0))); + setWord("SrvRecordCount", (WORD)(wRecord + getWord("SrvRecordCount", 0))); if (bIsLastPacket) { @@ -1414,7 +1414,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server /* finally we get a time_t of the last update time */ unpackDWord(&buf, &dwLastUpdateTime); - setSettingDword(NULL, "SrvLastUpdate", dwLastUpdateTime); + setDword("SrvLastUpdate", dwLastUpdateTime); NetLog_Server("Last update of server list was (%u) %s", dwLastUpdateTime, time2text(dwLastUpdateTime)); sendRosterAck(); @@ -1426,7 +1426,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server { NetLog_Server("Last packet missed update time..."); } - if (getSettingWord(NULL, "SrvRecordCount", 0) == 0) + if (getWord("SrvRecordCount", 0) == 0) { // we got empty serv-list, create master group cookie_servlist_action* ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action)); if (ack) @@ -1455,8 +1455,8 @@ void CIcqProto::handleServerCListItemAdd(const char *szRecordName, WORD wGroupId { if (pItemData) { - setSettingDword(NULL, "ImportTS", pItemData->getDWord(SSI_TLV_TIMESTAMP, 1)); - setSettingWord(NULL, "SrvImportID", wItemId); + setDword("ImportTS", pItemData->getDWord(SSI_TLV_TIMESTAMP, 1)); + setWord("SrvImportID", wItemId); ReserveServerID(wItemId, SSIT_ITEM, 0); NetLog_Server("Server added Import timestamp to list"); @@ -1478,7 +1478,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGrou if (pItemData) { oscar_tlv* pAuth = pItemData->getTLV(SSI_TLV_AWAITING_AUTH, 1); - BYTE bAuth = getSettingByte(hContact, "Auth", 0); + BYTE bAuth = getByte(hContact, "Auth", 0); if (bAuth && !pAuth) { // server authorized our contact @@ -1486,7 +1486,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGrou char msg[MAX_PATH]; char *nick = NickFromHandleUtf(hContact); - setSettingByte(hContact, "Auth", 0); + setByte(hContact, "Auth", 0); null_snprintf(str, MAX_PATH, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" was authorized in the server list."), msg, MAX_PATH), nick); icq_LogMessage(LOG_WARNING, str); SAFE_FREE(&nick); @@ -1497,7 +1497,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGrou char msg[MAX_PATH]; char *nick = NickFromHandleUtf(hContact); - setSettingByte(hContact, "Auth", 1); + setByte(hContact, "Auth", 1); null_snprintf(str, MAX_PATH, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" lost its authorization in the server list."), msg, MAX_PATH), nick); icq_LogMessage(LOG_WARNING, str); SAFE_FREE(&nick); @@ -1546,7 +1546,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGrou if (datalen > 0) setSettingBlob(hContact, DBSETTING_SERVLIST_DATA, data, datalen); else - deleteSetting(hContact, DBSETTING_SERVLIST_DATA); + db_unset(hContact, m_szModuleName, DBSETTING_SERVLIST_DATA); } } } @@ -1590,11 +1590,11 @@ void CIcqProto::handleServerCListItemDelete(const char *szRecordName, WORD wGrou if (hContact != INVALID_HANDLE_VALUE && wItemType == SSI_ITEM_BUDDY) { // a contact was removed from our list - if (getSettingWord(hContact, DBSETTING_SERVLIST_ID, 0) == wItemId) + if (getWord(hContact, DBSETTING_SERVLIST_ID, 0) == wItemId) { - deleteSetting(hContact, DBSETTING_SERVLIST_ID); - deleteSetting(hContact, DBSETTING_SERVLIST_GROUP); - deleteSetting(hContact, "Auth"); + db_unset(hContact, m_szModuleName, DBSETTING_SERVLIST_ID); + db_unset(hContact, m_szModuleName, DBSETTING_SERVLIST_GROUP); + db_unset(hContact, m_szModuleName, "Auth"); { char str[MAX_PATH]; @@ -1658,7 +1658,7 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, WORD wLen) DBVARIANT dbv = { 0 }; if (pre.flags & PREF_UTF) szNick = getSettingStringUtf(hContact, "Nick", NULL); - else if (!getSettingString(hContact, "Nick", &dbv)) + else if (!getString(hContact, "Nick", &dbv)) { szNick = null_strdup(dbv.pszVal); db_free(&dbv); @@ -1670,7 +1670,7 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, WORD wLen) pre.lParam += nNickLen + nReasonLen; - setSettingByte(hContact, "Grant", 1); + setByte(hContact, "Grant", 1); /*blob is: uin(DWORD), hcontact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)*/ char *szBlob = (char *)_alloca(pre.lParam); @@ -1727,7 +1727,7 @@ void CIcqProto::handleRecvAdded(unsigned char *buf, WORD wLen) if (dwUin) { - if (getSettingString(hContact, "Nick", &dbv)) + if (getString(hContact, "Nick", &dbv)) nNickLen = 0; else { @@ -1813,7 +1813,7 @@ void CIcqProto::handleRecvAuthResponse(unsigned char *buf, WORD wLen) break; case 1: - setSettingByte(hContact, "Auth", 0); + setByte(hContact, "Auth", 0); NetLog_Server("Authorization request %s by %s", "granted", strUID(dwUin, szUid)); // TODO: Add to system history as soon as new auth system is ready break; @@ -1847,18 +1847,18 @@ void CIcqProto::updateServVisibilityCode(BYTE bCode) { cookie_servlist_action* ack; DWORD dwCookie; - BYTE bVisibility = getSettingByte(NULL, "SrvVisibility", 0); + BYTE bVisibility = getByte("SrvVisibility", 0); if (bVisibility == bCode) // if no change was made, not necescary to update that return; - setSettingByte(NULL, "SrvVisibility", bCode); + setByte("SrvVisibility", bCode); // Do we have a known server visibility ID? We should, unless we just subscribed to the serv-list for the first time - if ((wVisibilityID = getSettingWord(NULL, DBSETTING_SERVLIST_PRIVACY, 0)) == 0) + if ((wVisibilityID = getWord(DBSETTING_SERVLIST_PRIVACY, 0)) == 0) { // No, create a new random ID wVisibilityID = GenerateServerID(SSIT_ITEM, 0); - setSettingWord(NULL, DBSETTING_SERVLIST_PRIVACY, wVisibilityID); + setWord(DBSETTING_SERVLIST_PRIVACY, wVisibilityID); wCommand = ICQ_LISTS_ADDTOLIST; #ifdef _DEBUG NetLog_Server("Made new srvVisibilityID, id is %u, code is %u", wVisibilityID, bCode); @@ -1933,7 +1933,7 @@ void CIcqProto::updateServAvatarHash(BYTE *pHash, int size) DWORD dwCookie; // Do we have a known server avatar ID? - if (wAvatarID = getSettingWord(NULL, DBSETTING_SERVLIST_AVATAR, 0)) + if (wAvatarID = getWord(DBSETTING_SERVLIST_AVATAR, 0)) { ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action)); if (!ack) @@ -1958,7 +1958,7 @@ void CIcqProto::updateServAvatarHash(BYTE *pHash, int size) WORD hashsize = size - 2; // Do we have a known server avatar ID? We should, unless we just subscribed to the serv-list for the first time - if (bResetHash || (wAvatarID = getSettingWord(NULL, DBSETTING_SERVLIST_AVATAR, 0)) == 0) + if (bResetHash || (wAvatarID = getWord(DBSETTING_SERVLIST_AVATAR, 0)) == 0) { // No, create a new random ID wAvatarID = GenerateServerID(SSIT_ITEM, 0); @@ -2010,11 +2010,11 @@ void CIcqProto::updateServAvatarHash(BYTE *pHash, int size) void CIcqProto::icq_sendServerBeginOperation(int bImport) { icq_packet packet; - WORD wImportID = getSettingWord(NULL, "SrvImportID", 0); + WORD wImportID = getWord("SrvImportID", 0); if (bImport && wImportID) { // we should be importing, check if already have import item - if (getSettingDword(NULL, "ImportTS", 0) + 604800 < getSettingDword(NULL, "LogonTS", 0)) + if (getDword("ImportTS", 0) + 604800 < getDword("LogonTS", 0)) { // is the timestamp week older, clear it and begin new import DWORD dwCookie; cookie_servlist_action* ack; diff --git a/protocols/IcqOscarJ/src/fam_15icqserver.cpp b/protocols/IcqOscarJ/src/fam_15icqserver.cpp index 723a42f68c..890bd8fc41 100644 --- a/protocols/IcqOscarJ/src/fam_15icqserver.cpp +++ b/protocols/IcqOscarJ/src/fam_15icqserver.cpp @@ -620,7 +620,7 @@ int CIcqProto::parseUserInfoRecord(HANDLE hContact, oscar_tlv *pData, UserInfoRe for (int j = 0; j < nRecordDef; j++) { char szItemKey[MAX_PATH]; null_snprintf(szItemKey, MAX_PATH, pRecordDef[j].szDbSetting, i); - deleteSetting(hContact, szItemKey); + db_unset(hContact, m_szModuleName, szItemKey); } return nRecords; @@ -925,20 +925,20 @@ void CIcqProto::parseDirectoryUserDetailsData(HANDLE hContact, oscar_tlv_chain * } else { // Remove old data when phones not available - deleteSetting(hContact, "Phone"); - deleteSetting(hContact, "CompanyPhone"); - deleteSetting(hContact, "Cellular"); - deleteSetting(hContact, "Fax"); - deleteSetting(hContact, "CompanyFax"); + db_unset(hContact, m_szModuleName, "Phone"); + db_unset(hContact, m_szModuleName, "CompanyPhone"); + db_unset(hContact, m_szModuleName, "Cellular"); + db_unset(hContact, m_szModuleName, "Fax"); + db_unset(hContact, m_szModuleName, "CompanyFax"); } } else { // Remove old data when phones not available - deleteSetting(hContact, "Phone"); - deleteSetting(hContact, "CompanyPhone"); - deleteSetting(hContact, "Cellular"); - deleteSetting(hContact, "Fax"); - deleteSetting(hContact, "CompanyFax"); + db_unset(hContact, m_szModuleName, "Phone"); + db_unset(hContact, m_szModuleName, "CompanyPhone"); + db_unset(hContact, m_szModuleName, "Cellular"); + db_unset(hContact, m_szModuleName, "Fax"); + db_unset(hContact, m_szModuleName, "CompanyFax"); } // Emails parseUserInfoRecord(hContact, cDetails->getTLV(0x8C, 1), rEmail, SIZEOF(rEmail), 4); @@ -952,13 +952,13 @@ void CIcqProto::parseDirectoryUserDetailsData(HANDLE hContact, oscar_tlv_chain * switch (cDetails->getNumber(0x82, 1)) { case 1: - setSettingByte(hContact, "Gender", 'F'); + setByte(hContact, "Gender", 'F'); break; case 2: - setSettingByte(hContact, "Gender", 'M'); + setByte(hContact, "Gender", 'M'); break; default: - deleteSetting(hContact, "Gender"); + db_unset(hContact, m_szModuleName, "Gender"); } writeDbInfoSettingTLVStringUtf(hContact, "Homepage", cDetails, 0xFA); @@ -996,7 +996,7 @@ void CIcqProto::parseDirectoryUserDetailsData(HANDLE hContact, oscar_tlv_chain * if (!hContact) { - setSettingByte(hContact, "Auth", !cDetails->getByte(0x19A, 1)); + setByte(hContact, "Auth", !cDetails->getByte(0x19A, 1)); writeDbInfoSettingTLVByte(hContact, "WebAware", cDetails, 0x212); writeDbInfoSettingTLVByte(hContact, "AllowSpam", cDetails, 0x1EA); } @@ -1008,12 +1008,12 @@ void CIcqProto::parseDirectoryUserDetailsData(HANDLE hContact, oscar_tlv_chain * int nAge = calcAgeFromBirthDate(cDetails->getDouble(0x1A4, 1)); if (nAge) - setSettingWord(hContact, "Age", nAge); + setWord(hContact, "Age", nAge); else - deleteSetting(hContact, "Age"); + db_unset(hContact, m_szModuleName, "Age"); } else // we do not need to calculate age for owner - deleteSetting(hContact, "Age"); + db_unset(hContact, m_szModuleName, "Age"); { // Save user info last update time and privacy token double dInfoTime; @@ -1030,7 +1030,7 @@ void CIcqProto::parseDirectoryUserDetailsData(HANDLE hContact, oscar_tlv_chain * else if (bHasMetaToken || !hContact) writeDbInfoSettingTLVDouble(hContact, DBSETTING_METAINFO_SAVED, cDetails, 0x1CC); else - setSettingDword(hContact, DBSETTING_METAINFO_SAVED, time(NULL)); + setDword(hContact, DBSETTING_METAINFO_SAVED, time(NULL)); } if (wReplySubType == META_DIRECTORY_RESPONSE) diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index b323030be3..47f04ed32c 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -101,7 +101,7 @@ TCHAR* CIcqProto::GetOwnAvatarFileName() { DBVARIANT dbvFile = {DBVT_DELETED}; - if (!getSettingStringT(NULL, "AvatarFile", &dbvFile)) + if (!getTString(NULL, "AvatarFile", &dbvFile)) { TCHAR tmp[MAX_PATH * 2]; PathToAbsoluteT(dbvFile.ptszVal, tmp); @@ -422,7 +422,7 @@ void CIcqProto::handleAvatarOwnerHash(WORD wItemID, BYTE bFlags, BYTE *pData, BY } // check if we had set any avatar if yes set our, if not download from server else if (memcmp(hash, pData + 4, 0x10)) { // we have different avatar, sync that - if (m_bSsiEnabled && getSettingByte(NULL, "ForceOurAvatar", 1)) + if (m_bSsiEnabled && getByte("ForceOurAvatar", 1)) { // we want our avatar, update hash DWORD dwPaFormat = DetectAvatarFormat(file); BYTE *pHash = (BYTE*)_alloca(0x14); @@ -592,7 +592,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac { // check settings, should we request avatar immediatelly? DBVARIANT dbv = {DBVT_DELETED}; TCHAR tszAvatar[MAX_PATH * 2 +4]; - BYTE bAutoLoad = getSettingByte(NULL, "AvatarsAutoLoad", DEFAULT_LOAD_AVATARS); + BYTE bAutoLoad = getByte("AvatarsAutoLoad", DEFAULT_LOAD_AVATARS); if ((avatarType == AVATAR_HASH_STATIC || avatarType == AVATAR_HASH_MINI) && cbAvatarHash == 0x09 && !memcmp(pAvatarHash + 4, hashEmptyAvatar + 4, 0x05)) { // empty avatar - unlink image, clear hash @@ -604,7 +604,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac db_free(&dbv); NetLog_Server("%s has removed Avatar.", strUID(dwUIN, szUID)); - deleteSetting(hContact, "AvatarHash"); + db_unset(hContact, m_szModuleName, "AvatarHash"); ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0); } #ifdef _DEBUG @@ -621,7 +621,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac // check saved hash and file, if equal only store hash if (!avatarState) { // hashes are the same - int dwPaFormat = getSettingByte(hContact, "AvatarType", PA_FORMAT_UNKNOWN); + int dwPaFormat = getByte(hContact, "AvatarType", PA_FORMAT_UNKNOWN); GetFullAvatarFileName(dwUIN, szUID, dwPaFormat, tszAvatar, MAX_PATH * 2); if (_taccess(tszAvatar, 0) == 0) @@ -671,7 +671,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac // we should have file, check if the file really exists if (!avatarState) { - int dwPaFormat = getSettingByte(hContact, "AvatarType", PA_FORMAT_UNKNOWN); + int dwPaFormat = getByte(hContact, "AvatarType", PA_FORMAT_UNKNOWN); if (dwPaFormat == PA_FORMAT_UNKNOWN) { // we do not know the format, get avatar again #ifdef _DEBUG @@ -755,7 +755,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac db_free(&dbv); NetLog_Server("%s has removed Avatar.", strUID(dwUIN, szUID)); - deleteSetting(hContact, "AvatarHash"); + db_unset(hContact, m_szModuleName, "AvatarHash"); ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0); } #ifdef _DEBUG @@ -1243,7 +1243,7 @@ void avatars_server_connection::connectionThread() // This is the "infinite" loop that receives the packets from the ICQ avatar server NETLIBPACKETRECVER packetRecv = {0}; DWORD wLastKeepAlive = 0; // we send keep-alive at most one per 30secs - DWORD dwKeepAliveInterval = ppro->getSettingDword(NULL, "KeepAliveInterval", KEEPALIVE_INTERVAL); + DWORD dwKeepAliveInterval = ppro->getDword("KeepAliveInterval", KEEPALIVE_INTERVAL); hPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)hConnection, 65536); packetRecv.cbSize = sizeof(packetRecv); @@ -1273,7 +1273,7 @@ void avatars_server_connection::connectionThread() #endif if (GetTickCount() > wLastKeepAlive) { // limit frequency (HACK: on some systems select() does not work well) - if (!ppro->m_bGatewayMode && ppro->getSettingByte(NULL, "KeepAlive", DEFAULT_KEEPALIVE_ENABLED)) + if (!ppro->m_bGatewayMode && ppro->getByte("KeepAlive", DEFAULT_KEEPALIVE_ENABLED)) { // send keep-alive packet icq_packet packet; @@ -1637,7 +1637,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, WORD wBufferLengt { // store to file... int aValid = 1; - if (pCookieData->hashlen == 0x14 && pCookieData->hash[3] == 0x10 && ppro->getSettingByte(NULL, "StrictAvatarCheck", DEFAULT_AVATARS_CHECK)) + if (pCookieData->hashlen == 0x14 && pCookieData->hash[3] == 0x10 && ppro->getByte("StrictAvatarCheck", DEFAULT_AVATARS_CHECK)) { // check only standard hashes mir_md5_state_t state; mir_md5_byte_t digest[16]; @@ -1659,7 +1659,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, WORD wBufferLengt _tcscpy(tszImageFile, pCookieData->szFile); AddAvatarExt(dwPaFormat, tszImageFile); - ppro->setSettingByte(pCookieData->hContact, "AvatarType", (BYTE)dwPaFormat); + ppro->setByte(pCookieData->hContact, "AvatarType", (BYTE)dwPaFormat); ai.format = dwPaFormat; // set the format lstrcpyn(ai.filename, tszImageFile, SIZEOF(ai.filename)); diff --git a/protocols/IcqOscarJ/src/icq_db.cpp b/protocols/IcqOscarJ/src/icq_db.cpp index 65899ae703..8aa8a97687 100644 --- a/protocols/IcqOscarJ/src/icq_db.cpp +++ b/protocols/IcqOscarJ/src/icq_db.cpp @@ -34,33 +34,6 @@ int CIcqProto::getSetting(HANDLE hContact, const char *szSetting, DBVARIANT *dbv return db_get_s(hContact, m_szModuleName, szSetting, dbv, 0); } -BYTE CIcqProto::getSettingByte(HANDLE hContact, const char *szSetting, BYTE byDef) -{ - return db_get_b(hContact, m_szModuleName, szSetting, byDef); -} - -WORD CIcqProto::getSettingWord(HANDLE hContact, const char *szSetting, WORD wDef) -{ - return db_get_w(hContact, m_szModuleName, szSetting, wDef); -} - -DWORD CIcqProto::getSettingDword(HANDLE hContact, const char *szSetting, DWORD dwDef) -{ - DBVARIANT dbv = {DBVT_DELETED}; - DWORD dwRes; - - if (getSetting(hContact, szSetting, &dbv)) - return dwDef; // not found, give default - - if (dbv.type != DBVT_DWORD) - dwRes = dwDef; // invalid type, give default - else // found and valid, give result - dwRes = dbv.dVal; - - db_free(&dbv); - return dwRes; -} - double CIcqProto::getSettingDouble(HANDLE hContact, const char *szSetting, double dDef) { DBVARIANT dbv = {DBVT_DELETED}; @@ -80,7 +53,7 @@ double CIcqProto::getSettingDouble(HANDLE hContact, const char *szSetting, doubl DWORD CIcqProto::getContactUin(HANDLE hContact) { - return getSettingDword(hContact, UNIQUEIDSETTING, 0); + return getDword(hContact, UNIQUEIDSETTING, 0); } int CIcqProto::getContactUid(HANDLE hContact, DWORD *pdwUin, uid_str *ppszUid) @@ -109,24 +82,6 @@ int CIcqProto::getContactUid(HANDLE hContact, DWORD *pdwUin, uid_str *ppszUid) return iRes; } -int CIcqProto::getSettingString(HANDLE hContact, const char *szSetting, DBVARIANT *dbv) -{ - int res = db_get_s(hContact, m_szModuleName, szSetting, dbv); - if (res) - db_free(dbv); - - return res; -} - -int CIcqProto::getSettingStringW(HANDLE hContact, const char *szSetting, DBVARIANT *dbv) -{ - int res = db_get_ws(hContact, m_szModuleName, szSetting, dbv); - if (res) - db_free(dbv); - - return res; -} - char* CIcqProto::getSettingStringUtf(HANDLE hContact, const char *szModule, const char *szSetting, char *szDef) { DBVARIANT dbv = {DBVT_DELETED}; @@ -147,7 +102,7 @@ char* CIcqProto::getSettingStringUtf(HANDLE hContact, const char *szSetting, cha WORD CIcqProto::getContactStatus(HANDLE hContact) { - return getSettingWord(hContact, "Status", ID_STATUS_OFFLINE); + return getWord(hContact, "Status", ID_STATUS_OFFLINE); } int CIcqProto::getSettingStringStatic(HANDLE hContact, const char *szSetting, char *dest, int dest_len) @@ -175,51 +130,11 @@ int CIcqProto::getSettingStringStatic(HANDLE hContact, const char *szSetting, ch return (dbv.type != DBVT_ASCIIZ); } -int CIcqProto::deleteSetting(HANDLE hContact, const char *szSetting) -{ - return db_unset(hContact, m_szModuleName, szSetting); -} - -int CIcqProto::setSettingByte(HANDLE hContact, const char *szSetting, BYTE byValue) -{ - return db_set_b(hContact, m_szModuleName, szSetting, byValue); -} - -int CIcqProto::setSettingWord(HANDLE hContact, const char *szSetting, WORD wValue) -{ - return db_set_w(hContact, m_szModuleName, szSetting, wValue); -} - -int CIcqProto::setSettingDword(HANDLE hContact, const char *szSetting, DWORD dwValue) -{ - return db_set_dw(hContact, m_szModuleName, szSetting, dwValue); -} - int CIcqProto::setSettingDouble(HANDLE hContact, const char *szSetting, double dValue) { return setSettingBlob(hContact, szSetting, (BYTE*)&dValue, sizeof(double)); } -int CIcqProto::setSettingString(HANDLE hContact, const char *szSetting, const char *szValue) -{ - return db_set_s(hContact, m_szModuleName, szSetting, szValue); -} - -int CIcqProto::setSettingStringW(HANDLE hContact, const char *szSetting, const WCHAR *wszValue) -{ - return db_set_ws(hContact, m_szModuleName, szSetting, wszValue); -} - -int CIcqProto::setSettingStringUtf(HANDLE hContact, const char *szModule, const char *szSetting, const char *szValue) -{ - return db_set_utf(hContact, szModule, szSetting, szValue); -} - -int CIcqProto::setSettingStringUtf(HANDLE hContact, const char *szSetting, const char *szValue) -{ - return db_set_utf(hContact, m_szModuleName, szSetting, szValue); -} - int CIcqProto::setSettingBlob(HANDLE hContact, const char *szSetting, const BYTE *pValue, const int cbValue) { return db_set_blob(hContact, m_szModuleName, szSetting, (void*)pValue, cbValue); @@ -266,7 +181,7 @@ void CIcqProto::setStatusMsgVar(HANDLE hContact, char* szStatusMsg, bool isAnsi) } if (!oldStatusMsg || strcmp(oldStatusMsg, szStatusMsg)) - setSettingStringUtf(hContact, "CList", "StatusMsg", szStatusMsg); + db_set_utf(hContact, "CList", "StatusMsg", szStatusMsg); SAFE_FREE(&oldStatusMsg); if (isAnsi) SAFE_FREE(&szStatusMsg); } diff --git a/protocols/IcqOscarJ/src/icq_db.h b/protocols/IcqOscarJ/src/icq_db.h index 180dcfc5fd..1a0266de74 100644 --- a/protocols/IcqOscarJ/src/icq_db.h +++ b/protocols/IcqOscarJ/src/icq_db.h @@ -32,11 +32,11 @@ #ifdef _UNICODE - #define getSettingStringT getSettingStringW - #define setSettingStringT setSettingStringW + #define getTString getSettingStringW + #define setSettingStringT setTString #else - #define getSettingStringT getSettingString - #define setSettingStringT setSettingString + #define getTString getString + #define setSettingStringT setString #endif #endif /* __ICQ_DB_H */ diff --git a/protocols/IcqOscarJ/src/icq_direct.cpp b/protocols/IcqOscarJ/src/icq_direct.cpp index cfe357bc58..4893bbc813 100644 --- a/protocols/IcqOscarJ/src/icq_direct.cpp +++ b/protocols/IcqOscarJ/src/icq_direct.cpp @@ -161,10 +161,10 @@ BOOL CIcqProto::IsDirectConnectionOpen(HANDLE hContact, int type, int bPassive) { // do not try to open DC to offline contact if (getContactStatus(hContact) == ID_STATUS_OFFLINE) return FALSE; // do not try to open DC if previous attempt was not successfull - if (getSettingByte(hContact, "DCStatus", 0)) return FALSE; + if (getByte(hContact, "DCStatus", 0)) return FALSE; // Set DC status as tried - setSettingByte(hContact, "DCStatus", 1); + setByte(hContact, "DCStatus", 1); // Create a new connection OpenDirectConnection(hContact, DIRECTCONN_STANDARD, NULL); } @@ -233,12 +233,12 @@ void __cdecl CIcqProto::icq_directThread( directthreadstartinfo *dtsi ) if (!dc.incoming) { dc.type = dtsi->type; - dc.dwRemoteExternalIP = getSettingDword(dtsi->hContact, "IP", 0); - dc.dwRemoteInternalIP = getSettingDword(dtsi->hContact, "RealIP", 0); - dc.dwRemotePort = getSettingWord(dtsi->hContact, "UserPort", 0); + dc.dwRemoteExternalIP = getDword(dtsi->hContact, "IP", 0); + dc.dwRemoteInternalIP = getDword(dtsi->hContact, "RealIP", 0); + dc.dwRemotePort = getWord(dtsi->hContact, "UserPort", 0); dc.dwRemoteUin = getContactUin(dtsi->hContact); - dc.dwConnectionCookie = getSettingDword(dtsi->hContact, "DirectCookie", 0); - dc.wVersion = getSettingWord(dtsi->hContact, "Version", 0); + dc.dwConnectionCookie = getDword(dtsi->hContact, "DirectCookie", 0); + dc.wVersion = getWord(dtsi->hContact, "Version", 0); if (!dc.dwRemoteExternalIP && !dc.dwRemoteInternalIP) { // we do not have any ip, do not try to connect @@ -278,8 +278,8 @@ void __cdecl CIcqProto::icq_directThread( directthreadstartinfo *dtsi ) SAFE_FREE((void**)&dtsi); // Load local IP information - dc.dwLocalExternalIP = getSettingDword(NULL, "IP", 0); - dc.dwLocalInternalIP = getSettingDword(NULL, "RealIP", 0); + dc.dwLocalExternalIP = getDword("IP", 0); + dc.dwLocalInternalIP = getDword("RealIP", 0); // Create outgoing DC if (!dc.incoming) @@ -338,7 +338,7 @@ void __cdecl CIcqProto::icq_directThread( directthreadstartinfo *dtsi ) } } else // Set DC status to failed - setSettingByte(dc.hContact, "DCStatus", 2); + setByte(dc.hContact, "DCStatus", 2); if (dc.type == DIRECTCONN_REVERSE) // failed reverse connection { // announce we failed @@ -648,7 +648,7 @@ void CIcqProto::handleDirectPacket(directconnect* dc, PBYTE buf, WORD wLen) if (dc->incoming) { // this is the first PEER_INIT with our cookie - if (dwCookie != getSettingDword(hContact, "DirectCookie", 0)) + if (dwCookie != getDword(hContact, "DirectCookie", 0)) { NetLog_Direct("Error: Received PEER_INIT with broken cookie"); CloseDirectConnection(dc); @@ -693,8 +693,8 @@ void CIcqProto::handleDirectPacket(directconnect* dc, PBYTE buf, WORD wLen) { // store good IP info dc->hContact = hContact; dc->dwConnectionCookie = dwCookie; - setSettingDword(dc->hContact, "IP", dc->dwRemoteExternalIP); - setSettingDword(dc->hContact, "RealIP", dc->dwRemoteInternalIP); + setDword(dc->hContact, "IP", dc->dwRemoteExternalIP); + setDword(dc->hContact, "RealIP", dc->dwRemoteInternalIP); sendPeerInit_v78(dc); // reply with our PEER_INIT } else // outgoing @@ -717,7 +717,7 @@ void CIcqProto::handleDirectPacket(directconnect* dc, PBYTE buf, WORD wLen) } } // Set DC Status to successful - setSettingByte(dc->hContact, "DCStatus", 0); + setByte(dc->hContact, "DCStatus", 0); } else { @@ -1149,7 +1149,7 @@ void CIcqProto::sendPeerFileInit(directconnect* dc) int nNickLen; dbv.type = DBVT_DELETED; - if (getSettingString(NULL, "Nick", &dbv)) + if (getString("Nick", &dbv)) szNick = ""; else szNick = dbv.pszVal; diff --git a/protocols/IcqOscarJ/src/icq_filetransfer.cpp b/protocols/IcqOscarJ/src/icq_filetransfer.cpp index 54f58a0181..39dd4de11b 100644 --- a/protocols/IcqOscarJ/src/icq_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/icq_filetransfer.cpp @@ -70,7 +70,7 @@ static void file_sendNick(CIcqProto* ppro, directconnect* dc) WORD wNickLen; DBVARIANT dbv = {DBVT_DELETED}; - if (ppro->getSettingString(NULL, "Nick", &dbv)) + if (ppro->getString("Nick", &dbv)) szNick = ""; else szNick = dbv.pszVal; diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp index 9903719a22..f92eaf24a0 100644 --- a/protocols/IcqOscarJ/src/icq_firstrun.cpp +++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp @@ -98,11 +98,11 @@ INT_PTR CALLBACK icq_FirstRunDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR { char str[128]; GetDlgItemTextA(hwndDlg, IDC_UIN, str, sizeof(str)); - ppro->setSettingDword(NULL, UNIQUEIDSETTING, atoi(str)); + ppro->setDword(UNIQUEIDSETTING, atoi(str)); GetDlgItemTextA(hwndDlg, IDC_PW, str, sizeof(ppro->m_szPassword)); strcpy(ppro->m_szPassword, str); CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(ppro->m_szPassword), (LPARAM) str); - ppro->setSettingString(NULL, "Password", str); + ppro->setString("Password", str); } break; diff --git a/protocols/IcqOscarJ/src/icq_menu.cpp b/protocols/IcqOscarJ/src/icq_menu.cpp index 13d7209f4e..93e85a6965 100644 --- a/protocols/IcqOscarJ/src/icq_menu.cpp +++ b/protocols/IcqOscarJ/src/icq_menu.cpp @@ -197,13 +197,13 @@ int CIcqProto::OnPreBuildContactMenu(WPARAM wParam, LPARAM) DWORD dwUin = getContactUin(hContact); Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_REQUEST], - dwUin && (bCtrlPressed || (getSettingByte((HANDLE)wParam, "Auth", 0) && getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_ID, 0)))); - Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_GRANT], dwUin && (bCtrlPressed || getSettingByte((HANDLE)wParam, "Grant", 0))); + dwUin && (bCtrlPressed || (getByte((HANDLE)wParam, "Auth", 0) && getWord((HANDLE)wParam, DBSETTING_SERVLIST_ID, 0)))); + Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_GRANT], dwUin && (bCtrlPressed || getByte((HANDLE)wParam, "Grant", 0))); Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_REVOKE], - dwUin && (bCtrlPressed || (getSettingByte(NULL, "PrivacyItems", 0) && !getSettingByte((HANDLE)wParam, "Grant", 0)))); + dwUin && (bCtrlPressed || (getByte("PrivacyItems", 0) && !getByte((HANDLE)wParam, "Grant", 0)))); Menu_ShowItem(g_hContactMenuItems[ICMI_ADD_TO_SERVLIST], - m_bSsiEnabled && !getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_ID, 0) && - !getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_IGNORE, 0) && + m_bSsiEnabled && !getWord((HANDLE)wParam, DBSETTING_SERVLIST_ID, 0) && + !getWord((HANDLE)wParam, DBSETTING_SERVLIST_IGNORE, 0) && !db_get_b(hContact, "CList", "NotOnList", 0)); } diff --git a/protocols/IcqOscarJ/src/icq_opts.cpp b/protocols/IcqOscarJ/src/icq_opts.cpp index 166f81ce79..ff7a3b92ef 100644 --- a/protocols/IcqOscarJ/src/icq_opts.cpp +++ b/protocols/IcqOscarJ/src/icq_opts.cpp @@ -45,12 +45,12 @@ static BOOL (WINAPI *pfnEnableThemeDialogTexture)(HANDLE, DWORD) = 0; static void LoadDBCheckState(CIcqProto* ppro, HWND hwndDlg, int idCtrl, const char* szSetting, BYTE bDef) { - CheckDlgButton(hwndDlg, idCtrl, ppro->getSettingByte(NULL, szSetting, bDef)); + CheckDlgButton(hwndDlg, idCtrl, ppro->getByte(szSetting, bDef)); } static void StoreDBCheckState(CIcqProto* ppro, HWND hwndDlg, int idCtrl, const char* szSetting) { - ppro->setSettingByte(NULL, szSetting, (BYTE)IsDlgButtonChecked(hwndDlg, idCtrl)); + ppro->setByte(szSetting, (BYTE)IsDlgButtonChecked(hwndDlg, idCtrl)); } static void OptDlgChanged(HWND hwndDlg) @@ -97,10 +97,10 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else SetDlgItemTextA(hwndDlg, IDC_ICQSERVER, IsDlgButtonChecked(hwndDlg, IDC_SSL) ? DEFAULT_SERVER_HOST_SSL : DEFAULT_SERVER_HOST); - SetDlgItemInt(hwndDlg, IDC_ICQPORT, ppro->getSettingWord(NULL, "OscarPort", IsDlgButtonChecked(hwndDlg, IDC_SSL) ? DEFAULT_SERVER_PORT_SSL : DEFAULT_SERVER_PORT), FALSE); + SetDlgItemInt(hwndDlg, IDC_ICQPORT, ppro->getWord("OscarPort", IsDlgButtonChecked(hwndDlg, IDC_SSL) ? DEFAULT_SERVER_PORT_SSL : DEFAULT_SERVER_PORT), FALSE); LoadDBCheckState(ppro, hwndDlg, IDC_KEEPALIVE, "KeepAlive", DEFAULT_KEEPALIVE_ENABLED); SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_SETRANGE, FALSE, MAKELONG(0, 4)); - SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_SETPOS, TRUE, 4-ppro->getSettingByte(NULL, "ShowLogLevel", LOG_WARNING)); + SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_SETPOS, TRUE, 4-ppro->getByte("ShowLogLevel", LOG_WARNING)); { char buf[MAX_PATH]; SetDlgItemTextUtf(hwndDlg, IDC_LEVELDESCR, ICQTranslateUtfStatic(szLogLevelDescr[4-SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_GETPOS, 0, 0)], buf, MAX_PATH)); @@ -168,7 +168,7 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { char str[128]; - ppro->setSettingDword(NULL, UNIQUEIDSETTING, GetDlgItemInt(hwndDlg, IDC_ICQNUM, NULL, FALSE)); + ppro->setDword(UNIQUEIDSETTING, GetDlgItemInt(hwndDlg, IDC_ICQNUM, NULL, FALSE)); GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(ppro->m_szPassword)); if (strlennull(str)) { @@ -176,19 +176,19 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP ppro->m_bRememberPwd = TRUE; } else - ppro->m_bRememberPwd = ppro->getSettingByte(NULL, "RememberPass", 0); + ppro->m_bRememberPwd = ppro->getByte("RememberPass", 0); CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(ppro->m_szPassword), (LPARAM)str); - ppro->setSettingString(NULL, "Password", str); + ppro->setString("Password", str); GetDlgItemTextA(hwndDlg,IDC_ICQSERVER, str, sizeof(str)); - ppro->setSettingString(NULL, "OscarServer", str); - ppro->setSettingWord(NULL, "OscarPort", (WORD)GetDlgItemInt(hwndDlg, IDC_ICQPORT, NULL, FALSE)); + ppro->setString("OscarServer", str); + ppro->setWord("OscarPort", (WORD)GetDlgItemInt(hwndDlg, IDC_ICQPORT, NULL, FALSE)); StoreDBCheckState(ppro, hwndDlg, IDC_KEEPALIVE, "KeepAlive"); StoreDBCheckState(ppro, hwndDlg, IDC_SSL, "SecureConnection"); StoreDBCheckState(ppro, hwndDlg, IDC_MD5LOGIN, "SecureLogin"); StoreDBCheckState(ppro, hwndDlg, IDC_LEGACY, "LegacyFix"); StoreDBCheckState(ppro, hwndDlg, IDC_NOERRMULTI, "IgnoreMultiErrorBox"); - ppro->setSettingByte(NULL, "ShowLogLevel", (BYTE)(4-SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_GETPOS, 0, 0))); + ppro->setByte("ShowLogLevel", (BYTE)(4-SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_GETPOS, 0, 0))); return TRUE; } @@ -218,8 +218,8 @@ static INT_PTR CALLBACK DlgProcIcqPrivacyOpts(HWND hwndDlg, UINT msg, WPARAM wPa ppro = (CIcqProto*)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); { - int nDcType = ppro->getSettingByte(NULL, "DCType", 0); - int nAddAuth = ppro->getSettingByte(NULL, "Auth", 1); + int nDcType = ppro->getByte("DCType", 0); + int nAddAuth = ppro->getByte("Auth", 1); if (!ppro->icqOnline()) { @@ -238,7 +238,7 @@ static INT_PTR CALLBACK DlgProcIcqPrivacyOpts(HWND hwndDlg, UINT msg, WPARAM wPa LoadDBCheckState(ppro, hwndDlg, IDC_PUBLISHPRIMARY, "PublishPrimaryEmail", 0); LoadDBCheckState(ppro, hwndDlg, IDC_STATUSMSG_CLIST, "StatusMsgReplyCList", 0); LoadDBCheckState(ppro, hwndDlg, IDC_STATUSMSG_VISIBLE, "StatusMsgReplyVisible", 0); - if (!ppro->getSettingByte(NULL, "StatusMsgReplyCList", 0)) + if (!ppro->getByte("StatusMsgReplyCList", 0)) EnableDlgItem(hwndDlg, IDC_STATUSMSG_VISIBLE, FALSE); } return TRUE; @@ -281,11 +281,11 @@ static INT_PTR CALLBACK DlgProcIcqPrivacyOpts(HWND hwndDlg, UINT msg, WPARAM wPa StoreDBCheckState(ppro, hwndDlg, IDC_STATUSMSG_CLIST, "StatusMsgReplyCList"); StoreDBCheckState(ppro, hwndDlg, IDC_STATUSMSG_VISIBLE, "StatusMsgReplyVisible"); if (IsDlgButtonChecked(hwndDlg, IDC_DCALLOW_AUTH)) - ppro->setSettingByte(NULL, "DCType", 2); + ppro->setByte("DCType", 2); else if (IsDlgButtonChecked(hwndDlg, IDC_DCALLOW_CLIST)) - ppro->setSettingByte(NULL, "DCType", 1); + ppro->setByte("DCType", 1); else - ppro->setSettingByte(NULL, "DCType", 0); + ppro->setByte("DCType", 0); StoreDBCheckState(ppro, hwndDlg, IDC_ADD_AUTH, "Auth"); if (ppro->icqOnline()) @@ -293,9 +293,9 @@ static INT_PTR CALLBACK DlgProcIcqPrivacyOpts(HWND hwndDlg, UINT msg, WPARAM wPa PBYTE buf=NULL; int buflen=0; - ppackTLVWord(&buf, &buflen, 0x19A, !ppro->getSettingByte(NULL, "Auth", 1)); - ppackTLVByte(&buf, &buflen, 0x212, ppro->getSettingByte(NULL, "WebAware", 0)); - ppackTLVWord(&buf, &buflen, 0x1F9, ppro->getSettingByte(NULL, "PrivacyLevel", 1)); + ppackTLVWord(&buf, &buflen, 0x19A, !ppro->getByte("Auth", 1)); + ppackTLVByte(&buf, &buflen, 0x212, ppro->getByte("WebAware", 0)); + ppackTLVWord(&buf, &buflen, 0x1F9, ppro->getByte("PrivacyLevel", 1)); ppro->icq_changeUserDirectoryInfoServ(buf, (WORD)buflen, DIRECTORYREQUEST_UPDATEPRIVACY); @@ -387,20 +387,20 @@ static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wP ppro = (CIcqProto*)lParam; SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); { - BYTE byData = ppro->getSettingByte(NULL, "UtfEnabled", DEFAULT_UTF_ENABLED); + BYTE byData = ppro->getByte("UtfEnabled", DEFAULT_UTF_ENABLED); CheckDlgButton(hwndDlg, IDC_UTFENABLE, byData?TRUE:FALSE); CheckDlgButton(hwndDlg, IDC_UTFALL, byData==2?TRUE:FALSE); icq_EnableMultipleControls(hwndDlg, icqUnicodeControls, SIZEOF(icqUnicodeControls), byData?TRUE:FALSE); LoadDBCheckState(ppro, hwndDlg, IDC_TEMPVISIBLE, "TempVisListEnabled",DEFAULT_TEMPVIS_ENABLED); LoadDBCheckState(ppro, hwndDlg, IDC_SLOWSEND, "SlowSend", DEFAULT_SLOWSEND); LoadDBCheckState(ppro, hwndDlg, IDC_ONLYSERVERACKS, "OnlyServerAcks", DEFAULT_ONLYSERVERACKS); - byData = ppro->getSettingByte(NULL, "DirectMessaging", DEFAULT_DCMSG_ENABLED); + byData = ppro->getByte("DirectMessaging", DEFAULT_DCMSG_ENABLED); CheckDlgButton(hwndDlg, IDC_DCENABLE, byData?TRUE:FALSE); CheckDlgButton(hwndDlg, IDC_DCPASSIVE, byData==1?TRUE:FALSE); icq_EnableMultipleControls(hwndDlg, icqDCMsgControls, SIZEOF(icqDCMsgControls), byData?TRUE:FALSE); - BYTE byXStatusEnabled = ppro->getSettingByte(NULL, "XStatusEnabled", DEFAULT_XSTATUS_ENABLED); + BYTE byXStatusEnabled = ppro->getByte("XStatusEnabled", DEFAULT_XSTATUS_ENABLED); CheckDlgButton(hwndDlg, IDC_XSTATUSENABLE, byXStatusEnabled); - BYTE byMoodsEnabled = ppro->getSettingByte(NULL, "MoodsEnabled", DEFAULT_MOODS_ENABLED); + BYTE byMoodsEnabled = ppro->getByte("MoodsEnabled", DEFAULT_MOODS_ENABLED); CheckDlgButton(hwndDlg, IDC_MOODSENABLE, byMoodsEnabled); icq_EnableMultipleControls(hwndDlg, icqXStatusControls, SIZEOF(icqXStatusControls), byXStatusEnabled); icq_EnableMultipleControls(hwndDlg, icqCustomStatusControls, SIZEOF(icqCustomStatusControls), byXStatusEnabled || byMoodsEnabled); @@ -411,7 +411,7 @@ static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wP icq_EnableMultipleControls(hwndDlg, icqAimControls, SIZEOF(icqAimControls), ppro->icqOnline()?FALSE:TRUE); hCpCombo = GetDlgItem(hwndDlg, IDC_UTFCODEPAGE); - int sCodePage = ppro->getSettingWord(NULL, "AnsiCodePage", CP_ACP); + int sCodePage = ppro->getWord("AnsiCodePage", CP_ACP); ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_UTFCODEPAGE), LPGEN("System default codepage"), 0); EnumSystemCodePagesA(FillCpCombo, CP_INSTALLED); if(sCodePage == 0) @@ -464,22 +464,22 @@ static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wP { int i = SendDlgItemMessage(hwndDlg, IDC_UTFCODEPAGE, CB_GETCURSEL, 0, 0); ppro->m_wAnsiCodepage = (WORD)SendDlgItemMessage(hwndDlg, IDC_UTFCODEPAGE, CB_GETITEMDATA, (WPARAM)i, 0); - ppro->setSettingWord(NULL, "AnsiCodePage", ppro->m_wAnsiCodepage); + ppro->setWord("AnsiCodePage", ppro->m_wAnsiCodepage); } - ppro->setSettingByte(NULL, "UtfEnabled", ppro->m_bUtfEnabled); + ppro->setByte("UtfEnabled", ppro->m_bUtfEnabled); ppro->m_bTempVisListEnabled = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TEMPVISIBLE); - ppro->setSettingByte(NULL, "TempVisListEnabled", ppro->m_bTempVisListEnabled); + ppro->setByte("TempVisListEnabled", ppro->m_bTempVisListEnabled); StoreDBCheckState(ppro, hwndDlg, IDC_SLOWSEND, "SlowSend"); StoreDBCheckState(ppro, hwndDlg, IDC_ONLYSERVERACKS, "OnlyServerAcks"); if (IsDlgButtonChecked(hwndDlg, IDC_DCENABLE)) ppro->m_bDCMsgEnabled = IsDlgButtonChecked(hwndDlg, IDC_DCPASSIVE)?1:2; else ppro->m_bDCMsgEnabled = 0; - ppro->setSettingByte(NULL, "DirectMessaging", ppro->m_bDCMsgEnabled); + ppro->setByte("DirectMessaging", ppro->m_bDCMsgEnabled); ppro->m_bXStatusEnabled = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_XSTATUSENABLE); - ppro->setSettingByte(NULL, "XStatusEnabled", ppro->m_bXStatusEnabled); + ppro->setByte("XStatusEnabled", ppro->m_bXStatusEnabled); ppro->m_bMoodsEnabled = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MOODSENABLE); - ppro->setSettingByte(NULL, "MoodsEnabled", ppro->m_bMoodsEnabled); + ppro->setByte("MoodsEnabled", ppro->m_bMoodsEnabled); StoreDBCheckState(ppro, hwndDlg, IDC_XSTATUSAUTO, "XStatusAuto"); StoreDBCheckState(ppro, hwndDlg, IDC_XSTATUSRESET, "XStatusReset"); StoreDBCheckState(ppro, hwndDlg, IDC_KILLSPAMBOTS , "KillSpambots"); @@ -514,9 +514,9 @@ static INT_PTR CALLBACK DlgProcIcqContactsOpts(HWND hwndDlg, UINT msg, WPARAM wP LoadDBCheckState(ppro, hwndDlg, IDC_STRICTAVATARCHECK, "StrictAvatarCheck", DEFAULT_AVATARS_CHECK); icq_EnableMultipleControls(hwndDlg, icqContactsControls, SIZEOF(icqContactsControls), - ppro->getSettingByte(NULL, "UseServerCList", DEFAULT_SS_ENABLED)?TRUE:FALSE); + ppro->getByte("UseServerCList", DEFAULT_SS_ENABLED)?TRUE:FALSE); icq_EnableMultipleControls(hwndDlg, icqAvatarControls, SIZEOF(icqAvatarControls), - ppro->getSettingByte(NULL, "AvatarsEnabled", DEFAULT_AVATARS_ENABLED)?TRUE:FALSE); + ppro->getByte("AvatarsEnabled", DEFAULT_AVATARS_ENABLED)?TRUE:FALSE); if (ppro->icqOnline()) { diff --git a/protocols/IcqOscarJ/src/icq_packet.cpp b/protocols/IcqOscarJ/src/icq_packet.cpp index 79241cf297..0a727cc5aa 100644 --- a/protocols/IcqOscarJ/src/icq_packet.cpp +++ b/protocols/IcqOscarJ/src/icq_packet.cpp @@ -572,9 +572,9 @@ void CIcqProto::ppackTLVDateFromDB(PBYTE *buf, int *buflen, const char *szSettin SYSTEMTIME sTime = {0}; double time = 0; - sTime.wYear = getSettingWord(NULL, szSettingYear, 0); - sTime.wMonth = getSettingByte(NULL, szSettingMonth, 0); - sTime.wDay = getSettingByte(NULL, szSettingDay, 0); + sTime.wYear = getWord(szSettingYear, 0); + sTime.wMonth = getByte(szSettingMonth, 0); + sTime.wDay = getByte(szSettingDay, 0); if (sTime.wYear || sTime.wMonth || sTime.wDay) { SystemTimeToVariantTime(&sTime, &time); diff --git a/protocols/IcqOscarJ/src/icq_popups.cpp b/protocols/IcqOscarJ/src/icq_popups.cpp index bef035a294..fdaa77cb30 100644 --- a/protocols/IcqOscarJ/src/icq_popups.cpp +++ b/protocols/IcqOscarJ/src/icq_popups.cpp @@ -55,30 +55,30 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ppro = (CIcqProto*)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); - CheckDlgButton(hwndDlg, IDC_POPUPS_LOG_ENABLED, ppro->getSettingByte(NULL,"PopupsLogEnabled",DEFAULT_LOG_POPUPS_ENABLED)); - CheckDlgButton(hwndDlg, IDC_POPUPS_SPAM_ENABLED, ppro->getSettingByte(NULL,"PopupsSpamEnabled",DEFAULT_SPAM_POPUPS_ENABLED)); - SendDlgItemMessage(hwndDlg, IDC_POPUP_LOG0_TEXTCOLOR, CPM_SETCOLOUR, 0, ppro->getSettingDword(NULL,"Popups0TextColor",DEFAULT_LOG0_TEXT_COLORS)); - SendDlgItemMessage(hwndDlg, IDC_POPUP_LOG0_BACKCOLOR, CPM_SETCOLOUR, 0, ppro->getSettingDword(NULL,"Popups0BackColor",DEFAULT_LOG0_BACK_COLORS)); - SetDlgItemInt(hwndDlg, IDC_POPUP_LOG0_TIMEOUT, ppro->getSettingDword(NULL,"Popups0Timeout",DEFAULT_LOG0_TIMEOUT),FALSE); - SendDlgItemMessage(hwndDlg, IDC_POPUP_LOG1_TEXTCOLOR, CPM_SETCOLOUR, 0, ppro->getSettingDword(NULL,"Popups1TextColor",DEFAULT_LOG1_TEXT_COLORS)); - SendDlgItemMessage(hwndDlg, IDC_POPUP_LOG1_BACKCOLOR, CPM_SETCOLOUR, 0, ppro->getSettingDword(NULL,"Popups1BackColor",DEFAULT_LOG1_BACK_COLORS)); - SetDlgItemInt(hwndDlg, IDC_POPUP_LOG1_TIMEOUT, ppro->getSettingDword(NULL,"Popups1Timeout",DEFAULT_LOG1_TIMEOUT),FALSE); - SendDlgItemMessage(hwndDlg, IDC_POPUP_LOG2_TEXTCOLOR, CPM_SETCOLOUR, 0, ppro->getSettingDword(NULL,"Popups2TextColor",DEFAULT_LOG2_TEXT_COLORS)); - SendDlgItemMessage(hwndDlg, IDC_POPUP_LOG2_BACKCOLOR, CPM_SETCOLOUR, 0, ppro->getSettingDword(NULL,"Popups2BackColor",DEFAULT_LOG2_BACK_COLORS)); - SetDlgItemInt(hwndDlg, IDC_POPUP_LOG2_TIMEOUT, ppro->getSettingDword(NULL,"Popups2Timeout",DEFAULT_LOG2_TIMEOUT),FALSE); - SendDlgItemMessage(hwndDlg, IDC_POPUP_LOG3_TEXTCOLOR, CPM_SETCOLOUR, 0, ppro->getSettingDword(NULL,"Popups3TextColor",DEFAULT_LOG3_TEXT_COLORS)); - SendDlgItemMessage(hwndDlg, IDC_POPUP_LOG3_BACKCOLOR, CPM_SETCOLOUR, 0, ppro->getSettingDword(NULL,"Popups3BackColor",DEFAULT_LOG3_BACK_COLORS)); - SetDlgItemInt(hwndDlg, IDC_POPUP_LOG3_TIMEOUT, ppro->getSettingDword(NULL,"Popups3Timeout",DEFAULT_LOG3_TIMEOUT),FALSE); - SendDlgItemMessage(hwndDlg, IDC_POPUP_SPAM_TEXTCOLOR, CPM_SETCOLOUR, 0, ppro->getSettingDword(NULL,"PopupsSpamTextColor",DEFAULT_SPAM_TEXT_COLORS)); - SendDlgItemMessage(hwndDlg, IDC_POPUP_SPAM_BACKCOLOR, CPM_SETCOLOUR, 0, ppro->getSettingDword(NULL,"PopupsSpamBackColor",DEFAULT_SPAM_BACK_COLORS)); - SetDlgItemInt(hwndDlg, IDC_POPUP_SPAM_TIMEOUT, ppro->getSettingDword(NULL,"PopupsSpamTimeout",DEFAULT_SPAM_TIMEOUT),FALSE); - bEnabled = ppro->getSettingByte(NULL,"PopupsWinColors",DEFAULT_POPUPS_WIN_COLORS); + CheckDlgButton(hwndDlg, IDC_POPUPS_LOG_ENABLED, ppro->getByte(NULL,"PopupsLogEnabled",DEFAULT_LOG_POPUPS_ENABLED)); + CheckDlgButton(hwndDlg, IDC_POPUPS_SPAM_ENABLED, ppro->getByte(NULL,"PopupsSpamEnabled",DEFAULT_SPAM_POPUPS_ENABLED)); + SendDlgItemMessage(hwndDlg, IDC_POPUP_LOG0_TEXTCOLOR, CPM_SETCOLOUR, 0, ppro->getDword(NULL,"Popups0TextColor",DEFAULT_LOG0_TEXT_COLORS)); + SendDlgItemMessage(hwndDlg, IDC_POPUP_LOG0_BACKCOLOR, CPM_SETCOLOUR, 0, ppro->getDword(NULL,"Popups0BackColor",DEFAULT_LOG0_BACK_COLORS)); + SetDlgItemInt(hwndDlg, IDC_POPUP_LOG0_TIMEOUT, ppro->getDword(NULL,"Popups0Timeout",DEFAULT_LOG0_TIMEOUT),FALSE); + SendDlgItemMessage(hwndDlg, IDC_POPUP_LOG1_TEXTCOLOR, CPM_SETCOLOUR, 0, ppro->getDword(NULL,"Popups1TextColor",DEFAULT_LOG1_TEXT_COLORS)); + SendDlgItemMessage(hwndDlg, IDC_POPUP_LOG1_BACKCOLOR, CPM_SETCOLOUR, 0, ppro->getDword(NULL,"Popups1BackColor",DEFAULT_LOG1_BACK_COLORS)); + SetDlgItemInt(hwndDlg, IDC_POPUP_LOG1_TIMEOUT, ppro->getDword(NULL,"Popups1Timeout",DEFAULT_LOG1_TIMEOUT),FALSE); + SendDlgItemMessage(hwndDlg, IDC_POPUP_LOG2_TEXTCOLOR, CPM_SETCOLOUR, 0, ppro->getDword(NULL,"Popups2TextColor",DEFAULT_LOG2_TEXT_COLORS)); + SendDlgItemMessage(hwndDlg, IDC_POPUP_LOG2_BACKCOLOR, CPM_SETCOLOUR, 0, ppro->getDword(NULL,"Popups2BackColor",DEFAULT_LOG2_BACK_COLORS)); + SetDlgItemInt(hwndDlg, IDC_POPUP_LOG2_TIMEOUT, ppro->getDword(NULL,"Popups2Timeout",DEFAULT_LOG2_TIMEOUT),FALSE); + SendDlgItemMessage(hwndDlg, IDC_POPUP_LOG3_TEXTCOLOR, CPM_SETCOLOUR, 0, ppro->getDword(NULL,"Popups3TextColor",DEFAULT_LOG3_TEXT_COLORS)); + SendDlgItemMessage(hwndDlg, IDC_POPUP_LOG3_BACKCOLOR, CPM_SETCOLOUR, 0, ppro->getDword(NULL,"Popups3BackColor",DEFAULT_LOG3_BACK_COLORS)); + SetDlgItemInt(hwndDlg, IDC_POPUP_LOG3_TIMEOUT, ppro->getDword(NULL,"Popups3Timeout",DEFAULT_LOG3_TIMEOUT),FALSE); + SendDlgItemMessage(hwndDlg, IDC_POPUP_SPAM_TEXTCOLOR, CPM_SETCOLOUR, 0, ppro->getDword(NULL,"PopupsSpamTextColor",DEFAULT_SPAM_TEXT_COLORS)); + SendDlgItemMessage(hwndDlg, IDC_POPUP_SPAM_BACKCOLOR, CPM_SETCOLOUR, 0, ppro->getDword(NULL,"PopupsSpamBackColor",DEFAULT_SPAM_BACK_COLORS)); + SetDlgItemInt(hwndDlg, IDC_POPUP_SPAM_TIMEOUT, ppro->getDword(NULL,"PopupsSpamTimeout",DEFAULT_SPAM_TIMEOUT),FALSE); + bEnabled = ppro->getByte(NULL,"PopupsWinColors",DEFAULT_POPUPS_WIN_COLORS); CheckDlgButton(hwndDlg, IDC_USEWINCOLORS, bEnabled); - bEnabled |= ppro->getSettingByte(NULL,"PopupsDefColors",DEFAULT_POPUPS_DEF_COLORS); + bEnabled |= ppro->getByte(NULL,"PopupsDefColors",DEFAULT_POPUPS_DEF_COLORS); CheckDlgButton(hwndDlg, IDC_USEDEFCOLORS, bEnabled); icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, SIZEOF(icqPopupColorControls), bEnabled); - CheckDlgButton(hwndDlg, IDC_USESYSICONS, ppro->getSettingByte(NULL,"PopupsSysIcons",DEFAULT_POPUPS_SYS_ICONS)); - bEnabled = ppro->getSettingByte(NULL,"PopupsEnabled",DEFAULT_POPUPS_ENABLED); + CheckDlgButton(hwndDlg, IDC_USESYSICONS, ppro->getByte(NULL,"PopupsSysIcons",DEFAULT_POPUPS_SYS_ICONS)); + bEnabled = ppro->getByte(NULL,"PopupsEnabled",DEFAULT_POPUPS_ENABLED); CheckDlgButton(hwndDlg, IDC_POPUPS_ENABLED, bEnabled); icq_EnableMultipleControls(hwndDlg, icqPopupsControls, SIZEOF(icqPopupsControls), bEnabled); if (bEnabled) @@ -172,27 +172,27 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - ppro->setSettingByte(NULL,"PopupsEnabled",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_POPUPS_ENABLED)); - ppro->setSettingByte(NULL,"PopupsLogEnabled",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_POPUPS_LOG_ENABLED)); - ppro->setSettingByte(NULL,"PopupsSpamEnabled",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_POPUPS_SPAM_ENABLED)); - ppro->setSettingDword(NULL,"Popups0TextColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG0_TEXTCOLOR,CPM_GETCOLOUR,0,0)); - ppro->setSettingDword(NULL,"Popups0BackColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG0_BACKCOLOR,CPM_GETCOLOUR,0,0)); - ppro->setSettingDword(NULL,"Popups0Timeout",GetDlgItemInt(hwndDlg, IDC_POPUP_LOG0_TIMEOUT, NULL, FALSE)); - ppro->setSettingDword(NULL,"Popups1TextColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG1_TEXTCOLOR,CPM_GETCOLOUR,0,0)); - ppro->setSettingDword(NULL,"Popups1BackColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG1_BACKCOLOR,CPM_GETCOLOUR,0,0)); - ppro->setSettingDword(NULL,"Popups1Timeout",GetDlgItemInt(hwndDlg, IDC_POPUP_LOG1_TIMEOUT, NULL, FALSE)); - ppro->setSettingDword(NULL,"Popups2TextColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG2_TEXTCOLOR,CPM_GETCOLOUR,0,0)); - ppro->setSettingDword(NULL,"Popups2BackColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG2_BACKCOLOR,CPM_GETCOLOUR,0,0)); - ppro->setSettingDword(NULL,"Popups2Timeout",GetDlgItemInt(hwndDlg, IDC_POPUP_LOG2_TIMEOUT, NULL, FALSE)); - ppro->setSettingDword(NULL,"Popups3TextColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG3_TEXTCOLOR,CPM_GETCOLOUR,0,0)); - ppro->setSettingDword(NULL,"Popups3BackColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG3_BACKCOLOR,CPM_GETCOLOUR,0,0)); - ppro->setSettingDword(NULL,"Popups3Timeout",GetDlgItemInt(hwndDlg, IDC_POPUP_LOG3_TIMEOUT, NULL, FALSE)); - ppro->setSettingDword(NULL,"PopupsSpamTextColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_SPAM_TEXTCOLOR,CPM_GETCOLOUR,0,0)); - ppro->setSettingDword(NULL,"PopupsSpamBackColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_SPAM_BACKCOLOR,CPM_GETCOLOUR,0,0)); - ppro->setSettingDword(NULL,"PopupsSpamTimeout",GetDlgItemInt(hwndDlg, IDC_POPUP_SPAM_TIMEOUT, NULL, FALSE)); - ppro->setSettingByte(NULL,"PopupsWinColors",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USEWINCOLORS)); - ppro->setSettingByte(NULL,"PopupsDefColors",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USEDEFCOLORS)); - ppro->setSettingByte(NULL,"PopupsSysIcons",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USESYSICONS)); + ppro->setByte("PopupsEnabled",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_POPUPS_ENABLED)); + ppro->setByte("PopupsLogEnabled",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_POPUPS_LOG_ENABLED)); + ppro->setByte("PopupsSpamEnabled",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_POPUPS_SPAM_ENABLED)); + ppro->setDword("Popups0TextColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG0_TEXTCOLOR,CPM_GETCOLOUR,0,0)); + ppro->setDword("Popups0BackColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG0_BACKCOLOR,CPM_GETCOLOUR,0,0)); + ppro->setDword("Popups0Timeout",GetDlgItemInt(hwndDlg, IDC_POPUP_LOG0_TIMEOUT, NULL, FALSE)); + ppro->setDword("Popups1TextColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG1_TEXTCOLOR,CPM_GETCOLOUR,0,0)); + ppro->setDword("Popups1BackColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG1_BACKCOLOR,CPM_GETCOLOUR,0,0)); + ppro->setDword("Popups1Timeout",GetDlgItemInt(hwndDlg, IDC_POPUP_LOG1_TIMEOUT, NULL, FALSE)); + ppro->setDword("Popups2TextColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG2_TEXTCOLOR,CPM_GETCOLOUR,0,0)); + ppro->setDword("Popups2BackColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG2_BACKCOLOR,CPM_GETCOLOUR,0,0)); + ppro->setDword("Popups2Timeout",GetDlgItemInt(hwndDlg, IDC_POPUP_LOG2_TIMEOUT, NULL, FALSE)); + ppro->setDword("Popups3TextColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG3_TEXTCOLOR,CPM_GETCOLOUR,0,0)); + ppro->setDword("Popups3BackColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_LOG3_BACKCOLOR,CPM_GETCOLOUR,0,0)); + ppro->setDword("Popups3Timeout",GetDlgItemInt(hwndDlg, IDC_POPUP_LOG3_TIMEOUT, NULL, FALSE)); + ppro->setDword("PopupsSpamTextColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_SPAM_TEXTCOLOR,CPM_GETCOLOUR,0,0)); + ppro->setDword("PopupsSpamBackColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_SPAM_BACKCOLOR,CPM_GETCOLOUR,0,0)); + ppro->setDword("PopupsSpamTimeout",GetDlgItemInt(hwndDlg, IDC_POPUP_SPAM_TIMEOUT, NULL, FALSE)); + ppro->setByte("PopupsWinColors",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USEWINCOLORS)); + ppro->setByte("PopupsDefColors",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USEDEFCOLORS)); + ppro->setByte("PopupsSysIcons",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USESYSICONS)); return TRUE; } break; @@ -202,7 +202,7 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR int CIcqProto::ShowPopupMsg(HANDLE hContact, const char *szTitle, const char *szMsg, BYTE bType) { - if (bPopupService && getSettingByte(NULL, "PopupsEnabled", DEFAULT_POPUPS_ENABLED)) + if (bPopupService && getByte("PopupsEnabled", DEFAULT_POPUPS_ENABLED)) { POPUPDATAT ppd = { 0 }; LPCTSTR rsIcon; @@ -247,32 +247,32 @@ int CIcqProto::ShowPopupMsg(HANDLE hContact, const char *szTitle, const char *sz default: return -1; } - if (!getSettingByte(NULL, "PopupsSysIcons", DEFAULT_POPUPS_SYS_ICONS)) + if (!getByte("PopupsSysIcons", DEFAULT_POPUPS_SYS_ICONS)) ppd.lchIcon = Skin_GetIconByHandle(m_hProtoIcon); else ppd.lchIcon = (HICON)LoadImage( NULL, rsIcon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED); - if (getSettingByte(NULL, "PopupsWinColors", DEFAULT_POPUPS_WIN_COLORS)) { + if (getByte("PopupsWinColors", DEFAULT_POPUPS_WIN_COLORS)) { ppd.colorText = GetSysColor(COLOR_WINDOWTEXT); ppd.colorBack = GetSysColor(COLOR_WINDOW); } else { - if (getSettingByte(NULL, "PopupsDefColors", DEFAULT_POPUPS_DEF_COLORS)) { + if (getByte("PopupsDefColors", DEFAULT_POPUPS_DEF_COLORS)) { ppd.colorText = NULL; ppd.colorBack = NULL; } else { strcpy(szSetting, szPrefix); strcat(szSetting, "TextColor"); - ppd.colorText = getSettingDword(NULL, szSetting, ppd.colorText); + ppd.colorText = getDword(szSetting, ppd.colorText); strcpy(szSetting, szPrefix); strcat(szSetting, "BackColor"); - ppd.colorBack = getSettingDword(NULL, szSetting, ppd.colorBack); + ppd.colorBack = getDword(szSetting, ppd.colorBack); } } strcpy(szSetting, szPrefix); strcat(szSetting, "Timeout"); - ppd.iSeconds = getSettingDword(NULL, szSetting, ppd.iSeconds); + ppd.iSeconds = getDword(szSetting, ppd.iSeconds); char str[4096]; make_unicode_string_static( ICQTranslateUtfStatic(szTitle, str, sizeof(str)), ppd.lpwzContactName, MAX_CONTACTNAME); diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index cb5ee9948e..04260b55df 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -443,7 +443,7 @@ int CIcqProto::Authorize( HANDLE hDbEvent ) icq_sendAuthResponseServ(uin, uid, 1, _T("")); - deleteSetting(hContact, "Grant"); + db_unset(hContact, m_szModuleName, "Grant"); return 0; // Success } @@ -697,7 +697,7 @@ DWORD_PTR __cdecl CIcqProto::GetCaps( int type, HANDLE hContact ) PF1_ADDED | PF1_CONTACT; if (!m_bAimEnabled) nReturn |= PF1_NUMERICUSERID; - if (m_bSsiEnabled && getSettingByte(NULL, "ServerAddRemove", DEFAULT_SS_ADDSERVER)) + if (m_bSsiEnabled && getByte("ServerAddRemove", DEFAULT_SS_ADDSERVER)) nReturn |= PF1_SERVERCLIST; break; @@ -739,7 +739,7 @@ DWORD_PTR __cdecl CIcqProto::GetCaps( int type, HANDLE hContact ) case PFLAG_MAXCONTACTSPERPACKET: if ( hContact ) { // determine per contact - BYTE bClientId = getSettingByte(hContact, "ClientID", CLID_GENERIC); + BYTE bClientId = getByte(hContact, "ClientID", CLID_GENERIC); if (bClientId == CLID_MIRANDA) { @@ -1386,7 +1386,7 @@ HANDLE __cdecl CIcqProto::SendFile( HANDLE hContact, const TCHAR* szDescription, if (dwUin) { - WORD wClientVersion = getSettingWord(hContact, "Version", 7); + WORD wClientVersion = getWord(hContact, "Version", 7); if (wClientVersion < 7) NetLog_Server("IcqSendFile() can't send to version %u", wClientVersion); @@ -1514,7 +1514,7 @@ int __cdecl CIcqProto::SendMsg( HANDLE hContact, int flags, const char* pszSrc ) BOOL oldAnsi = plain_ascii || !m_bUtfEnabled || (!(flags & (PREF_UTF | PREF_UNICODE)) && m_bUtfEnabled == 1) || !CheckContactCapabilities(hContact, CAPF_UTF) || - !getSettingByte(hContact, "UnicodeSend", 1); + !getByte(hContact, "UnicodeSend", 1); if (m_bTempVisListEnabled && m_iStatus == ID_STATUS_INVISIBLE) makeContactTemporaryVisible(hContact); // make us temporarily visible to contact @@ -1568,8 +1568,8 @@ int __cdecl CIcqProto::SendMsg( HANDLE hContact, int flags, const char* pszSrc ) if (!dwUin || !CheckContactCapabilities(hContact, CAPF_SRV_RELAY) || wRecipientStatus == ID_STATUS_OFFLINE || wRecipientStatus == ID_STATUS_INVISIBLE || - getSettingByte(hContact, "OnlyServerAcks", getSettingByte(NULL, "OnlyServerAcks", DEFAULT_ONLYSERVERACKS)) || - !getSettingByte(hContact, "SlowSend", getSettingByte(NULL, "SlowSend", DEFAULT_SLOWSEND))) + getByte(hContact, "OnlyServerAcks", getByte("OnlyServerAcks", DEFAULT_ONLYSERVERACKS)) || + !getByte(hContact, "SlowSend", getByte("SlowSend", DEFAULT_SLOWSEND))) { /// TODO: add support for RTL & user customizable font { @@ -1798,12 +1798,12 @@ int __cdecl CIcqProto::SetApparentMode( HANDLE hContact, int mode ) // Only 3 modes are supported if (mode == 0 || mode == ID_STATUS_ONLINE || mode == ID_STATUS_OFFLINE) { - int oldMode = getSettingWord(hContact, "ApparentMode", 0); + int oldMode = getWord(hContact, "ApparentMode", 0); // Don't send redundant updates if (mode != oldMode) { - setSettingWord(hContact, "ApparentMode", (WORD)mode); + setWord(hContact, "ApparentMode", (WORD)mode); // Not being online is only an error when in SS mode. This is not handled // yet so we just ignore this for now. @@ -1811,17 +1811,17 @@ int __cdecl CIcqProto::SetApparentMode( HANDLE hContact, int mode ) { if (oldMode != 0) { // Remove from old list - if (oldMode == ID_STATUS_OFFLINE && getSettingWord(hContact, DBSETTING_SERVLIST_IGNORE, 0)) + if (oldMode == ID_STATUS_OFFLINE && getWord(hContact, DBSETTING_SERVLIST_IGNORE, 0)) { // Need to remove Ignore item as well - icq_removeServerPrivacyItem(hContact, uin, uid, getSettingWord(hContact, DBSETTING_SERVLIST_IGNORE, 0), SSI_ITEM_IGNORE); + icq_removeServerPrivacyItem(hContact, uin, uid, getWord(hContact, DBSETTING_SERVLIST_IGNORE, 0), SSI_ITEM_IGNORE); - setSettingWord(hContact, DBSETTING_SERVLIST_IGNORE, 0); + setWord(hContact, DBSETTING_SERVLIST_IGNORE, 0); } icq_sendChangeVisInvis(hContact, uin, uid, oldMode==ID_STATUS_OFFLINE, 0); } if (mode != 0) { // Add to new list - if (mode==ID_STATUS_OFFLINE && getSettingWord(hContact, DBSETTING_SERVLIST_IGNORE, 0)) + if (mode==ID_STATUS_OFFLINE && getWord(hContact, DBSETTING_SERVLIST_IGNORE, 0)) return 0; // Success: offline by ignore item icq_sendChangeVisInvis(hContact, uin, uid, mode==ID_STATUS_OFFLINE, 1); @@ -1884,7 +1884,7 @@ int __cdecl CIcqProto::SetStatus(int iNewStatus) return 0; // clear custom status on status change - if (getSettingByte(NULL, "XStatusReset", DEFAULT_XSTATUS_RESET)) + if (getByte("XStatusReset", DEFAULT_XSTATUS_RESET)) setXStatusEx(0, 0); // New status is OFFLINE @@ -2098,10 +2098,10 @@ HANDLE __cdecl CIcqProto::GetAwayMsg( HANDLE hContact ) } if (CheckContactCapabilities(hContact, CAPF_STATUS_MESSAGES)) return (HANDLE)icq_sendGetAwayMsgServExt(hContact, dwUin, szUID, wMessageType, - (WORD)(getSettingWord(hContact, "Version", 0)==9?9:ICQ_VERSION)); // Success + (WORD)(getWord(hContact, "Version", 0)==9?9:ICQ_VERSION)); // Success else return (HANDLE)icq_sendGetAwayMsgServ(hContact, dwUin, wMessageType, - (WORD)(getSettingWord(hContact, "Version", 0)==9?9:ICQ_VERSION)); // Success + (WORD)(getWord(hContact, "Version", 0)==9?9:ICQ_VERSION)); // Success } } else diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h index 81a4c5755e..af852a7b8f 100644 --- a/protocols/IcqOscarJ/src/icq_proto.h +++ b/protocols/IcqOscarJ/src/icq_proto.h @@ -427,12 +427,7 @@ struct CIcqProto : public PROTO int IsICQContact(HANDLE hContact); int getSetting(HANDLE hContact, const char *szSetting, DBVARIANT *dbv); - BYTE getSettingByte(HANDLE hContact, const char *szSetting, BYTE byDef); - WORD getSettingWord(HANDLE hContact, const char *szSetting, WORD wDef); - DWORD getSettingDword(HANDLE hContact, const char *szSetting, DWORD dwDef); double getSettingDouble(HANDLE hContact, const char *szSetting, double dDef); - int getSettingString(HANDLE hContact, const char *szSetting, DBVARIANT *dbv); - int getSettingStringW(HANDLE hContact, const char *szSetting, DBVARIANT *dbv); int getSettingStringStatic(HANDLE hContact, const char *szSetting, char *dest, int dest_len); char* getSettingStringUtf(HANDLE hContact, const char *szModule, const char *szSetting, char *szDef); char* getSettingStringUtf(HANDLE hContact, const char *szSetting, char *szDef); @@ -441,16 +436,7 @@ struct CIcqProto : public PROTO WORD getContactStatus(HANDLE hContact); char* getContactCListGroup(HANDLE hContact); - int deleteSetting(HANDLE hContact, const char *szSetting); - - int setSettingByte(HANDLE hContact, const char *szSetting, BYTE byValue); - int setSettingWord(HANDLE hContact, const char *szSetting, WORD wValue); - int setSettingDword(HANDLE hContact, const char *szSetting, DWORD dwValue); int setSettingDouble(HANDLE hContact, const char *szSetting, double dValue); - int setSettingString(HANDLE hContact, const char *szSetting, const char *szValue); - int setSettingStringW(HANDLE hContact, const char *szSetting, const WCHAR *wszValue); - int setSettingStringUtf(HANDLE hContact, const char *szModule, const char *szSetting, const char *szValue); - int setSettingStringUtf(HANDLE hContact, const char *szSetting, const char *szValue); int setSettingBlob(HANDLE hContact, const char *szSetting, const BYTE *pValue, const int cbValue); int setContactHidden(HANDLE hContact, BYTE bHidden); void setStatusMsgVar(HANDLE hContact, char* szStatusMsg, bool isAnsi); diff --git a/protocols/IcqOscarJ/src/icq_server.cpp b/protocols/IcqOscarJ/src/icq_server.cpp index cb02eec4ad..4a4aebba2e 100644 --- a/protocols/IcqOscarJ/src/icq_server.cpp +++ b/protocols/IcqOscarJ/src/icq_server.cpp @@ -88,17 +88,17 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) // Initialize direct connection ports { DWORD dwInternalIP; - BYTE bConstInternalIP = getSettingByte(NULL, "ConstRealIP", 0); + BYTE bConstInternalIP = getByte("ConstRealIP", 0); info.hDirectBoundPort = NetLib_BindPort(icq_newConnectionReceived, this, &wListenPort, &dwInternalIP); if (!info.hDirectBoundPort) { icq_LogUsingErrorCode(LOG_WARNING, GetLastError(), LPGEN("Miranda was unable to allocate a port to listen for direct peer-to-peer connections between clients. You will be able to use most of the ICQ network without problems but you may be unable to send or receive files.\n\nIf you have a firewall this may be blocking Miranda, in which case you should configure your firewall to leave some ports open and tell Miranda which ports to use in M->Options->ICQ->Network.")); wListenPort = 0; - if (!bConstInternalIP) deleteSetting(NULL, "RealIP"); + if (!bConstInternalIP) db_unset(NULL, m_szModuleName, "RealIP"); } else if (!bConstInternalIP) - setSettingDword(NULL, "RealIP", dwInternalIP); + setDword("RealIP", dwInternalIP); } // Initialize rate limiting queues @@ -204,7 +204,7 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) { char tmp = 0; - setSettingWord(hContact, "Status", ID_STATUS_OFFLINE); + setWord(hContact, "Status", ID_STATUS_OFFLINE); handleXStatusCaps(dwUIN, szUID, hContact, (BYTE*)&tmp, 0, &tmp, 0); } @@ -213,7 +213,7 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) hContact = FindNextContact(hContact); } - setSettingDword(NULL, "LogonTS", 0); // clear logon time + setDword("LogonTS", 0); // clear logon time servlistPendingFlushOperations(); // clear pending operations list @@ -421,7 +421,7 @@ void CIcqProto::icq_login(const char* szPassword) stsi->nloc.szHost = null_strdup(szServer); // Server port - stsi->nloc.wPort = getSettingWord(NULL, "OscarPort", m_bSecureConnection ? DEFAULT_SERVER_PORT_SSL : DEFAULT_SERVER_PORT); + stsi->nloc.wPort = getWord("OscarPort", m_bSecureConnection ? DEFAULT_SERVER_PORT_SSL : DEFAULT_SERVER_PORT); if (stsi->nloc.wPort == 0) stsi->nloc.wPort = RandRange(1024, 65535); diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index 19f029f6ff..ee23a072c5 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -968,15 +968,15 @@ void CIcqProto::LoadServerIDs() int nGroups = 0, nContacts = 0, nPermits = 0, nDenys = 0, nIgnores = 0, nUnhandled = 0; servlistMutex->Enter(); - if (wSrvID = getSettingWord(NULL, DBSETTING_SERVLIST_AVATAR, 0)) + if (wSrvID = getWord(DBSETTING_SERVLIST_AVATAR, 0)) ReserveServerID(wSrvID, SSIT_ITEM, 0); - if (wSrvID = getSettingWord(NULL, DBSETTING_SERVLIST_PHOTO, 0)) + if (wSrvID = getWord(DBSETTING_SERVLIST_PHOTO, 0)) ReserveServerID(wSrvID, SSIT_ITEM, 0); - if (wSrvID = getSettingWord(NULL, DBSETTING_SERVLIST_PRIVACY, 0)) + if (wSrvID = getWord(DBSETTING_SERVLIST_PRIVACY, 0)) ReserveServerID(wSrvID, SSIT_ITEM, 0); - if (wSrvID = getSettingWord(NULL, DBSETTING_SERVLIST_METAINFO, 0)) + if (wSrvID = getWord(DBSETTING_SERVLIST_METAINFO, 0)) ReserveServerID(wSrvID, SSIT_ITEM, 0); - if (wSrvID = getSettingWord(NULL, "SrvImportID", 0)) + if (wSrvID = getWord("SrvImportID", 0)) ReserveServerID(wSrvID, SSIT_ITEM, 0); DBCONTACTENUMSETTINGS dbces; @@ -997,22 +997,22 @@ void CIcqProto::LoadServerIDs() while (hContact) { // search all our contacts, reserve their server IDs - if (wSrvID = getSettingWord(hContact, DBSETTING_SERVLIST_ID, 0)) + if (wSrvID = getWord(hContact, DBSETTING_SERVLIST_ID, 0)) { ReserveServerID(wSrvID, SSIT_ITEM, 0); nContacts++; } - if (wSrvID = getSettingWord(hContact, DBSETTING_SERVLIST_DENY, 0)) + if (wSrvID = getWord(hContact, DBSETTING_SERVLIST_DENY, 0)) { ReserveServerID(wSrvID, SSIT_ITEM, 0); nDenys++; } - if (wSrvID = getSettingWord(hContact, DBSETTING_SERVLIST_PERMIT, 0)) + if (wSrvID = getWord(hContact, DBSETTING_SERVLIST_PERMIT, 0)) { ReserveServerID(wSrvID, SSIT_ITEM, 0); nPermits++; } - if (wSrvID = getSettingWord(hContact, DBSETTING_SERVLIST_IGNORE, 0)) + if (wSrvID = getWord(hContact, DBSETTING_SERVLIST_IGNORE, 0)) { ReserveServerID(wSrvID, SSIT_ITEM, 0); nIgnores++; @@ -1068,7 +1068,7 @@ void CIcqProto::StoreServerIDs() /// TODO: allow delayed if (pUnhandled) setSettingBlob(NULL, DBSETTING_SERVLIST_UNHANDLED, pUnhandled, cbUnhandled); else - deleteSetting(NULL, DBSETTING_SERVLIST_UNHANDLED); + db_unset(NULL, m_szModuleName, DBSETTING_SERVLIST_UNHANDLED); SAFE_FREE((void**)&pUnhandled); } @@ -1159,7 +1159,7 @@ DWORD CIcqProto::icq_sendServerItem(DWORD dwCookie, WORD wAction, WORD wGroupId, } // Force reload of server-list after change - setSettingWord(NULL, "SrvRecordCount", 0); + setWord("SrvRecordCount", 0); return dwCookie; } @@ -1184,7 +1184,7 @@ DWORD CIcqProto::icq_sendServerContact(HANDLE hContact, DWORD dwCookie, WORD wAc return 0; } - bAuth = getSettingByte(hContact, "Auth", 0); + bAuth = getByte(hContact, "Auth", 0); szNick = getSettingStringUtf(hContact, "CList", "MyHandle", NULL); szNote = getSettingStringUtf(hContact, "UserInfo", "MyNotes", NULL); @@ -1347,7 +1347,7 @@ int CIcqProto::IsServerGroupsDefined() { int iRes = 1; - if (getSettingDword(NULL, "Version", 0) < 0x00030608) + if (getDword("Version", 0) < 0x00030608) { // group cache & linking data too old, flush, reload from server char szModule[MAX_PATH]; @@ -1358,7 +1358,7 @@ int CIcqProto::IsServerGroupsDefined() iRes = 0; // no groups defined, or older version } // store our current version - setSettingDword(NULL, "Version", ICQ_PLUG_VERSION & 0x00FFFFFF); + setDword("Version", ICQ_PLUG_VERSION & 0x00FFFFFF); return iRes; } @@ -1385,9 +1385,9 @@ void* CIcqProto::collectBuddyGroup(WORD wGroupID, int *count) while (hContact) { // search all contacts - if (wGroupID == getSettingWord(hContact, DBSETTING_SERVLIST_GROUP, 0)) + if (wGroupID == getWord(hContact, DBSETTING_SERVLIST_GROUP, 0)) { // add only buddys from specified group - wItemID = getSettingWord(hContact, DBSETTING_SERVLIST_ID, 0); + wItemID = getWord(hContact, DBSETTING_SERVLIST_ID, 0); if (wItemID) { // valid ID, add @@ -1420,7 +1420,7 @@ void* CIcqProto::collectGroups(int *count) while (hContact) { // search all contacts - if (wGroupID = getSettingWord(hContact, DBSETTING_SERVLIST_GROUP, 0)) + if (wGroupID = getWord(hContact, DBSETTING_SERVLIST_GROUP, 0)) { // add only valid IDs for (i = 0; ihContact, DBSETTING_SERVLIST_ID, 0); + WORD wItemID = getWord(ack->hContact, DBSETTING_SERVLIST_ID, 0); if (wItemID) /// TODO: redundant ??? { // Only add the contact if it doesnt already have an ID @@ -2076,11 +2076,11 @@ int CIcqProto::servlistAddContact_Ready(HANDLE hContact, WORD wContactID, WORD w return CALLBACK_RESULT_CONTINUE; } - WORD wItemID = getSettingWord(ack->hContact, DBSETTING_SERVLIST_ID, 0); + WORD wItemID = getWord(ack->hContact, DBSETTING_SERVLIST_ID, 0); if (wItemID) { // Only add the contact if it doesn't already have an ID - servlistPendingRemoveContact(ack->hContact, wItemID, getSettingWord(hContact, DBSETTING_SERVLIST_GROUP, 0), PENDING_RESULT_SUCCESS); + servlistPendingRemoveContact(ack->hContact, wItemID, getWord(hContact, DBSETTING_SERVLIST_GROUP, 0), PENDING_RESULT_SUCCESS); NetLog_Server("Failed to add contact to server side list (%s)", "already there"); SAFE_FREE((void**)&ack->szGroup); SAFE_FREE((void**)&ack); @@ -2138,7 +2138,7 @@ int CIcqProto::servlistRemoveContact_Ready(HANDLE hContact, WORD contactID, WORD } // Get the contact's group ID - if (!(wGroupID = getSettingWord(hContact, DBSETTING_SERVLIST_GROUP, 0))) + if (!(wGroupID = getWord(hContact, DBSETTING_SERVLIST_GROUP, 0))) { // Could not find a usable group ID servlistPendingRemoveContact(hContact, contactID, groupID, PENDING_RESULT_FAILED); @@ -2148,7 +2148,7 @@ int CIcqProto::servlistRemoveContact_Ready(HANDLE hContact, WORD contactID, WORD } // Get the contact's item ID - if (!(wItemID = getSettingWord(hContact, DBSETTING_SERVLIST_ID, 0))) + if (!(wItemID = getWord(hContact, DBSETTING_SERVLIST_ID, 0))) { // Could not find usable item ID servlistPendingRemoveContact(hContact, contactID, wGroupID, PENDING_RESULT_FAILED); @@ -2219,8 +2219,8 @@ int CIcqProto::servlistMoveContact_gotTargetGroup(const char *szGroup, WORD wNew return CALLBACK_RESULT_CONTINUE; } - WORD wItemID = getSettingWord(ack->hContact, DBSETTING_SERVLIST_ID, 0); - WORD wGroupID = getSettingWord(ack->hContact, DBSETTING_SERVLIST_GROUP, 0); + WORD wItemID = getWord(ack->hContact, DBSETTING_SERVLIST_ID, 0); + WORD wGroupID = getWord(ack->hContact, DBSETTING_SERVLIST_GROUP, 0); if (!wItemID) { // We have no ID, so try to simply add the contact to serv-list @@ -2268,8 +2268,8 @@ int CIcqProto::servlistMoveContact_Ready(HANDLE hContact, WORD contactID, WORD g return CALLBACK_RESULT_CONTINUE; } - WORD wItemID = getSettingWord(ack->hContact, DBSETTING_SERVLIST_ID, 0); - WORD wGroupID = getSettingWord(ack->hContact, DBSETTING_SERVLIST_GROUP, 0); + WORD wItemID = getWord(ack->hContact, DBSETTING_SERVLIST_ID, 0); + WORD wGroupID = getWord(ack->hContact, DBSETTING_SERVLIST_GROUP, 0); if (!wGroupID && wItemID) { // Only move the contact if it had an GroupID @@ -2309,9 +2309,9 @@ void CIcqProto::servlistMoveContact(HANDLE hContact, const char *pszNewGroup) return; } - if (!getSettingWord(hContact, DBSETTING_SERVLIST_ID, 0)) /// FIXME:::: this should be in _ready + if (!getWord(hContact, DBSETTING_SERVLIST_ID, 0)) /// FIXME:::: this should be in _ready { // the contact is not stored on the server, check if we should try to add - if (!getSettingByte(NULL, "ServerAddRemove", DEFAULT_SS_ADDSERVER) || + if (!getByte("ServerAddRemove", DEFAULT_SS_ADDSERVER) || db_get_b(hContact, "CList", "Hidden", 0)) return; } @@ -2346,7 +2346,7 @@ int CIcqProto::servlistUpdateContact_Ready(HANDLE hContact, WORD contactID, WORD WORD wGroupID; // Get the contact's group ID - if (!(wGroupID = getSettingWord(hContact, DBSETTING_SERVLIST_GROUP, 0))) + if (!(wGroupID = getWord(hContact, DBSETTING_SERVLIST_GROUP, 0))) { servlistPendingRemoveContact(hContact, contactID, groupID, PENDING_RESULT_FAILED); // Could not find a usable group ID @@ -2356,7 +2356,7 @@ int CIcqProto::servlistUpdateContact_Ready(HANDLE hContact, WORD contactID, WORD } // Get the contact's item ID - if (!(wItemID = getSettingWord(hContact, DBSETTING_SERVLIST_ID, 0))) + if (!(wItemID = getWord(hContact, DBSETTING_SERVLIST_ID, 0))) { servlistPendingRemoveContact(hContact, contactID, wGroupID, PENDING_RESULT_FAILED); // Could not find usable item ID @@ -2591,8 +2591,8 @@ void CIcqProto::servlistRemoveGroup(const char *szGroup, WORD wGroupId) void CIcqProto::resetServContactAuthState(HANDLE hContact, DWORD dwUin) { - WORD wContactId = getSettingWord(hContact, DBSETTING_SERVLIST_ID, 0); - WORD wGroupId = getSettingWord(hContact, DBSETTING_SERVLIST_GROUP, 0); + WORD wContactId = getWord(hContact, DBSETTING_SERVLIST_ID, 0); + WORD wGroupId = getWord(hContact, DBSETTING_SERVLIST_GROUP, 0); if (wContactId && wGroupId) { @@ -2611,9 +2611,9 @@ void CIcqProto::resetServContactAuthState(HANDLE hContact, DWORD dwUin) void *doubleObject = NULL; icq_sendServerContact(hContact, dwCookie, ICQ_LISTS_REMOVEFROMLIST, wGroupId, wContactId, SSO_CONTACT_FIXAUTH | SSOF_BEGIN_OPERATION | SSOF_END_OPERATION, 200, &doubleObject); - deleteSetting(hContact, DBSETTING_METAINFO_TOKEN); - deleteSetting(hContact, DBSETTING_METAINFO_TIME); - deleteSetting(hContact, DBSETTING_SERVLIST_DATA); + db_unset(hContact, m_szModuleName, DBSETTING_METAINFO_TOKEN); + db_unset(hContact, m_szModuleName, DBSETTING_METAINFO_TIME); + db_unset(hContact, m_szModuleName, DBSETTING_SERVLIST_DATA); icq_sendServerContact(hContact, dwCookie, ICQ_LISTS_ADDTOLIST, wGroupId, wContactId, SSO_CONTACT_FIXAUTH | SSOF_BEGIN_OPERATION | SSOF_END_OPERATION, 200, &doubleObject); } } @@ -2647,14 +2647,14 @@ int CIcqProto::ServListDbSettingChanged(WPARAM wParam, LPARAM lParam) { // Has contact been renamed? if (!strcmpnull(cws->szSetting, "MyHandle") && - getSettingByte(NULL, "StoreServerDetails", DEFAULT_SS_STORE)) + getByte("StoreServerDetails", DEFAULT_SS_STORE)) { // Update contact's details in server-list servlistUpdateContact((HANDLE)wParam); } // Has contact been moved to another group? if (!strcmpnull(cws->szSetting, "Group") && - getSettingByte(NULL, "StoreServerDetails", DEFAULT_SS_STORE)) + getByte("StoreServerDetails", DEFAULT_SS_STORE)) { // Read group from DB char* szNewGroup = getContactCListGroup((HANDLE)wParam); @@ -2664,7 +2664,7 @@ int CIcqProto::ServListDbSettingChanged(WPARAM wParam, LPARAM lParam) else if (!strcmpnull(cws->szModule, "UserInfo")) { if (!strcmpnull(cws->szSetting, "MyNotes") && - getSettingByte(NULL, "StoreServerDetails", DEFAULT_SS_STORE)) + getByte("StoreServerDetails", DEFAULT_SS_STORE)) { // Update contact's details in server-list servlistUpdateContact((HANDLE)wParam); } @@ -2684,7 +2684,7 @@ int CIcqProto::ServListDbContactDeleted(WPARAM wParam, LPARAM lParam) if ( !icqOnline() && m_bSsiEnabled) { // contact was deleted only locally - retrieve full list on next connect - setSettingWord((HANDLE)wParam, "SrvRecordCount", 0); + setWord((HANDLE)wParam, "SrvRecordCount", 0); } if ( !icqOnline() || !m_bSsiEnabled) @@ -2697,11 +2697,11 @@ int CIcqProto::ServListDbContactDeleted(WPARAM wParam, LPARAM lParam) if (getContactUid((HANDLE)wParam, &dwUIN, &szUID)) return 0; - WORD wContactID = getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_ID, 0); - WORD wGroupID = getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_GROUP, 0); - WORD wVisibleID = getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_PERMIT, 0); - WORD wInvisibleID = getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_DENY, 0); - WORD wIgnoreID = getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_IGNORE, 0); + WORD wContactID = getWord((HANDLE)wParam, DBSETTING_SERVLIST_ID, 0); + WORD wGroupID = getWord((HANDLE)wParam, DBSETTING_SERVLIST_GROUP, 0); + WORD wVisibleID = getWord((HANDLE)wParam, DBSETTING_SERVLIST_PERMIT, 0); + WORD wInvisibleID = getWord((HANDLE)wParam, DBSETTING_SERVLIST_DENY, 0); + WORD wIgnoreID = getWord((HANDLE)wParam, DBSETTING_SERVLIST_IGNORE, 0); // Remove from queue for user details request icq_DequeueUser(dwUIN); @@ -2746,7 +2746,7 @@ int CIcqProto::ServListCListGroupChange(WPARAM wParam, LPARAM lParam) return 0; // only change server-list if it is allowed - if (!getSettingByte(NULL, "StoreServerDetails", DEFAULT_SS_STORE)) + if (!getByte("StoreServerDetails", DEFAULT_SS_STORE)) return 0; diff --git a/protocols/IcqOscarJ/src/icq_uploadui.cpp b/protocols/IcqOscarJ/src/icq_uploadui.cpp index 0b37e6ad22..8275a03f4a 100644 --- a/protocols/IcqOscarJ/src/icq_uploadui.cpp +++ b/protocols/IcqOscarJ/src/icq_uploadui.cpp @@ -93,7 +93,7 @@ static int UpdateCheckmarks(HWND hwndList, CIcqProto* ppro, HANDLE phItemAll) HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) { - if (ppro->getSettingWord(hContact, DBSETTING_SERVLIST_ID, 0)) + if (ppro->getWord(hContact, DBSETTING_SERVLIST_ID, 0)) SendMessage(hwndList, CLM_SETCHECKMARK, (WPARAM)hItem, 1); else bAll = 0; @@ -345,9 +345,9 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg,UINT message,WPARAM wPara case ACTION_ADDBUDDY: if (ack->result == ACKRESULT_SUCCESS) { - ppro->setSettingByte(hCurrentContact, "Auth", 0); - ppro->setSettingWord(hCurrentContact, DBSETTING_SERVLIST_ID, wNewContactId); - ppro->setSettingWord(hCurrentContact, DBSETTING_SERVLIST_GROUP, wNewGroupId); + ppro->setByte(hCurrentContact, "Auth", 0); + ppro->setWord(hCurrentContact, DBSETTING_SERVLIST_ID, wNewContactId); + ppro->setWord(hCurrentContact, DBSETTING_SERVLIST_GROUP, wNewGroupId); break; } else @@ -356,7 +356,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg,UINT message,WPARAM wPara DWORD dwUIN; uid_str szUID; - ppro->setSettingByte(hCurrentContact, "Auth", 1); + ppro->setByte(hCurrentContact, "Auth", 1); if (!ppro->getContactUid(hCurrentContact, &dwUIN, &szUID)) { @@ -370,12 +370,12 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg,UINT message,WPARAM wPara case ACTION_ADDBUDDYAUTH: if (ack->result == ACKRESULT_SUCCESS) { - ppro->setSettingWord(hCurrentContact, DBSETTING_SERVLIST_ID, wNewContactId); - ppro->setSettingWord(hCurrentContact, DBSETTING_SERVLIST_GROUP, wNewGroupId); + ppro->setWord(hCurrentContact, DBSETTING_SERVLIST_ID, wNewContactId); + ppro->setWord(hCurrentContact, DBSETTING_SERVLIST_GROUP, wNewGroupId); } else { - ppro->deleteSetting(hCurrentContact, "Auth"); + db_unset(hCurrentContact, ppro->m_szModuleName, "Auth"); ppro->FreeServerID(wNewContactId, SSIT_ITEM); } @@ -385,9 +385,9 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg,UINT message,WPARAM wPara if (ack->result == ACKRESULT_SUCCESS) { // clear obsolete settings ppro->FreeServerID(wNewContactId, SSIT_ITEM); - ppro->deleteSetting(hCurrentContact, DBSETTING_SERVLIST_ID); - ppro->deleteSetting(hCurrentContact, DBSETTING_SERVLIST_GROUP); - ppro->deleteSetting(hCurrentContact, "Auth"); + db_unset(hCurrentContact, ppro->m_szModuleName, DBSETTING_SERVLIST_ID); + db_unset(hCurrentContact, ppro->m_szModuleName, DBSETTING_SERVLIST_GROUP); + db_unset(hCurrentContact, ppro->m_szModuleName, "Auth"); } break; @@ -458,23 +458,23 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg,UINT message,WPARAM wPara case ACTION_MOVECONTACT: if (ack->result == ACKRESULT_SUCCESS) { - ppro->FreeServerID(ppro->getSettingWord(hCurrentContact, DBSETTING_SERVLIST_ID, 0), SSIT_ITEM); - ppro->setSettingWord(hCurrentContact, DBSETTING_SERVLIST_ID, wNewContactId); - ppro->setSettingWord(hCurrentContact, DBSETTING_SERVLIST_GROUP, wNewGroupId); + ppro->FreeServerID(ppro->getWord(hCurrentContact, DBSETTING_SERVLIST_ID, 0), SSIT_ITEM); + ppro->setWord(hCurrentContact, DBSETTING_SERVLIST_ID, wNewContactId); + ppro->setWord(hCurrentContact, DBSETTING_SERVLIST_GROUP, wNewGroupId); dwUploadDelay *= 2; // we double the delay here (2 packets) } break; case ACTION_ADDVISIBLE: if (ack->result == ACKRESULT_SUCCESS) - ppro->setSettingWord(hCurrentContact, DBSETTING_SERVLIST_PERMIT, wNewContactId); + ppro->setWord(hCurrentContact, DBSETTING_SERVLIST_PERMIT, wNewContactId); else ppro->FreeServerID(wNewContactId, SSIT_ITEM); break; case ACTION_ADDINVISIBLE: if (ack->result == ACKRESULT_SUCCESS) - ppro->setSettingWord(hCurrentContact, DBSETTING_SERVLIST_DENY, wNewContactId); + ppro->setWord(hCurrentContact, DBSETTING_SERVLIST_DENY, wNewContactId); else ppro->FreeServerID(wNewContactId, SSIT_ITEM); break; @@ -483,7 +483,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg,UINT message,WPARAM wPara if (ack->result == ACKRESULT_SUCCESS) { ppro->FreeServerID(wNewContactId, SSIT_ITEM); - ppro->setSettingWord(hCurrentContact, DBSETTING_SERVLIST_PERMIT, 0); + ppro->setWord(hCurrentContact, DBSETTING_SERVLIST_PERMIT, 0); } break; @@ -491,7 +491,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg,UINT message,WPARAM wPara if (ack->result == ACKRESULT_SUCCESS) { ppro->FreeServerID(wNewContactId, SSIT_ITEM); - ppro->setSettingWord(hCurrentContact, DBSETTING_SERVLIST_DENY, 0); + ppro->setWord(hCurrentContact, DBSETTING_SERVLIST_DENY, 0); } break; } @@ -572,7 +572,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg,UINT message,WPARAM wPara if (hItem) { isChecked = SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0) != 0; - isOnServer = ppro->getSettingWord(hContact, DBSETTING_SERVLIST_ID, 0) != 0; + isOnServer = ppro->getWord(hContact, DBSETTING_SERVLIST_ID, 0) != 0; bUidOk = !ppro->getContactUid(hContact, &dwUin, &szUid); @@ -643,8 +643,8 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg,UINT message,WPARAM wPara else AppendToUploadLog(hwndDlg, ICQTranslateUtfStatic(LPGEN("Deleting %s..."), str, MAX_PATH), strUID(dwUin, szUid)); - wNewGroupId = ppro->getSettingWord(hContact, DBSETTING_SERVLIST_GROUP, 0); - wNewContactId = ppro->getSettingWord(hContact, DBSETTING_SERVLIST_ID, 0); + wNewGroupId = ppro->getWord(hContact, DBSETTING_SERVLIST_GROUP, 0); + wNewContactId = ppro->getWord(hContact, DBSETTING_SERVLIST_ID, 0); currentAction = ACTION_REMOVEBUDDY; currentSequence = sendUploadBuddy(ppro, hContact, ICQ_LISTS_REMOVEFROMLIST, dwUin, szUid, wNewContactId, wNewGroupId, SSI_ITEM_BUDDY); @@ -655,7 +655,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg,UINT message,WPARAM wPara } else if (bUidOk && isChecked) { // the contact is and should be on server, check if it is in correct group, move otherwise - WORD wCurrentGroupId = ppro->getSettingWord(hContact, DBSETTING_SERVLIST_GROUP, 0); + WORD wCurrentGroupId = ppro->getWord(hContact, DBSETTING_SERVLIST_GROUP, 0); pszGroup = ppro->getContactCListGroup(hContact); if (!strlennull(pszGroup)) @@ -679,8 +679,8 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg,UINT message,WPARAM wPara } if (wNewGroupId && (wNewGroupId != wCurrentGroupId)) { // we have a group the contact should be in, move it - WORD wCurrentContactId = ppro->getSettingWord(hContact, DBSETTING_SERVLIST_ID, 0); - BYTE bAuth = ppro->getSettingByte(hContact, "Auth", 0); + WORD wCurrentContactId = ppro->getWord(hContact, DBSETTING_SERVLIST_ID, 0); + BYTE bAuth = ppro->getByte(hContact, "Auth", 0); pszNick = ppro->getSettingStringUtf(hContact, "CList", "MyHandle", NULL); @@ -725,10 +725,10 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg,UINT message,WPARAM wPara while (hContact) { - WORD wApparentMode = ppro->getSettingWord(hContact, "ApparentMode", 0); - WORD wDenyId = ppro->getSettingWord(hContact, DBSETTING_SERVLIST_DENY, 0); - WORD wPermitId = ppro->getSettingWord(hContact, DBSETTING_SERVLIST_PERMIT, 0); - WORD wIgnoreId = ppro->getSettingWord(hContact, DBSETTING_SERVLIST_IGNORE, 0); + WORD wApparentMode = ppro->getWord(hContact, "ApparentMode", 0); + WORD wDenyId = ppro->getWord(hContact, DBSETTING_SERVLIST_DENY, 0); + WORD wPermitId = ppro->getWord(hContact, DBSETTING_SERVLIST_PERMIT, 0); + WORD wIgnoreId = ppro->getWord(hContact, DBSETTING_SERVLIST_IGNORE, 0); hCurrentContact = hContact; ppro->getContactUid(hContact, &dwUin, &szUid); diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index 59da80a08d..9f6222bf8e 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -47,7 +47,7 @@ BYTE CIcqProto::getContactXStatus(HANDLE hContact) if (!m_bXStatusEnabled && !m_bMoodsEnabled) return 0; - BYTE bXStatus = getSettingByte(hContact, DBSETTING_XSTATUS_ID, 0); + BYTE bXStatus = getByte(hContact, DBSETTING_XSTATUS_ID, 0); return (bXStatus < 1 || bXStatus > XSTATUS_COUNT) ? 0 : bXStatus; } @@ -426,9 +426,9 @@ void CIcqProto::handleXStatusCaps(DWORD dwUIN, char *szUID, HANDLE hContact, BYT // only write default name when it is really needed, i.e. on Custom Status change if (nOldXStatusID != bXStatusId) { - setSettingByte(hContact, DBSETTING_XSTATUS_ID, bXStatusId); - setSettingStringUtf(hContact, DBSETTING_XSTATUS_NAME, ICQTranslateUtfStatic(nameXStatus[i], str, MAX_PATH)); - deleteSetting(hContact, DBSETTING_XSTATUS_MSG); + setByte(hContact, DBSETTING_XSTATUS_ID, bXStatusId); + db_set_utf(hContact, m_szModuleName, DBSETTING_XSTATUS_NAME, ICQTranslateUtfStatic(nameXStatus[i], str, MAX_PATH)); + db_unset(hContact, m_szModuleName, DBSETTING_XSTATUS_MSG); NetLog_Server("%s changed mood to %s.", strUID(dwUIN, szUID), ICQTranslateUtfStatic(nameXStatus[i], str, MAX_PATH)); bChanged = TRUE; @@ -459,15 +459,15 @@ void CIcqProto::handleXStatusCaps(DWORD dwUIN, char *szUID, HANDLE hContact, BYT // only write default name when it is really needed, i.e. on Custom Status change if (nMoodID == 0 && nOldXStatusID != bXStatusId) { - setSettingByte(hContact, DBSETTING_XSTATUS_ID, bXStatusId); - setSettingStringUtf(hContact, DBSETTING_XSTATUS_NAME, ICQTranslateUtfStatic(nameXStatus[i], str, MAX_PATH)); - deleteSetting(hContact, DBSETTING_XSTATUS_MSG); + setByte(hContact, DBSETTING_XSTATUS_ID, bXStatusId); + db_set_utf(hContact, m_szModuleName, DBSETTING_XSTATUS_NAME, ICQTranslateUtfStatic(nameXStatus[i], str, MAX_PATH)); + db_unset(hContact, m_szModuleName, DBSETTING_XSTATUS_MSG); NetLog_Server("%s changed custom status to %s.", strUID(dwUIN, szUID), ICQTranslateUtfStatic(nameXStatus[i], str, MAX_PATH)); bChanged = TRUE; } - if (getSettingByte(NULL, "XStatusAuto", DEFAULT_XSTATUS_AUTO)) + if (getByte("XStatusAuto", DEFAULT_XSTATUS_AUTO)) requestXStatusDetails(hContact, TRUE); nCustomStatusID = bXStatusId; @@ -484,11 +484,11 @@ void CIcqProto::handleXStatusCaps(DWORD dwUIN, char *szUID, HANDLE hContact, BYT NetLog_Server("Warning: Diverse custom statuses detected, using mood status."); if ((nCustomStatusID == 0 && (caps || !m_bXStatusEnabled)) && (nMoodID == 0 && (moods || !m_bMoodsEnabled))) { - if (getSettingByte(hContact, DBSETTING_XSTATUS_ID, -1) != -1) + if (getByte(hContact, DBSETTING_XSTATUS_ID, -1) != -1) bChanged = TRUE; - deleteSetting(hContact, DBSETTING_XSTATUS_ID); - deleteSetting(hContact, DBSETTING_XSTATUS_NAME); - deleteSetting(hContact, DBSETTING_XSTATUS_MSG); + db_unset(hContact, m_szModuleName, DBSETTING_XSTATUS_ID); + db_unset(hContact, m_szModuleName, DBSETTING_XSTATUS_NAME); + db_unset(hContact, m_szModuleName, DBSETTING_XSTATUS_MSG); } if (m_bXStatusEnabled != 10 && m_bMoodsEnabled != 10) @@ -664,7 +664,7 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara SendMessage(GetDlgItem(hwndDlg, IDC_XTITLE), EM_SETREADONLY, 1, 0); SendMessage(GetDlgItem(hwndDlg, IDC_XMSG), EM_SETREADONLY, 1, 0); - if (dat->ppro->CheckContactCapabilities(dat->hContact, CAPF_XSTATUS) && !dat->ppro->getSettingByte(NULL, "XStatusAuto", DEFAULT_XSTATUS_AUTO)) { + if (dat->ppro->CheckContactCapabilities(dat->hContact, CAPF_XSTATUS) && !dat->ppro->getByte("XStatusAuto", DEFAULT_XSTATUS_AUTO)) { SetDlgItemTextUtf(hwndDlg,IDOK,ICQTranslateUtfStatic(LPGEN("Cancel"), str, MAX_PATH)); dat->hEvent = HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_PROTOACK); ShowDlgItem(hwndDlg, IDC_RETRXSTATUS, SW_SHOW); @@ -739,18 +739,18 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara if (!dat->bAction) { // set our xStatus char szSetting[64]; - dat->ppro->setSettingByte(NULL, DBSETTING_XSTATUS_ID, dat->bXStatus); + dat->ppro->setByte(DBSETTING_XSTATUS_ID, dat->bXStatus); char *szValue = GetDlgItemTextUtf(hwndDlg,IDC_XMSG); null_snprintf(szSetting, 64, "XStatus%dMsg", dat->bXStatus); - dat->ppro->setSettingStringUtf(NULL, szSetting, szValue); - dat->ppro->setSettingStringUtf(NULL, DBSETTING_XSTATUS_MSG, szValue); + db_set_utf(NULL, dat->ppro->m_szModuleName, szSetting, szValue); + db_set_utf(NULL, dat->ppro->m_szModuleName, DBSETTING_XSTATUS_MSG, szValue); SAFE_FREE(&szValue); if (dat->ppro->m_bXStatusEnabled) { szValue = GetDlgItemTextUtf(hwndDlg,IDC_XTITLE); null_snprintf(szSetting, 64, "XStatus%dName", dat->bXStatus); - dat->ppro->setSettingStringUtf(NULL, szSetting, szValue); - dat->ppro->setSettingStringUtf(NULL, DBSETTING_XSTATUS_NAME, szValue); + db_set_utf(NULL, dat->ppro->m_szModuleName, szSetting, szValue); + db_set_utf(NULL, dat->ppro->m_szModuleName, DBSETTING_XSTATUS_NAME, szValue); SAFE_FREE(&szValue); if (dat->bXStatus) { @@ -775,7 +775,7 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara void CIcqProto::setXStatusEx(BYTE bXStatus, BYTE bQuiet) { - BYTE bOldXStatus = getSettingByte(NULL, DBSETTING_XSTATUS_ID, 0); + BYTE bOldXStatus = getByte(DBSETTING_XSTATUS_ID, 0); if (!m_bHideXStatusUI) { CLISTMENUITEM mi = { sizeof(mi) }; @@ -801,7 +801,7 @@ void CIcqProto::setXStatusEx(BYTE bXStatus, BYTE bQuiet) szMsg = getSettingStringUtf(NULL, szSetting, ""); null_snprintf(szSetting, 64, "XStatus%dStat", bXStatus); - if (!bQuiet && !getSettingByte(NULL, szSetting, 0)) { + if (!bQuiet && !getByte(szSetting, 0)) { InitXStatusData init; init.ppro = this; init.bAction = 0; // set @@ -811,10 +811,10 @@ void CIcqProto::setXStatusEx(BYTE bXStatus, BYTE bQuiet) CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SETXSTATUS), NULL, SetXStatusDlgProc, (LPARAM)&init); } else { - setSettingByte(NULL, DBSETTING_XSTATUS_ID, bXStatus); + setByte(DBSETTING_XSTATUS_ID, bXStatus); if (m_bXStatusEnabled) - setSettingStringUtf(NULL, DBSETTING_XSTATUS_NAME, szName); - setSettingStringUtf(NULL, DBSETTING_XSTATUS_MSG, szMsg); + db_set_utf(NULL, m_szModuleName, DBSETTING_XSTATUS_NAME, szName); + db_set_utf(NULL, m_szModuleName, DBSETTING_XSTATUS_MSG, szMsg); updateServerCustomStatus(TRUE); } @@ -822,9 +822,9 @@ void CIcqProto::setXStatusEx(BYTE bXStatus, BYTE bQuiet) SAFE_FREE(&szMsg); } else { - setSettingByte(NULL, DBSETTING_XSTATUS_ID, bXStatus); - deleteSetting(NULL, DBSETTING_XSTATUS_NAME); - deleteSetting(NULL, DBSETTING_XSTATUS_MSG); + setByte(DBSETTING_XSTATUS_ID, bXStatus); + db_unset(NULL, m_szModuleName, DBSETTING_XSTATUS_NAME); + db_unset(NULL, m_szModuleName, DBSETTING_XSTATUS_MSG); updateServerCustomStatus(TRUE); } @@ -942,15 +942,15 @@ INT_PTR CIcqProto::SetXStatusEx(WPARAM wParam, LPARAM lParam) if (m_bXStatusEnabled && (pData->flags & CSSF_MASK_NAME)) { // set custom status name if (pData->flags & CSSF_UNICODE) - setSettingStringW(NULL, DBSETTING_XSTATUS_NAME, pData->pwszName); + setTString(DBSETTING_XSTATUS_NAME, pData->pwszName); else - setSettingString(NULL, DBSETTING_XSTATUS_NAME, pData->pszName); + setString(DBSETTING_XSTATUS_NAME, pData->pszName); } if (pData->flags & CSSF_MASK_MESSAGE) { // set custom status message if (pData->flags & CSSF_UNICODE) - setSettingStringW(NULL, DBSETTING_XSTATUS_MSG, pData->pwszMessage); + setTString(DBSETTING_XSTATUS_MSG, pData->pwszMessage); else - setSettingString(NULL, DBSETTING_XSTATUS_MSG, pData->pszMessage); + setString(DBSETTING_XSTATUS_MSG, pData->pszMessage); // update status note if used for custom status message updateServerCustomStatus(FALSE); @@ -1007,7 +1007,7 @@ INT_PTR CIcqProto::GetXStatusEx(WPARAM wParam, LPARAM lParam) } else { DBVARIANT dbv; - if ( !getSettingString(hContact, DBSETTING_XSTATUS_NAME, &dbv) && dbv.pszVal) { + if ( !getString(hContact, DBSETTING_XSTATUS_NAME, &dbv) && dbv.pszVal) { strcpy(pData->pszName, dbv.pszVal); db_free(&dbv); } @@ -1028,7 +1028,7 @@ INT_PTR CIcqProto::GetXStatusEx(WPARAM wParam, LPARAM lParam) else { DBVARIANT dbv = {0}; - if (!getSettingString(hContact, CheckContactCapabilities(hContact, CAPF_STATUS_MOOD) ? DBSETTING_STATUS_NOTE : DBSETTING_XSTATUS_MSG, &dbv) && dbv.pszVal) + if (!getString(hContact, CheckContactCapabilities(hContact, CAPF_STATUS_MOOD) ? DBSETTING_STATUS_NOTE : DBSETTING_XSTATUS_MSG, &dbv) && dbv.pszVal) strcpy(pData->pszMessage, dbv.pszVal); else strcpy(pData->pszMessage, ""); @@ -1053,7 +1053,7 @@ INT_PTR CIcqProto::GetXStatusEx(WPARAM wParam, LPARAM lParam) DBVARIANT dbv = {DBVT_DELETED}; if (pData->wParam) { - if (m_bXStatusEnabled && !getSettingString(hContact, DBSETTING_XSTATUS_NAME, &dbv)) + if (m_bXStatusEnabled && !getString(hContact, DBSETTING_XSTATUS_NAME, &dbv)) *pData->wParam = strlennull(dbv.pszVal); else *pData->wParam = 0; @@ -1061,7 +1061,7 @@ INT_PTR CIcqProto::GetXStatusEx(WPARAM wParam, LPARAM lParam) } if (pData->lParam) { - if (!getSettingString(hContact, CheckContactCapabilities(hContact, CAPF_STATUS_MOOD) ? DBSETTING_STATUS_NOTE : DBSETTING_XSTATUS_MSG, &dbv)) + if (!getString(hContact, CheckContactCapabilities(hContact, CAPF_STATUS_MOOD) ? DBSETTING_STATUS_NOTE : DBSETTING_XSTATUS_MSG, &dbv)) *pData->lParam = strlennull(dbv.pszVal); else *pData->lParam = 0; @@ -1094,7 +1094,7 @@ INT_PTR CIcqProto::RequestXStatusDetails(WPARAM wParam, LPARAM lParam) return 0; // user has xstatus, no auto-retrieve details, valid contact, request details - if (hContact && !getSettingByte(NULL, "XStatusAuto", DEFAULT_XSTATUS_AUTO) && getContactXStatus(hContact) && CheckContactCapabilities(hContact, CAPF_XSTATUS)) + if (hContact && !getByte("XStatusAuto", DEFAULT_XSTATUS_AUTO) && getContactXStatus(hContact) && CheckContactCapabilities(hContact, CAPF_XSTATUS)) return requestXStatusDetails(hContact, TRUE); return 0; diff --git a/protocols/IcqOscarJ/src/icq_xtraz.cpp b/protocols/IcqOscarJ/src/icq_xtraz.cpp index c616dffd0e..6a746c2e57 100644 --- a/protocols/IcqOscarJ/src/icq_xtraz.cpp +++ b/protocols/IcqOscarJ/src/icq_xtraz.cpp @@ -245,7 +245,7 @@ NextVal: if (strcmpnull(szOldXName, szXName)) bChanged = TRUE; SAFE_FREE(&szOldXName); - setSettingStringUtf(hContact, DBSETTING_XSTATUS_NAME, szXName); + db_set_utf(hContact, m_szModuleName, DBSETTING_XSTATUS_NAME, szXName); SAFE_FREE(&szXName); *szEnd = ' '; } @@ -262,7 +262,7 @@ NextVal: if (strcmpnull(szOldXMsg, szXMsg)) bChanged = TRUE; SAFE_FREE(&szOldXMsg); - setSettingStringUtf(hContact, DBSETTING_XSTATUS_MSG, szXMsg); + db_set_utf(hContact, m_szModuleName, DBSETTING_XSTATUS_MSG, szXMsg); SAFE_FREE(&szXMsg); } ProtoBroadcastAck(hContact, ICQACKTYPE_XSTATUS_RESPONSE, ACKRESULT_SUCCESS, (HANDLE)wCookie, 0); diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp index 100312d45b..1bb0b08f11 100644 --- a/protocols/IcqOscarJ/src/icqosc_svcs.cpp +++ b/protocols/IcqOscarJ/src/icqosc_svcs.cpp @@ -38,7 +38,7 @@ INT_PTR CIcqProto::AddServerContact(WPARAM wParam, LPARAM lParam) if (!m_bSsiEnabled) return 0; // Does this contact have a UID? - if (!getContactUid((HANDLE)wParam, &dwUin, &szUid) && !getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_ID, 0) && !getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_IGNORE, 0)) + if (!getContactUid((HANDLE)wParam, &dwUin, &szUid) && !getWord((HANDLE)wParam, DBSETTING_SERVLIST_ID, 0) && !getWord((HANDLE)wParam, DBSETTING_SERVLIST_IGNORE, 0)) { /// TODO: remove possible 0x6A TLV in contact server-list data!!! // Read group from DB char *pszGroup = getContactCListGroup((HANDLE)wParam); @@ -194,7 +194,7 @@ INT_PTR CIcqProto::ChangeInfoEx(WPARAM wParam, LPARAM lParam) nItems += ppackTLVWordStringItemFromDB(&pBlock, &cbBlock, "CompanyFax", 0x6E, 0x64, 0x05); ppackTLVBlockItems(&buf, &buflen, 0xC8, &nItems, &pBlock, (WORD*)&cbBlock, FALSE); - ppackTLVByte(&buf, &buflen, 0x1EA, getSettingByte(NULL, "AllowSpam", 0)); + ppackTLVByte(&buf, &buflen, 0x1EA, getByte("AllowSpam", 0)); } if (wParam & CIXT_BASIC) @@ -207,16 +207,16 @@ INT_PTR CIcqProto::ChangeInfoEx(WPARAM wParam, LPARAM lParam) if (wParam & CIXT_MORE) { - b = getSettingByte(NULL, "Gender", 0); + b = getByte("Gender", 0); ppackTLVByte(&buf, &buflen, 0x82, (BYTE)(b ? (b == 'M' ? 2 : 1) : 0)); ppackTLVDateFromDB(&buf, &buflen, "BirthYear", "BirthMonth", "BirthDay", 0x1A4); - ppackTLVWord(&buf, &buflen, 0xAA, getSettingByte(NULL, "Language1", 0)); - ppackTLVWord(&buf, &buflen, 0xB4, getSettingByte(NULL, "Language2", 0)); - ppackTLVWord(&buf, &buflen, 0xBE, getSettingByte(NULL, "Language3", 0)); + ppackTLVWord(&buf, &buflen, 0xAA, getByte("Language1", 0)); + ppackTLVWord(&buf, &buflen, 0xB4, getByte("Language2", 0)); + ppackTLVWord(&buf, &buflen, 0xBE, getByte("Language3", 0)); - ppackTLVWord(&buf, &buflen, 0x12C, getSettingByte(NULL, "MaritalStatus", 0)); + ppackTLVWord(&buf, &buflen, 0x12C, getByte("MaritalStatus", 0)); } if (wParam & CIXT_WORK) @@ -230,16 +230,16 @@ INT_PTR CIcqProto::ChangeInfoEx(WPARAM wParam, LPARAM lParam) ppackTLVStringUtfFromDB(&pBlock, &cbBlock, "Company", 0x6E); ppackTLVStringUtfFromDB(&pBlock, &cbBlock, "CompanyDepartment", 0x7D); ppackTLVStringFromDB(&pBlock, &cbBlock, "CompanyHomepage", 0x78); - ppackTLVWord(&pBlock, &cbBlock, 0x82, getSettingWord(NULL, "CompanyIndustry", 0)); + ppackTLVWord(&pBlock, &cbBlock, 0x82, getWord("CompanyIndustry", 0)); ppackTLVStringUtfFromDB(&pBlock, &cbBlock, "CompanyStreet", 0xAA); ppackTLVStringUtfFromDB(&pBlock, &cbBlock, "CompanyCity", 0xB4); ppackTLVStringUtfFromDB(&pBlock, &cbBlock, "CompanyState", 0xBE); ppackTLVStringUtfFromDB(&pBlock, &cbBlock, "CompanyZIP", 0xC8); - ppackTLVDWord(&pBlock, &cbBlock, 0xD2, getSettingWord(NULL, "CompanyCountry", 0)); + ppackTLVDWord(&pBlock, &cbBlock, 0xD2, getWord("CompanyCountry", 0)); /// TODO: pack unknown data (need to preserve them in Block Items) ppackTLVBlockItems(&buf, &buflen, 0x118, &nItems, &pBlock, (WORD*)&cbBlock, TRUE); - // ppackTLVWord(&buf, &buflen, getSettingWord(NULL, "CompanyOccupation", 0), TLV_OCUPATION, 1); // Lost In Conversion + // ppackTLVWord(&buf, &buflen, getWord("CompanyOccupation", 0), TLV_OCUPATION, 1); // Lost In Conversion } if (wParam & CIXT_EDUCATION) @@ -249,10 +249,10 @@ INT_PTR CIcqProto::ChangeInfoEx(WPARAM wParam, LPARAM lParam) int nItems = 1; // Studies - ppackTLVWord(&pBlock, &cbBlock, 0x64, getSettingWord(NULL, "StudyLevel", 0)); + ppackTLVWord(&pBlock, &cbBlock, 0x64, getWord("StudyLevel", 0)); ppackTLVStringUtfFromDB(&pBlock, &cbBlock, "StudyInstitute", 0x6E); ppackTLVStringUtfFromDB(&pBlock, &cbBlock, "StudyDegree", 0x78); - ppackTLVWord(&pBlock, &cbBlock, 0x8C, getSettingWord(NULL, "StudyYear", 0)); + ppackTLVWord(&pBlock, &cbBlock, 0x8C, getWord("StudyYear", 0)); ppackTLVBlockItems(&buf, &buflen, 0x10E, &nItems, &pBlock, (WORD*)&cbBlock, TRUE); } @@ -267,7 +267,7 @@ INT_PTR CIcqProto::ChangeInfoEx(WPARAM wParam, LPARAM lParam) ppackTLVStringUtfFromDB(&pBlock, &cbBlock, "City", 0x6E); ppackTLVStringUtfFromDB(&pBlock, &cbBlock, "State", 0x78); ppackTLVStringUtfFromDB(&pBlock, &cbBlock, "ZIP", 0x82); - ppackTLVDWord(&pBlock, &cbBlock, 0x8C, getSettingWord(NULL, "Country", 0)); + ppackTLVDWord(&pBlock, &cbBlock, 0x8C, getWord("Country", 0)); ppackTLVBlockItems(&buf, &buflen, 0x96, &nItems, &pBlock, (WORD*)&cbBlock, TRUE); nItems = 1; @@ -275,13 +275,13 @@ INT_PTR CIcqProto::ChangeInfoEx(WPARAM wParam, LPARAM lParam) ppackTLVStringUtfFromDB(&pBlock, &cbBlock, "OriginStreet", 0x64); ppackTLVStringUtfFromDB(&pBlock, &cbBlock, "OriginCity", 0x6E); ppackTLVStringUtfFromDB(&pBlock, &cbBlock, "OriginState", 0x78); - ppackTLVDWord(&pBlock, &cbBlock, 0x8C, getSettingWord(NULL, "OriginCountry", 0)); + ppackTLVDWord(&pBlock, &cbBlock, 0x8C, getWord("OriginCountry", 0)); ppackTLVBlockItems(&buf, &buflen, 0xA0, &nItems, &pBlock, (WORD*)&cbBlock, TRUE); ppackTLVStringFromDB(&buf, &buflen, "Homepage", 0xFA); // Timezone - WORD wTimezone = getSettingByte(NULL, "Timezone", 0); + WORD wTimezone = getByte("Timezone", 0); if ((wTimezone & 0x0080) == 0x80) wTimezone |= 0xFF00; // extend signed number ppackTLVWord(&buf, &buflen, 0x17C, wTimezone); } @@ -293,10 +293,10 @@ INT_PTR CIcqProto::ChangeInfoEx(WPARAM wParam, LPARAM lParam) int nItems = 0; // Interests - nItems += ppackTLVWordStringUtfItemFromDB(&pBlock, &cbBlock, "Interest0Text", 0x6E, 0x64, getSettingWord(NULL, "Interest0Cat", 0)); - nItems += ppackTLVWordStringUtfItemFromDB(&pBlock, &cbBlock, "Interest1Text", 0x6E, 0x64, getSettingWord(NULL, "Interest1Cat", 0)); - nItems += ppackTLVWordStringUtfItemFromDB(&pBlock, &cbBlock, "Interest2Text", 0x6E, 0x64, getSettingWord(NULL, "Interest2Cat", 0)); - nItems += ppackTLVWordStringUtfItemFromDB(&pBlock, &cbBlock, "Interest3Text", 0x6E, 0x64, getSettingWord(NULL, "Interest3Cat", 0)); + nItems += ppackTLVWordStringUtfItemFromDB(&pBlock, &cbBlock, "Interest0Text", 0x6E, 0x64, getWord("Interest0Cat", 0)); + nItems += ppackTLVWordStringUtfItemFromDB(&pBlock, &cbBlock, "Interest1Text", 0x6E, 0x64, getWord("Interest1Cat", 0)); + nItems += ppackTLVWordStringUtfItemFromDB(&pBlock, &cbBlock, "Interest2Text", 0x6E, 0x64, getWord("Interest2Cat", 0)); + nItems += ppackTLVWordStringUtfItemFromDB(&pBlock, &cbBlock, "Interest3Text", 0x6E, 0x64, getWord("Interest3Cat", 0)); ppackTLVBlockItems(&buf, &buflen, 0x122, &nItems, &pBlock, (WORD*)&cbBlock, FALSE); @@ -401,7 +401,7 @@ INT_PTR CIcqProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) return GAIR_NOAVATAR; // we do not support avatars for invalid contacts } - int dwPaFormat = getSettingByte(pai->hContact, "AvatarType", PA_FORMAT_UNKNOWN); + int dwPaFormat = getByte(pai->hContact, "AvatarType", PA_FORMAT_UNKNOWN); if (dwPaFormat != PA_FORMAT_UNKNOWN) { // we know the format, test file @@ -476,7 +476,7 @@ INT_PTR CIcqProto::GrantAuthorization(WPARAM wParam, LPARAM lParam) // send without reason, do we need any ? icq_sendGrantAuthServ(dwUin, szUid, NULL); // auth granted, remove contact menu item - deleteSetting((HANDLE)wParam, "Grant"); + db_unset((HANDLE)wParam, m_szModuleName, "Grant"); } return 0; @@ -489,7 +489,7 @@ int CIcqProto::OnIdleChanged(WPARAM wParam, LPARAM lParam) if (bPrivacy) return 0; - setSettingDword(NULL, "IdleTS", bIdle ? time(0) : 0); + setDword("IdleTS", bIdle ? time(0) : 0); if (m_bTempVisListEnabled) // remove temporary visible users sendEntireListServ(ICQ_BOS_FAMILY, ICQ_CLI_REMOVETEMPVISIBLE, BUL_TEMPVISIBLE); @@ -607,7 +607,7 @@ INT_PTR CIcqProto::SetMyAvatar(WPARAM wParam, LPARAM lParam) } else { // delete user avatar - deleteSetting(NULL, "AvatarFile"); + db_unset(NULL, m_szModuleName, "AvatarFile"); setSettingBlob(NULL, "AvatarHash", hashEmptyAvatar, 9); updateServAvatarHash(hashEmptyAvatar, 9); // set blank avatar iRet = 0; @@ -622,9 +622,9 @@ INT_PTR CIcqProto::SetNickName(WPARAM wParam, LPARAM lParam) return 0; // failure if (wParam & SMNN_UNICODE) - setSettingStringW(NULL, "Nick", (WCHAR*)lParam); + setTString("Nick", (WCHAR*)lParam); else - setSettingString(NULL, "Nick", (char*)lParam); + setString("Nick", (char*)lParam); return ChangeInfoEx(CIXT_BASIC, 0); } @@ -701,7 +701,7 @@ void CIcqProto::ICQAddRecvEvent(HANDLE hContact, WORD wType, PROTORECVEVENT* pre //setContactHidden(hContact, 0); // if the contact was hidden, add to client-list if not in server-list authed - if (!getSettingWord(hContact, DBSETTING_SERVLIST_ID, 0) || getSettingByte(hContact, "Auth", 0)) + if (!getWord(hContact, DBSETTING_SERVLIST_ID, 0) || getByte(hContact, "Auth", 0)) { getContactUid(hContact, &dwUin, &szUid); icq_sendNewContact(dwUin, szUid); /// FIXME diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp index fd428c02ed..a23b01554e 100644 --- a/protocols/IcqOscarJ/src/init.cpp +++ b/protocols/IcqOscarJ/src/init.cpp @@ -140,14 +140,14 @@ void CIcqProto::UpdateGlobalSettings() char szServer[MAX_PATH] = ""; getSettingStringStatic(NULL, "OscarServer", szServer, MAX_PATH); - m_bSecureConnection = getSettingByte(NULL, "SecureConnection", DEFAULT_SECURE_CONNECTION); + m_bSecureConnection = getByte("SecureConnection", DEFAULT_SECURE_CONNECTION); if (szServer[0]) { if (strstr(szServer, "aol.com")) - setSettingString(NULL, "OscarServer", m_bSecureConnection ? DEFAULT_SERVER_HOST_SSL : DEFAULT_SERVER_HOST); + setString("OscarServer", m_bSecureConnection ? DEFAULT_SERVER_HOST_SSL : DEFAULT_SERVER_HOST); if (m_bSecureConnection && !_strnicmp(szServer, "login.", 6)) { - setSettingString(NULL, "OscarServer", DEFAULT_SERVER_HOST_SSL); - setSettingWord(NULL, "OscarPort", DEFAULT_SERVER_PORT_SSL); + setString("OscarServer", DEFAULT_SERVER_HOST_SSL); + setWord("OscarPort", DEFAULT_SERVER_PORT_SSL); } } @@ -162,16 +162,16 @@ void CIcqProto::UpdateGlobalSettings() else m_bGatewayMode = 0; } - m_bSecureLogin = getSettingByte(NULL, "SecureLogin", DEFAULT_SECURE_LOGIN); - m_bLegacyFix = getSettingByte(NULL, "LegacyFix", DEFAULT_LEGACY_FIX); - m_bAimEnabled = getSettingByte(NULL, "AimEnabled", DEFAULT_AIM_ENABLED); - m_bUtfEnabled = getSettingByte(NULL, "UtfEnabled", DEFAULT_UTF_ENABLED); - m_wAnsiCodepage = getSettingWord(NULL, "AnsiCodePage", DEFAULT_ANSI_CODEPAGE); - m_bDCMsgEnabled = getSettingByte(NULL, "DirectMessaging", DEFAULT_DCMSG_ENABLED); - m_bTempVisListEnabled = getSettingByte(NULL, "TempVisListEnabled", DEFAULT_TEMPVIS_ENABLED); - m_bSsiEnabled = getSettingByte(NULL, "UseServerCList", DEFAULT_SS_ENABLED); + m_bSecureLogin = getByte("SecureLogin", DEFAULT_SECURE_LOGIN); + m_bLegacyFix = getByte("LegacyFix", DEFAULT_LEGACY_FIX); + m_bAimEnabled = getByte("AimEnabled", DEFAULT_AIM_ENABLED); + m_bUtfEnabled = getByte("UtfEnabled", DEFAULT_UTF_ENABLED); + m_wAnsiCodepage = getWord("AnsiCodePage", DEFAULT_ANSI_CODEPAGE); + m_bDCMsgEnabled = getByte("DirectMessaging", DEFAULT_DCMSG_ENABLED); + m_bTempVisListEnabled = getByte("TempVisListEnabled", DEFAULT_TEMPVIS_ENABLED); + m_bSsiEnabled = getByte("UseServerCList", DEFAULT_SS_ENABLED); m_bSsiSimpleGroups = FALSE; /// TODO: enable, after server-list revolution is over - m_bAvatarsEnabled = getSettingByte(NULL, "AvatarsEnabled", DEFAULT_AVATARS_ENABLED); - m_bXStatusEnabled = getSettingByte(NULL, "XStatusEnabled", DEFAULT_XSTATUS_ENABLED); - m_bMoodsEnabled = getSettingByte(NULL, "MoodsEnabled", DEFAULT_MOODS_ENABLED); + m_bAvatarsEnabled = getByte("AvatarsEnabled", DEFAULT_AVATARS_ENABLED); + m_bXStatusEnabled = getByte("XStatusEnabled", DEFAULT_XSTATUS_ENABLED); + m_bMoodsEnabled = getByte("MoodsEnabled", DEFAULT_MOODS_ENABLED); } diff --git a/protocols/IcqOscarJ/src/log.cpp b/protocols/IcqOscarJ/src/log.cpp index 881fe82cba..38857473a5 100644 --- a/protocols/IcqOscarJ/src/log.cpp +++ b/protocols/IcqOscarJ/src/log.cpp @@ -46,7 +46,7 @@ void __cdecl CIcqProto::icq_LogMessageThread(void* arg) if (!err) return; - if (bPopupService && getSettingByte(NULL, "PopupsLogEnabled", DEFAULT_LOG_POPUPS_ENABLED)) + if (bPopupService && getByte("PopupsLogEnabled", DEFAULT_LOG_POPUPS_ENABLED)) { ShowPopupMsg(NULL, err->szTitle, err->szMsg, err->bLevel); @@ -69,10 +69,10 @@ void CIcqProto::icq_LogMessage(int level, const char *szMsg) { NetLog_Server("%s", szMsg); - int displayLevel = getSettingByte(NULL, "ShowLogLevel", LOG_WARNING); + int displayLevel = getByte("ShowLogLevel", LOG_WARNING); if (level >= displayLevel) { - if (!bErrorBoxVisible || !getSettingByte(NULL, "IgnoreMultiErrorBox", 0)) + if (!bErrorBoxVisible || !getByte("IgnoreMultiErrorBox", 0)) { // error not shown or allowed multi - show messagebox LogMessageInfo *lmi = (LogMessageInfo*)SAFE_MALLOC(sizeof(LogMessageInfo)); diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index b0f42a826d..15b85bb475 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -981,7 +981,7 @@ HANDLE CIcqProto::oftInitTransfer(HANDLE hContact, DWORD dwUin, char* szUid, con // Send packet if (ft->listener) { - oft_sendFileRequest(dwUin, szUid, ft, pszFiles, getSettingDword(NULL, "RealIP", 0)); + oft_sendFileRequest(dwUin, szUid, ft, pszFiles, getDword("RealIP", 0)); } else { // try stage 1 proxy @@ -1253,7 +1253,7 @@ int CIcqProto::CreateOscarProxyConnection(oscar_connection *oc) ProtoBroadcastAck(oc->ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTPROXY, oc->ft, 0); nloc.szHost = OSCAR_PROXY_HOST; - nloc.wPort = getSettingWord(NULL, "OscarPort", m_bSecureConnection ? DEFAULT_SERVER_PORT_SSL : DEFAULT_SERVER_PORT); + nloc.wPort = getWord("OscarPort", m_bSecureConnection ? DEFAULT_SERVER_PORT_SSL : DEFAULT_SERVER_PORT); if (nloc.wPort == 0) nloc.wPort = RandRange(1024, 65535); if (m_bGatewayMode) @@ -1316,8 +1316,8 @@ void __cdecl CIcqProto::oft_connectionThread( oscarthreadstartinfo *otsi ) } // Load local IP information - oc.dwLocalExternalIP = getSettingDword(NULL, "IP", 0); - oc.dwLocalInternalIP = getSettingDword(NULL, "RealIP", 0); + oc.dwLocalExternalIP = getDword("IP", 0); + oc.dwLocalInternalIP = getDword("RealIP", 0); if (!oc.incoming) { // create outgoing connection @@ -1428,7 +1428,7 @@ void __cdecl CIcqProto::oft_connectionThread( oscarthreadstartinfo *otsi ) addr.S_un.S_addr = htonl(oc.ft->dwProxyIP); nloc.szHost = inet_ntoa(addr); - nloc.wPort = getSettingWord(NULL, "OscarPort", m_bSecureConnection ? DEFAULT_SERVER_PORT_SSL : DEFAULT_SERVER_PORT); + nloc.wPort = getWord("OscarPort", m_bSecureConnection ? DEFAULT_SERVER_PORT_SSL : DEFAULT_SERVER_PORT); if (nloc.wPort == 0) nloc.wPort = RandRange(1024, 65535); if (m_bGatewayMode) diff --git a/protocols/IcqOscarJ/src/stdpackets.cpp b/protocols/IcqOscarJ/src/stdpackets.cpp index c90244bdc3..9aaa159ec9 100644 --- a/protocols/IcqOscarJ/src/stdpackets.cpp +++ b/protocols/IcqOscarJ/src/stdpackets.cpp @@ -121,7 +121,7 @@ static void packServTLV2711Header(icq_packet *packet, WORD wCookie, WORD wVersio static void packServDCInfo(icq_packet *p, CIcqProto* ppro, BOOL bEmpty) { - packTLVDWord(p, 0x03, bEmpty ? 0 : ppro->getSettingDword(NULL, "RealIP", 0)); // TLV: 0x03 DWORD IP + packTLVDWord(p, 0x03, bEmpty ? 0 : ppro->getDword("RealIP", 0)); // TLV: 0x03 DWORD IP packTLVWord(p, 0x05, (WORD)(bEmpty ? 0 : ppro->wListenPort)); // TLV: 0x05 Listen port } @@ -265,7 +265,7 @@ void CIcqProto::icq_setstatus(WORD wStatus, const char *szStatusNote) { // status note was changed, update now DBVARIANT dbv = {DBVT_DELETED}; - if (m_bMoodsEnabled && !getSettingString(NULL, DBSETTING_STATUS_MOOD, &dbv)) + if (m_bMoodsEnabled && !getString(DBSETTING_STATUS_MOOD, &dbv)) szMoodData = null_strdup(dbv.pszVal); db_free(&dbv); @@ -304,7 +304,7 @@ void CIcqProto::icq_setstatus(WORD wStatus, const char *szStatusNote) packBuffer(&packet, (LPBYTE)szMoodData, wStatusMoodLen); // Mood // Save current status note - setSettingStringUtf(NULL, DBSETTING_STATUS_NOTE, szStatusNote); + db_set_utf(NULL, m_szModuleName, DBSETTING_STATUS_NOTE, szStatusNote); } // Release memory SAFE_FREE(&szMoodData); @@ -1617,7 +1617,7 @@ void CIcqProto::icq_sendChangeVisInvis(HANDLE hContact, DWORD dwUin, char* szUID if (add) { // check if we should make the changes, this is 2nd level check - if (getSettingWord(hContact, szSetting, 0) != 0) + if (getWord(hContact, szSetting, 0) != 0) return; // Add @@ -1625,18 +1625,18 @@ void CIcqProto::icq_sendChangeVisInvis(HANDLE hContact, DWORD dwUin, char* szUID icq_addServerPrivacyItem(hContact, dwUin, szUID, wContactId, wType); - setSettingWord(hContact, szSetting, wContactId); + setWord(hContact, szSetting, wContactId); } else { // Remove - wContactId = getSettingWord(hContact, szSetting, 0); + wContactId = getWord(hContact, szSetting, 0); if (wContactId) { icq_removeServerPrivacyItem(hContact, dwUin, szUID, wContactId, wType); - deleteSetting(hContact, szSetting); + db_unset(hContact, m_szModuleName, szSetting); } } } diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 99d9b690dc..b98dd5034d 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -503,14 +503,14 @@ HANDLE CIcqProto::HContactFromUIN(DWORD dwUin, int *Added) return INVALID_HANDLE_VALUE; } - setSettingDword(hContact, UNIQUEIDSETTING, dwUin); + setDword(hContact, UNIQUEIDSETTING, dwUin); if (!bIsSyncingCL) { db_set_b(hContact, "CList", "NotOnList", 1); setContactHidden(hContact, 1); - setSettingWord(hContact, "Status", ID_STATUS_OFFLINE); + setWord(hContact, "Status", ID_STATUS_OFFLINE); icq_QueueUser(hContact); @@ -555,7 +555,7 @@ HANDLE CIcqProto::HContactFromUID(DWORD dwUin, const char *szUid, int *Added) { if (strcmpnull(szContactUid, szUid)) { // fix case in SN - setSettingString(hContact, UNIQUEIDSETTING, szUid); + setString(hContact, UNIQUEIDSETTING, szUid); } return hContact; } @@ -569,14 +569,14 @@ HANDLE CIcqProto::HContactFromUID(DWORD dwUin, const char *szUid, int *Added) hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName); - setSettingString(hContact, UNIQUEIDSETTING, szUid); + setString(hContact, UNIQUEIDSETTING, szUid); if (!bIsSyncingCL) { db_set_b(hContact, "CList", "NotOnList", 1); setContactHidden(hContact, 1); - setSettingWord(hContact, "Status", ID_STATUS_OFFLINE); + setWord(hContact, "Status", ID_STATUS_OFFLINE); if (icqOnline()) icq_sendNewContact(0, szUid); @@ -959,25 +959,25 @@ char *ApplyEncoding(const char *string, const char *pszEncoding) void CIcqProto::ResetSettingsOnListReload() { // Reset a bunch of session specific settings - setSettingWord(NULL, DBSETTING_SERVLIST_PRIVACY, 0); - setSettingWord(NULL, DBSETTING_SERVLIST_METAINFO, 0); - setSettingWord(NULL, DBSETTING_SERVLIST_AVATAR, 0); - setSettingWord(NULL, DBSETTING_SERVLIST_PHOTO, 0); - setSettingWord(NULL, "SrvRecordCount", 0); - deleteSetting(NULL, DBSETTING_SERVLIST_UNHANDLED); + setWord(DBSETTING_SERVLIST_PRIVACY, 0); + setWord(DBSETTING_SERVLIST_METAINFO, 0); + setWord(DBSETTING_SERVLIST_AVATAR, 0); + setWord(DBSETTING_SERVLIST_PHOTO, 0); + setWord("SrvRecordCount", 0); + db_unset(NULL, m_szModuleName, DBSETTING_SERVLIST_UNHANDLED); HANDLE hContact = FindFirstContact(); while (hContact) { // All these values will be restored during the serv-list receive - setSettingWord(hContact, DBSETTING_SERVLIST_ID, 0); - setSettingWord(hContact, DBSETTING_SERVLIST_GROUP, 0); - setSettingWord(hContact, DBSETTING_SERVLIST_PERMIT, 0); - setSettingWord(hContact, DBSETTING_SERVLIST_DENY, 0); - deleteSetting(hContact, DBSETTING_SERVLIST_IGNORE); - setSettingByte(hContact, "Auth", 0); - deleteSetting(hContact, DBSETTING_SERVLIST_DATA); + setWord(hContact, DBSETTING_SERVLIST_ID, 0); + setWord(hContact, DBSETTING_SERVLIST_GROUP, 0); + setWord(hContact, DBSETTING_SERVLIST_PERMIT, 0); + setWord(hContact, DBSETTING_SERVLIST_DENY, 0); + db_unset(hContact, m_szModuleName, DBSETTING_SERVLIST_IGNORE); + setByte(hContact, "Auth", 0); + db_unset(hContact, m_szModuleName, DBSETTING_SERVLIST_DATA); hContact = FindNextContact(hContact); } @@ -988,21 +988,21 @@ void CIcqProto::ResetSettingsOnListReload() void CIcqProto::ResetSettingsOnConnect() { // Reset a bunch of session specific settings - setSettingByte(NULL, "SrvVisibility", 0); - setSettingDword(NULL, "IdleTS", 0); + setByte("SrvVisibility", 0); + setDword("IdleTS", 0); HANDLE hContact = FindFirstContact(); while (hContact) { - setSettingDword(hContact, "LogonTS", 0); - setSettingDword(hContact, "IdleTS", 0); - setSettingDword(hContact, "TickTS", 0); - setSettingByte(hContact, "TemporaryVisible", 0); + setDword(hContact, "LogonTS", 0); + setDword(hContact, "IdleTS", 0); + setDword(hContact, "TickTS", 0); + setByte(hContact, "TemporaryVisible", 0); // All these values will be restored during the login if (getContactStatus(hContact) != ID_STATUS_OFFLINE) - setSettingWord(hContact, "Status", ID_STATUS_OFFLINE); + setWord(hContact, "Status", ID_STATUS_OFFLINE); hContact = FindNextContact(hContact); } @@ -1010,25 +1010,25 @@ void CIcqProto::ResetSettingsOnConnect() void CIcqProto::ResetSettingsOnLoad() { - setSettingDword(NULL, "IdleTS", 0); - setSettingDword(NULL, "LogonTS", 0); + setDword("IdleTS", 0); + setDword("LogonTS", 0); HANDLE hContact = FindFirstContact(); while (hContact) { - setSettingDword(hContact, "LogonTS", 0); - setSettingDword(hContact, "IdleTS", 0); - setSettingDword(hContact, "TickTS", 0); + setDword(hContact, "LogonTS", 0); + setDword(hContact, "IdleTS", 0); + setDword(hContact, "TickTS", 0); if (getContactStatus(hContact) != ID_STATUS_OFFLINE) { - setSettingWord(hContact, "Status", ID_STATUS_OFFLINE); + setWord(hContact, "Status", ID_STATUS_OFFLINE); - deleteSetting(hContact, DBSETTING_XSTATUS_ID); - deleteSetting(hContact, DBSETTING_XSTATUS_NAME); - deleteSetting(hContact, DBSETTING_XSTATUS_MSG); + db_unset(hContact, m_szModuleName, DBSETTING_XSTATUS_ID); + db_unset(hContact, m_szModuleName, DBSETTING_XSTATUS_NAME); + db_unset(hContact, m_szModuleName, DBSETTING_XSTATUS_MSG); } - setSettingByte(hContact, "DCStatus", 0); + setByte(hContact, "DCStatus", 0); hContact = FindNextContact(hContact); } @@ -1221,7 +1221,7 @@ void __cdecl CIcqProto::SetStatusNoteThread(void *pDelay) char *szCurrentStatusMood = NULL; DBVARIANT dbv = {DBVT_DELETED}; - if (m_bMoodsEnabled && !getSettingString(NULL, DBSETTING_STATUS_MOOD, &dbv)) + if (m_bMoodsEnabled && !getString(DBSETTING_STATUS_MOOD, &dbv)) szCurrentStatusMood = dbv.pszVal; if (!setStatusNoteText && szCurrentStatusNote) @@ -1231,9 +1231,9 @@ void __cdecl CIcqProto::SetStatusNoteThread(void *pDelay) if (strcmpnull(szCurrentStatusNote, setStatusNoteText) || (m_bMoodsEnabled && strcmpnull(szCurrentStatusMood, setStatusMoodData))) { - setSettingStringUtf(NULL, DBSETTING_STATUS_NOTE, setStatusNoteText); + db_set_utf(NULL, m_szModuleName, DBSETTING_STATUS_NOTE, setStatusNoteText); if (m_bMoodsEnabled) - setSettingString(NULL, DBSETTING_STATUS_MOOD, setStatusMoodData); + setString(DBSETTING_STATUS_MOOD, setStatusMoodData); WORD wStatusNoteLen = strlennull(setStatusNoteText); WORD wStatusMoodLen = m_bMoodsEnabled ? strlennull(setStatusMoodData) : 0; @@ -1328,7 +1328,7 @@ int CIcqProto::SetStatusMood(const char *szMoodData, DWORD dwDelay) char *szCurrentStatusMood = NULL; DBVARIANT dbv = {DBVT_DELETED}; - if (!getSettingString(NULL, DBSETTING_STATUS_MOOD, &dbv)) + if (!getString(DBSETTING_STATUS_MOOD, &dbv)) szCurrentStatusMood = dbv.pszVal; if (strcmpnull(szCurrentStatusMood, szMoodData)) @@ -1366,10 +1366,10 @@ void CIcqProto::writeDbInfoSettingTLVStringUtf(HANDLE hContact, const char *szSe memcpy(str, pTLV->pData, pTLV->wLen); str[pTLV->wLen] = '\0'; - setSettingStringUtf(hContact, szSetting, str); + db_set_utf(hContact, m_szModuleName, szSetting, str); } else - deleteSetting(hContact, szSetting); + db_unset(hContact, m_szModuleName, szSetting); } @@ -1378,9 +1378,9 @@ void CIcqProto::writeDbInfoSettingTLVWord(HANDLE hContact, const char *szSetting int num = chain->getNumber(wTlv, 1); if (num > 0) - setSettingWord(hContact, szSetting, num); + setWord(hContact, szSetting, num); else - deleteSetting(hContact, szSetting); + db_unset(hContact, m_szModuleName, szSetting); } @@ -1389,9 +1389,9 @@ void CIcqProto::writeDbInfoSettingTLVByte(HANDLE hContact, const char *szSetting int num = chain->getNumber(wTlv, 1); if (num > 0) - setSettingByte(hContact, szSetting, num); + setByte(hContact, szSetting, num); else - deleteSetting(hContact, szSetting); + db_unset(hContact, m_szModuleName, szSetting); } @@ -1402,7 +1402,7 @@ void CIcqProto::writeDbInfoSettingTLVDouble(HANDLE hContact, const char *szSetti if (num > 0) setSettingDouble(hContact, szSetting, num); else - deleteSetting(hContact, szSetting); + db_unset(hContact, m_szModuleName, szSetting); } void CIcqProto::writeDbInfoSettingTLVDate(HANDLE hContact, const char* szSettingYear, const char* szSettingMonth, const char* szSettingDay, oscar_tlv_chain* chain, WORD wTlv) @@ -1414,22 +1414,22 @@ void CIcqProto::writeDbInfoSettingTLVDate(HANDLE hContact, const char* szSetting SYSTEMTIME sTime = {0}; if (VariantTimeToSystemTime(time + 2, &sTime)) { - setSettingWord(hContact, szSettingYear, sTime.wYear); - setSettingByte(hContact, szSettingMonth, (BYTE)sTime.wMonth); - setSettingByte(hContact, szSettingDay, (BYTE)sTime.wDay); + setWord(hContact, szSettingYear, sTime.wYear); + setByte(hContact, szSettingMonth, (BYTE)sTime.wMonth); + setByte(hContact, szSettingDay, (BYTE)sTime.wDay); } else { - deleteSetting(hContact, szSettingYear); - deleteSetting(hContact, szSettingMonth); - deleteSetting(hContact, szSettingDay); + db_unset(hContact, m_szModuleName, szSettingYear); + db_unset(hContact, m_szModuleName, szSettingMonth); + db_unset(hContact, m_szModuleName, szSettingDay); } } else { - deleteSetting(hContact, szSettingYear); - deleteSetting(hContact, szSettingMonth); - deleteSetting(hContact, szSettingDay); + db_unset(hContact, m_szModuleName, szSettingYear); + db_unset(hContact, m_szModuleName, szSettingMonth); + db_unset(hContact, m_szModuleName, szSettingDay); } } @@ -1441,7 +1441,7 @@ void CIcqProto::writeDbInfoSettingTLVBlob(HANDLE hContact, const char *szSetting if (pTLV && pTLV->wLen > 0) setSettingBlob(hContact, szSetting, pTLV->pData, pTLV->wLen); else - deleteSetting(hContact, szSetting); + db_unset(hContact, m_szModuleName, szSetting); } @@ -1460,7 +1460,7 @@ BOOL CIcqProto::writeDbInfoSettingString(HANDLE hContact, const char* szSetting, if ((wLen > 0) && (**buf) && ((*buf)[wLen-1]==0)) // Make sure we have a proper string { - WORD wCp = getSettingWord(hContact, "InfoCodePage", getSettingWord(hContact, "InfoCP", CP_ACP)); + WORD wCp = getWord(hContact, "InfoCodePage", getWord(hContact, "InfoCP", CP_ACP)); if (wCp != CP_ACP) { @@ -1468,17 +1468,17 @@ BOOL CIcqProto::writeDbInfoSettingString(HANDLE hContact, const char* szSetting, if (szUtf) { - setSettingStringUtf(hContact, szSetting, szUtf); + db_set_utf(hContact, m_szModuleName, szSetting, szUtf); SAFE_FREE((void**)&szUtf); } else - setSettingString(hContact, szSetting, *buf); + setString(hContact, szSetting, *buf); } else - setSettingString(hContact, szSetting, *buf); + setString(hContact, szSetting, *buf); } else - deleteSetting(hContact, szSetting); + db_unset(hContact, m_szModuleName, szSetting); *buf += wLen; *pwLength -= wLen; @@ -1498,9 +1498,9 @@ BOOL CIcqProto::writeDbInfoSettingWord(HANDLE hContact, const char *szSetting, c *pwLength -= 2; if (wVal != 0) - setSettingWord(hContact, szSetting, wVal); + setWord(hContact, szSetting, wVal); else - deleteSetting(hContact, szSetting); + db_unset(hContact, m_szModuleName, szSetting); return TRUE; } @@ -1519,9 +1519,9 @@ BOOL CIcqProto::writeDbInfoSettingWordWithTable(HANDLE hContact, const char *szS text = LookupFieldNameUtf(table, wVal, sbuf, MAX_PATH); if (text) - setSettingStringUtf(hContact, szSetting, text); + db_set_utf(hContact, m_szModuleName, szSetting, text); else - deleteSetting(hContact, szSetting); + db_unset(hContact, m_szModuleName, szSetting); return TRUE; } @@ -1537,9 +1537,9 @@ BOOL CIcqProto::writeDbInfoSettingByte(HANDLE hContact, const char *pszSetting, *pwLength -= 1; if (byVal != 0) - setSettingByte(hContact, pszSetting, byVal); + setByte(hContact, pszSetting, byVal); else - deleteSetting(hContact, pszSetting); + db_unset(hContact, m_szModuleName, pszSetting); return TRUE; } @@ -1558,9 +1558,9 @@ BOOL CIcqProto::writeDbInfoSettingByteWithTable(HANDLE hContact, const char *szS text = LookupFieldNameUtf(table, byVal, sbuf, MAX_PATH); if (text) - setSettingStringUtf(hContact, szSetting, text); + db_set_utf(hContact, m_szModuleName, szSetting, text); else - deleteSetting(hContact, szSetting); + db_unset(hContact, m_szModuleName, szSetting); return TRUE; } @@ -1583,7 +1583,7 @@ char* time2text(time_t time) BOOL CIcqProto::validateStatusMessageRequest(HANDLE hContact, WORD byMessageType) { // Privacy control - if (getSettingByte(NULL, "StatusMsgReplyCList", 0)) + if (getByte("StatusMsgReplyCList", 0)) { // Don't send statusmessage to unknown contacts if (hContact == INVALID_HANDLE_VALUE) @@ -1595,7 +1595,7 @@ BOOL CIcqProto::validateStatusMessageRequest(HANDLE hContact, WORD byMessageType return FALSE; // Don't send statusmessage to invisible contacts - if (getSettingByte(NULL, "StatusMsgReplyVisible", 0)) + if (getByte("StatusMsgReplyVisible", 0)) { WORD wStatus = getContactStatus(hContact); if (wStatus == ID_STATUS_OFFLINE) @@ -1605,7 +1605,7 @@ BOOL CIcqProto::validateStatusMessageRequest(HANDLE hContact, WORD byMessageType // Dont send messages to people you are hiding from if (hContact != INVALID_HANDLE_VALUE && - getSettingWord(hContact, "ApparentMode", 0) == ID_STATUS_OFFLINE) + getWord(hContact, "ApparentMode", 0) == ID_STATUS_OFFLINE) { return FALSE; } @@ -1622,9 +1622,9 @@ BOOL CIcqProto::validateStatusMessageRequest(HANDLE hContact, WORD byMessageType } if (hContact != INVALID_HANDLE_VALUE && m_iStatus==ID_STATUS_INVISIBLE && - getSettingWord(hContact, "ApparentMode", 0) != ID_STATUS_ONLINE) + getWord(hContact, "ApparentMode", 0) != ID_STATUS_ONLINE) { - if (!getSettingByte(hContact, "TemporaryVisible", 0)) + if (!getByte(hContact, "TemporaryVisible", 0)) { // Allow request to temporary visible contacts return FALSE; } @@ -1863,11 +1863,11 @@ WORD CIcqProto::GetMyStatusFlags() WORD wFlags = 0; // Webaware setting bit flag - if (getSettingByte(NULL, "WebAware", 0)) + if (getByte("WebAware", 0)) wFlags |= STATUS_WEBAWARE; // DC setting bit flag - switch (getSettingByte(NULL, "DCType", 0)) + switch (getByte("DCType", 0)) { case 0: break; @@ -2089,7 +2089,7 @@ int MessageBoxUtf(HWND hWnd, const char *szText, const char *szCaption, UINT uTy char* CIcqProto::ConvertMsgToUserSpecificAnsi(HANDLE hContact, const char* szMsg) { // this takes utf-8 encoded message - WORD wCP = getSettingWord(hContact, "CodePage", m_wAnsiCodepage); + WORD wCP = getWord(hContact, "CodePage", m_wAnsiCodepage); char* szAnsi = NULL; if (wCP != CP_ACP) // convert to proper codepage diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp index 9e84e281e4..a4a1a98883 100644 --- a/protocols/JabberG/src/jabber_adhoc.cpp +++ b/protocols/JabberG/src/jabber_adhoc.cpp @@ -549,7 +549,7 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM wParam, LPARAM lParam) JABBER_LIST_ITEM * item=NULL; if (((hContact=(HANDLE)wParam)!=NULL || (lParam!=0)) && m_bJabberOnline) { - if (wParam && !JGetStringT(hContact, "jid", &dbv)) { + if (wParam && !getTString(hContact, "jid", &dbv)) { TCHAR jid[ JABBER_MAX_JID_LEN ]; int selected = 0; _tcsncpy(jid, dbv.ptszVal, SIZEOF(jid)); diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp index 5e6f742547..af44cfad07 100644 --- a/protocols/JabberG/src/jabber_archive.cpp +++ b/protocols/JabberG/src/jabber_archive.cpp @@ -42,7 +42,7 @@ void CJabberProto::RetrieveMessageArchive(HANDLE hContact, JABBER_LIST_ITEM *pIt XmlNodeIq iq(_T("get"), iqId); HXML list = iq << XCHILDNS( _T("list"), _T(JABBER_FEAT_ARCHIVE)) << XATTR(_T("with"), pItem->jid); - time_t tmLast = JGetDword(hContact, "LastCollection", 0); + time_t tmLast = getDword(hContact, "LastCollection", 0); if (tmLast) { TCHAR buf[40]; list << XATTR(_T("start"), time2str(tmLast, buf, SIZEOF(buf))); @@ -79,7 +79,7 @@ void CJabberProto::OnIqResultGetCollectionList(HXML iqNode) if ((hContact = HContactFromJID(with)) == NULL) continue; - tmLast = JGetDword(hContact, "LastCollection", 0); + tmLast = getDword(hContact, "LastCollection", 0); } int iqId = SerialNext(); @@ -91,7 +91,7 @@ void CJabberProto::OnIqResultGetCollectionList(HXML iqNode) time_t tmThis = str2time(start); if ( tmThis > tmLast) { tmLast = tmThis; - JSetDword(hContact, "LastCollection", tmLast+1); + setDword(hContact, "LastCollection", tmLast+1); } } } diff --git a/protocols/JabberG/src/jabber_bookmarks.cpp b/protocols/JabberG/src/jabber_bookmarks.cpp index 9441426bf8..f2ceae6965 100644 --- a/protocols/JabberG/src/jabber_bookmarks.cpp +++ b/protocols/JabberG/src/jabber_bookmarks.cpp @@ -293,9 +293,9 @@ void CJabberDlgBookmarks::OnInitDialog() ImageList_AddIcon_Icolib(hIml, m_proto->LoadIconEx("group")); ImageList_AddIcon_Icolib(hIml, LoadSkinnedIcon(SKINICON_EVENT_URL)); - m_lvBookmarks.AddColumn(0, TranslateT("Bookmark Name"), m_proto->JGetWord(NULL, "bookmarksWnd_cx0", 120)); - m_lvBookmarks.AddColumn(1, TranslateT("Address (JID or URL)"), m_proto->JGetWord(NULL, "bookmarksWnd_cx1", 210)); - m_lvBookmarks.AddColumn(2, TranslateT("Nickname"), m_proto->JGetWord(NULL, "bookmarksWnd_cx2", 90)); + m_lvBookmarks.AddColumn(0, TranslateT("Bookmark Name"), m_proto->getWord("bookmarksWnd_cx0", 120)); + m_lvBookmarks.AddColumn(1, TranslateT("Address (JID or URL)"), m_proto->getWord("bookmarksWnd_cx1", 210)); + m_lvBookmarks.AddColumn(2, TranslateT("Nickname"), m_proto->getWord("bookmarksWnd_cx2", 90)); m_lvBookmarks.EnableGroupView(TRUE); m_lvBookmarks.AddGroup(0, TranslateT("Conferences")); @@ -309,11 +309,11 @@ void CJabberDlgBookmarks::OnClose() LVCOLUMN lvc = {0}; lvc.mask = LVCF_WIDTH; m_lvBookmarks.GetColumn(0, &lvc); - m_proto->JSetWord(NULL, "bookmarksWnd_cx0", lvc.cx); + m_proto->setWord("bookmarksWnd_cx0", lvc.cx); m_lvBookmarks.GetColumn(1, &lvc); - m_proto->JSetWord(NULL, "bookmarksWnd_cx1", lvc.cx); + m_proto->setWord("bookmarksWnd_cx1", lvc.cx); m_lvBookmarks.GetColumn(2, &lvc); - m_proto->JSetWord(NULL, "bookmarksWnd_cx2", lvc.cx); + m_proto->setWord("bookmarksWnd_cx2", lvc.cx); Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "bookmarksWnd_"); diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 450e34bb5c..e725096391 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -151,14 +151,14 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM* item) db_set_ts(hContact, "CList", "MyHandle", bookmark->name); } - if ( !JGetStringT(hContact, "MyNick", &dbv)) { + if ( !getTString(hContact, "MyNick", &dbv)) { if ( !lstrcmp(dbv.ptszVal, szNick)) JDeleteSetting(hContact, "MyNick"); else - JSetStringT(hContact, "MyNick", item->nick); + setTString(hContact, "MyNick", item->nick); db_free(&dbv); } - else JSetStringT(hContact, "MyNick", item->nick); + else setTString(hContact, "MyNick", item->nick); TCHAR *passw = JGetStringCrypt(hContact, "LoginPassword"); if (lstrcmp_null(passw, item->password)) { @@ -820,7 +820,7 @@ public: if (int hItem = SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0)) { if (SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) { DBVARIANT dbv={0}; - m_proto->JGetStringT(hContact, "jid", &dbv); + m_proto->getTString(hContact, "jid", &dbv); if (dbv.ptszVal && (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR)) InviteUser(dbv.ptszVal, text); db_free(&dbv); @@ -1477,12 +1477,12 @@ static void sttSendPrivateMessage(CJabberProto* ppro, JABBER_LIST_ITEM* item, co if (hContact != NULL) { for (int i=0; i < item->resourceCount; i++) { if (_tcsicmp(item->resource[i].resourceName, nick) == 0) { - ppro->JSetWord(hContact, "Status", item->resource[i].status); + ppro->setWord(hContact, "Status", item->resource[i].status); break; } } db_set_b(hContact, "CList", "Hidden", 1); - ppro->JSetStringT(hContact, "Nick", nick); + ppro->setTString(hContact, "Nick", nick); db_set_dw(hContact, "Ignore", "Mask1", 0); CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0); } } diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index 75b650b068..b7dcadb11b 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -381,7 +381,7 @@ void CJabberDlgConsole::OnInitDialog() DBVARIANT dbv; *m_proto->m_filterInfo.pattern = 0; - if ( !m_proto->JGetStringT(NULL, "consoleWnd_fpattern", &dbv)) { + if ( !m_proto->getTString(NULL, "consoleWnd_fpattern", &dbv)) { lstrcpyn(m_proto->m_filterInfo.pattern, dbv.ptszVal, SIZEOF(m_proto->m_filterInfo.pattern)); db_free(&dbv); } @@ -433,7 +433,7 @@ void CJabberDlgConsole::OnClose() db_set_b(NULL, m_proto->m_szModuleName, "consoleWnd_presence", m_proto->m_filterInfo.presence); db_set_b(NULL, m_proto->m_szModuleName, "consoleWnd_iq", m_proto->m_filterInfo.iq); db_set_b(NULL, m_proto->m_szModuleName, "consoleWnd_ftype", m_proto->m_filterInfo.type); - m_proto->JSetStringT(NULL, "consoleWnd_fpattern", m_proto->m_filterInfo.pattern); + m_proto->setTString(NULL, "consoleWnd_fpattern", m_proto->m_filterInfo.pattern); Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "consoleWnd_"); DestroyWindow(m_hwnd); diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index 2aff62d257..c45f8172f6 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -407,7 +407,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) if (_tcschr(item->jid, '@')==NULL && _tcschr(item->jid, '/')==NULL && item->subscription!=SUB_NONE) { HANDLE hContact = HContactFromJID(item->jid); if (hContact != NULL) - JSetByte(hContact, "IsTransport", TRUE); + setByte(hContact, "IsTransport", TRUE); if (m_lstTransports.getIndex(item->jid) == -1) m_lstTransports.insert(mir_tstrdup(item->jid)); @@ -440,18 +440,18 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) } else if ( !lstrcmp(szJid, _T(SD_FAKEJID_FAVORITES))) { sttBrowseMode = SD_BROWSE_FAVORITES; - int count = JGetDword(NULL, "discoWnd_favCount", 0); + int count = getDword(NULL, "discoWnd_favCount", 0); for (int i = 0; i < count; i++) { DBVARIANT dbv; char setting[MAXMODULELABELLENGTH]; mir_snprintf(setting, sizeof(setting), "discoWnd_favName_%d", i); - if ( !JGetStringT(NULL, setting, &dbv)) { + if ( !getTString(NULL, setting, &dbv)) { DBVARIANT dbvJid, dbvNode; mir_snprintf(setting, sizeof(setting), "discoWnd_favJID_%d", i); - JGetStringT(NULL, setting, &dbvJid); + getTString(NULL, setting, &dbvJid); mir_snprintf(setting, sizeof(setting), "discoWnd_favNode_%d", i); - JGetStringT(NULL, setting, &dbvNode); + getTString(NULL, setting, &dbvNode); CJabberSDNode* pNode = m_SDManager.AddPrimaryNode(dbvJid.ptszVal, dbvNode.ptszVal, dbv.ptszVal); SendBothRequests(pNode, NULL); db_free(&dbv); @@ -803,13 +803,13 @@ void CJabberDlgDiscovery::btnGoHome_OnClick(CCtrlButton *) void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *) { HMENU hMenu = CreatePopupMenu(); - int count = m_proto->JGetDword(NULL, "discoWnd_favCount", 0); + int count = m_proto->getDword(NULL, "discoWnd_favCount", 0); for (int i = 0; i < count; i++) { DBVARIANT dbv; char setting[MAXMODULELABELLENGTH]; mir_snprintf(setting, sizeof(setting), "discoWnd_favName_%d", i); - if ( !m_proto->JGetStringT(NULL, setting, &dbv)) + if ( !m_proto->getTString(NULL, setting, &dbv)) { HMENU hSubMenu = CreatePopupMenu(); AppendMenu(hSubMenu, MF_STRING, 100+i*10+0, TranslateT("Navigate")); @@ -861,10 +861,10 @@ void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *) DBVARIANT dbv; char setting[MAXMODULELABELLENGTH]; mir_snprintf(setting, sizeof(setting), "discoWnd_favJID_%d", res); - if ( !m_proto->JGetStringT(NULL, setting, &dbv)) SetDlgItemText(m_hwnd, IDC_COMBO_JID, dbv.ptszVal); + if ( !m_proto->getTString(NULL, setting, &dbv)) SetDlgItemText(m_hwnd, IDC_COMBO_JID, dbv.ptszVal); db_free(&dbv); mir_snprintf(setting, sizeof(setting), "discoWnd_favNode_%d", res); - if ( !m_proto->JGetStringT(NULL, setting, &dbv)) SetDlgItemText(m_hwnd, IDC_COMBO_NODE, dbv.ptszVal); + if ( !m_proto->getTString(NULL, setting, &dbv)) SetDlgItemText(m_hwnd, IDC_COMBO_NODE, dbv.ptszVal); db_free(&dbv); PostMessage(m_hwnd, WM_COMMAND, MAKEWPARAM(IDC_BUTTON_BROWSE, 0), 0); @@ -872,7 +872,7 @@ void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *) } else if (res == 1) { - int count = m_proto->JGetDword(NULL, "discoWnd_favCount", 0); + int count = m_proto->getDword(NULL, "discoWnd_favCount", 0); for (int i = 0; i < count; i++) { char setting[MAXMODULELABELLENGTH]; @@ -1368,14 +1368,14 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM case SD_ACT_FAVORITE: { char setting[MAXMODULELABELLENGTH]; - int count = JGetDword(NULL, "discoWnd_favCount", 0); + int count = getDword(NULL, "discoWnd_favCount", 0); mir_snprintf(setting, sizeof(setting), "discoWnd_favName_%d", count); - JSetStringT(NULL, setting, pNode->GetName() ? pNode->GetName() : pNode->GetJid()); + setTString(NULL, setting, pNode->GetName() ? pNode->GetName() : pNode->GetJid()); mir_snprintf(setting, sizeof(setting), "discoWnd_favJID_%d", count); - JSetStringT(NULL, setting, pNode->GetJid()); + setTString(NULL, setting, pNode->GetJid()); mir_snprintf(setting, sizeof(setting), "discoWnd_favNode_%d", count); - JSetStringT(NULL, setting, pNode->GetNode() ? pNode->GetNode() : _T("")); - JSetDword(NULL, "discoWnd_favCount", ++count); + setTString(NULL, setting, pNode->GetNode() ? pNode->GetNode() : _T("")); + setDword(NULL, "discoWnd_favCount", ++count); break; } @@ -1394,7 +1394,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM case SD_ACT_PROXY: m_options.BsDirect = FALSE; m_options.BsProxyManual = TRUE; - JSetStringT(NULL, "BsProxyServer", pNode->GetJid()); + setTString(NULL, "BsProxyServer", pNode->GetJid()); break; case SD_ACT_JOIN: diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index ab100f2ac4..59ac6e0228 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -44,7 +44,7 @@ int CJabberProto::OnContactDeleted(WPARAM wParam, LPARAM) return 0; DBVARIANT dbv; - if ( !JGetStringT((HANDLE)wParam, JGetByte((HANDLE) wParam, "ChatRoom", 0)?(char*)"ChatRoomID":(char*)"jid", &dbv)) { + if ( !getTString((HANDLE)wParam, getByte((HANDLE) wParam, "ChatRoom", 0)?(char*)"ChatRoomID":(char*)"jid", &dbv)) { if (ListExist(LIST_ROSTER, dbv.ptszVal)) { if ( !_tcschr(dbv.ptszVal, _T('@'))) { TCHAR szStrippedJid[JABBER_MAX_JID_LEN]; @@ -85,7 +85,7 @@ static TCHAR* sttSettingToTchar(DBCONTACTWRITESETTING* cws) void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING* cws, HANDLE hContact) { DBVARIANT jid, dbv; - if (JGetStringT(hContact, "jid", &jid)) + if (getTString(hContact, "jid", &jid)) return; JABBER_LIST_ITEM* item = ListGetItemPtr(LIST_ROSTER, jid.ptszVal); @@ -98,7 +98,7 @@ void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING* cws, HANDLE hCon nick = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } - else if ( !JGetStringT(hContact, "Nick", &dbv)) { + else if ( !getTString(hContact, "Nick", &dbv)) { nick = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } @@ -127,7 +127,7 @@ void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING* cws, HANDLE hCon void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING* cws, HANDLE hContact) { DBVARIANT jid; - if (JGetStringT(hContact, "jid", &jid)) + if (getTString(hContact, "jid", &jid)) return; JABBER_LIST_ITEM* item = ListGetItemPtr(LIST_ROSTER, jid.ptszVal); @@ -157,7 +157,7 @@ void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING* cws, HANDL return; DBVARIANT jid, dbv; - if (JGetStringT(hContact, "jid", &jid)) + if (getTString(hContact, "jid", &jid)) return; TCHAR *nick; @@ -166,7 +166,7 @@ void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING* cws, HANDL nick = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } - else if ( !JGetStringT(hContact, "Nick", &dbv)) { + else if ( !getTString(hContact, "Nick", &dbv)) { nick = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index beea8f4e69..f4e5ee0d0c 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -134,19 +134,19 @@ struct JabberGcRecentInfo cleanup(); mir_snprintf(setting, sizeof(setting), "rcMuc_%d_server", iRecent); - if ( !ppro->JGetStringT(NULL, setting, &dbv)) { + if ( !ppro->getTString(NULL, setting, &dbv)) { server = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } mir_snprintf(setting, sizeof(setting), "rcMuc_%d_room", iRecent); - if ( !ppro->JGetStringT(NULL, setting, &dbv)) { + if ( !ppro->getTString(NULL, setting, &dbv)) { room = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } mir_snprintf(setting, sizeof(setting), "rcMuc_%d_nick", iRecent); - if ( !ppro->JGetStringT(NULL, setting, &dbv)) { + if ( !ppro->getTString(NULL, setting, &dbv)) { nick = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } @@ -163,19 +163,19 @@ struct JabberGcRecentInfo mir_snprintf(setting, sizeof(setting), "rcMuc_%d_server", iRecent); if (server) - ppro->JSetStringT(NULL, setting, server); + ppro->setTString(NULL, setting, server); else ppro->JDeleteSetting(NULL, setting); mir_snprintf(setting, sizeof(setting), "rcMuc_%d_room", iRecent); if (room) - ppro->JSetStringT(NULL, setting, room); + ppro->setTString(NULL, setting, room); else ppro->JDeleteSetting(NULL, setting); mir_snprintf(setting, sizeof(setting), "rcMuc_%d_nick", iRecent); if (nick) - ppro->JSetStringT(NULL, setting, nick); + ppro->setTString(NULL, setting, nick); else ppro->JDeleteSetting(NULL, setting); @@ -230,18 +230,18 @@ INT_PTR __cdecl CJabberProto::OnJoinChat(WPARAM wParam, LPARAM) { DBVARIANT nick, jid; HANDLE hContact = (HANDLE)wParam; - if (JGetStringT(hContact, "ChatRoomID", &jid)) + if (getTString(hContact, "ChatRoomID", &jid)) return 0; - if (JGetStringT(hContact, "MyNick", &nick)) - if (JGetStringT(NULL, "Nick", &nick)) { + if (getTString(hContact, "MyNick", &nick)) + if (getTString(NULL, "Nick", &nick)) { db_free(&jid); return 0; } TCHAR *password = JGetStringCrypt(hContact, "LoginPassword"); - if (JGetWord(hContact, "Status", 0) != ID_STATUS_ONLINE) { + if (getWord(hContact, "Status", 0) != ID_STATUS_ONLINE) { if ( !jabberChatDllPresent) JabberChatDllError(); else { @@ -261,10 +261,10 @@ INT_PTR __cdecl CJabberProto::OnLeaveChat(WPARAM wParam, LPARAM) { DBVARIANT jid; HANDLE hContact = (HANDLE)wParam; - if (JGetStringT(hContact, "ChatRoomID", &jid)) + if (getTString(hContact, "ChatRoomID", &jid)) return 0; - if (JGetWord(hContact, "Status", 0) != ID_STATUS_OFFLINE) { + if (getWord(hContact, "Status", 0) != ID_STATUS_OFFLINE) { JABBER_LIST_ITEM* item = ListGetItemPtr(LIST_CHATROOM, jid.ptszVal); if (item != NULL) GcQuit(item, 0, NULL); @@ -501,7 +501,7 @@ void CJabberDlgGcJoin::OnInitDialog() } DBVARIANT dbv; - if ( !m_proto->JGetStringT(NULL, "Nick", &dbv)) { + if ( !m_proto->getTString(NULL, "Nick", &dbv)) { SetDlgItemText(m_hwnd, IDC_NICK, dbv.ptszVal); db_free(&dbv); } @@ -891,7 +891,7 @@ void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM* item, const TCHAR *ol HANDLE hContact = HContactFromJID(item->jid); if (hContact != NULL) - JSetStringT(hContact, "MyNick", newNick); + setTString(hContact, "MyNick", newNick); } GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CHUID }; @@ -1056,12 +1056,12 @@ void CJabberProto::GroupchatProcessPresence(HXML node) // update clist status HANDLE hContact = HContactFromJID(from); if (hContact != NULL) - JSetWord(hContact, "Status", status); + setWord(hContact, "Status", status); // Update room status //if (item->status != ID_STATUS_ONLINE) { // item->status = ID_STATUS_ONLINE; - // JSetWord(hContact, "Status", (WORD)ID_STATUS_ONLINE); + // setWord(hContact, "Status", (WORD)ID_STATUS_ONLINE); // JabberLog("Room %s online", from); //} @@ -1122,7 +1122,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) HANDLE hContact = HContactFromJID(from); if (hContact != NULL) - JSetWord(hContact, "Status", ID_STATUS_OFFLINE); + setWord(hContact, "Status", ID_STATUS_OFFLINE); } // processing room errors diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index ed7f03efab..c30a57cfe4 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -396,18 +396,18 @@ INT_PTR __cdecl CJabberProto::JGetAdvancedStatusIcon(WPARAM wParam, LPARAM) if ( !hContact) return -1; - if ( !JGetByte(hContact, "IsTransported", 0)) + if ( !getByte(hContact, "IsTransported", 0)) return -1; DBVARIANT dbv; - if (JGetStringT(hContact, "Transport", &dbv)) + if (getTString(hContact, "Transport", &dbv)) return -1; int iID = GetTransportProtoID(dbv.ptszVal); db_free(&dbv); if (iID >= 0) { WORD Status = ID_STATUS_OFFLINE; - Status = JGetWord(hContact, "Status", ID_STATUS_OFFLINE); + Status = getWord(hContact, "Status", ID_STATUS_OFFLINE); if (Status < ID_STATUS_OFFLINE) Status = ID_STATUS_OFFLINE; else if (Status > ID_STATUS_INVISIBLE) @@ -449,12 +449,12 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const TCHAR *jid, HANDLE hContact if (m_lstTransports.getIndex(domain) == -1) { if (isAgent) { m_lstTransports.insert(mir_tstrdup(domain)); - JSetByte(hContact, "IsTransport", 1); + setByte(hContact, "IsTransport", 1); } } if (isTransported) { - JSetStringT(hContact, "Transport", domain); - JSetByte(hContact, "IsTransported", 1); + setTString(hContact, "Transport", domain); + setByte(hContact, "IsTransported", 1); } return isTransported; } @@ -463,7 +463,7 @@ void CJabberProto::CheckAllContactsAreTransported() { for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { DBVARIANT dbv; - if ( !JGetStringT(hContact, "jid", &dbv)) { + if ( !getTString(hContact, "jid", &dbv)) { DBCheckIsTransportedContact(dbv.ptszVal, hContact); db_free(&dbv); } diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index 5868e93f82..cfbb8be86a 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -597,11 +597,11 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) // Add the jid (with empty resource) to Miranda contact list. hContact = DBCreateContact(jid, nick, FALSE, FALSE); } - else JSetStringT(hContact, "jid", jid); + else setTString(hContact, "jid", jid); if (name != NULL) { DBVARIANT dbnick; - if ( !JGetStringT(hContact, "Nick", &dbnick)) { + if ( !getTString(hContact, "Nick", &dbnick)) { if (_tcscmp(nick, dbnick.ptszVal) != 0) db_set_ts(hContact, "CList", "MyHandle", nick); else @@ -640,7 +640,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) SetContactOfflineStatus(hContact); ListRemove(LIST_ROSTER, jid); } } - else if (JGetByte(hContact, "ChatRoom", 0)) + else if (getByte(hContact, "ChatRoom", 0)) db_unset(hContact, "CList", "Hidden"); else UpdateSubscriptionInfo(hContact, item); diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index e81d74ea2a..120109c9ad 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -214,7 +214,7 @@ void CJabberProto::OnLoggedIn() SendGetVcard(m_szJabberJID); else if (strcmp(m_ThreadInfo->server, szServerName)) SendGetVcard(m_szJabberJID); - JSetString(NULL, "LastLoggedServer", m_ThreadInfo->server); + setString("LastLoggedServer", m_ThreadInfo->server); m_pepServices.ResetPublishAll(); } @@ -282,8 +282,8 @@ void CJabberProto::OnIqResultSetAuth(HXML iqNode) if ( !lstrcmp(type, _T("result"))) { DBVARIANT dbv; - if (JGetStringT(NULL, "Nick", &dbv)) - JSetStringT(NULL, "Nick", m_ThreadInfo->username); + if (getTString(NULL, "Nick", &dbv)) + setTString(NULL, "Nick", m_ThreadInfo->username); else db_free(&dbv); @@ -463,7 +463,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo* pInfo) if (name != NULL) { DBVARIANT dbNick; - if ( !JGetStringT(hContact, "Nick", &dbNick)) { + if ( !getTString(hContact, "Nick", &dbNick)) { if (lstrcmp(nick, dbNick.ptszVal) != 0) db_set_ts(hContact, "CList", "MyHandle", nick); else @@ -475,7 +475,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo* pInfo) } else db_unset(hContact, "CList", "MyHandle"); - if (JGetByte(hContact, "ChatRoom", 0)) { + if (getByte(hContact, "ChatRoom", 0)) { GCSESSION gcw = {0}; gcw.cbSize = sizeof(GCSESSION); gcw.iType = GCW_CHATROOM; @@ -514,9 +514,9 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo* pInfo) if (hContact != NULL) { if (bIsTransport) - JSetByte(hContact, "IsTransport", TRUE); + setByte(hContact, "IsTransport", TRUE); else - JSetByte(hContact, "IsTransport", FALSE); + setByte(hContact, "IsTransport", FALSE); } const TCHAR *imagepath = xmlGetAttrValue(itemNode, _T("vz:img")); @@ -604,7 +604,7 @@ void CJabberProto::OnIqResultSetRegister(HXML iqNode) if ( !lstrcmp(type, _T("result"))) { HANDLE hContact = HContactFromJID(from); if (hContact != NULL) - JSetByte(hContact, "IsTransport", TRUE); + setByte(hContact, "IsTransport", TRUE); if (m_hwndRegProgress) SendMessage(m_hwndRegProgress, WM_JABBER_REGDLG_UPDATE, 100, (LPARAM)TranslateT("Registration successful")); @@ -685,7 +685,7 @@ LBL_Ret: } else { DBVARIANT dbv; - if ( !JGetStringT(hContact, "jid", &dbv)) { + if ( !getTString(hContact, "jid", &dbv)) { JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid); if (item == NULL) { item = ListAdd(LIST_VCARD_TEMP, jid); // adding to the temp list to store information about photo @@ -792,13 +792,13 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) if ( !_tcscmp(xmlGetName(n), _T("FN"))) { if (xmlGetText(n) != NULL) { hasFn = TRUE; - JSetStringT(hContact, "FullName", xmlGetText(n)); + setTString(hContact, "FullName", xmlGetText(n)); } } else if ( !lstrcmp(xmlGetName(n), _T("NICKNAME"))) { if (xmlGetText(n) != NULL) { hasNick = TRUE; - JSetStringT(hContact, "Nick", xmlGetText(n)); + setTString(hContact, "Nick", xmlGetText(n)); } } else if ( !lstrcmp(xmlGetName(n), _T("N"))) { @@ -806,15 +806,15 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) if ( !hasGiven && !hasFamily && !hasMiddle) { if ((m=xmlGetChild(n , "GIVEN")) != NULL && xmlGetText(m)!=NULL) { hasGiven = TRUE; - JSetStringT(hContact, "FirstName", xmlGetText(m)); + setTString(hContact, "FirstName", xmlGetText(m)); } if ((m=xmlGetChild(n , "FAMILY")) != NULL && xmlGetText(m)!=NULL) { hasFamily = TRUE; - JSetStringT(hContact, "LastName", xmlGetText(m)); + setTString(hContact, "LastName", xmlGetText(m)); } if ((m=xmlGetChild(n , "MIDDLE")) != NULL && xmlGetText(m) != NULL) { hasMiddle = TRUE; - JSetStringT(hContact, "MiddleName", xmlGetText(m)); + setTString(hContact, "MiddleName", xmlGetText(m)); } } } else if ( !lstrcmp(xmlGetName(n), _T("EMAIL"))) { @@ -830,7 +830,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) sprintf(text, "e-mail%d", nEmail-1); } else sprintf(text, "e-mail%d", nEmail); - JSetStringT(hContact, text, xmlGetText(m)); + setTString(hContact, text, xmlGetText(m)); if (hContact == NULL) { sprintf(text, "e-mailFlag%d", nEmail); @@ -839,7 +839,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) if (xmlGetChild(n , "WORK") != NULL) nFlag |= JABBER_VCEMAIL_WORK; if (xmlGetChild(n , "INTERNET") != NULL) nFlag |= JABBER_VCEMAIL_INTERNET; if (xmlGetChild(n , "X400") != NULL) nFlag |= JABBER_VCEMAIL_X400; - JSetWord(NULL, text, nFlag); + setWord(text, nFlag); } nEmail++; } @@ -850,9 +850,9 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) if (hContact != NULL) { if (_stscanf(xmlGetText(n), _T("%d-%d-%d"), &nYear, &nMonth, &nDay) == 3) { hasBday = TRUE; - JSetWord(hContact, "BirthYear", (WORD)nYear); - JSetByte(hContact, "BirthMonth", (BYTE) nMonth); - JSetByte(hContact, "BirthDay", (BYTE) nDay); + setWord(hContact, "BirthYear", (WORD)nYear); + setByte(hContact, "BirthMonth", (BYTE) nMonth); + setByte(hContact, "BirthDay", (BYTE) nDay); SYSTEMTIME sToday = {0}; GetLocalTime(&sToday); @@ -860,12 +860,12 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) if (sToday.wMonth < nMonth || (sToday.wMonth == nMonth && sToday.wDay < nDay)) nAge--; if (nAge) - JSetWord(hContact, "Age", (WORD)nAge); + setWord(hContact, "Age", (WORD)nAge); } } else { hasBday = TRUE; - JSetStringT(NULL, "BirthDate", xmlGetText(n)); + setTString(NULL, "BirthDate", xmlGetText(n)); } } } else if ( !lstrcmp(xmlGetName(n), _T("GENDER"))) { @@ -874,12 +874,12 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) if (hContact != NULL) { if (xmlGetText(n)[0] && strchr("mMfF", xmlGetText(n)[0])!=NULL) { hasGender = TRUE; - JSetByte(hContact, "Gender", (BYTE) toupper(xmlGetText(n)[0])); + setByte(hContact, "Gender", (BYTE) toupper(xmlGetText(n)[0])); } } else { hasGender = TRUE; - JSetStringT(NULL, "GenderString", xmlGetText(n)); + setTString(NULL, "GenderString", xmlGetText(n)); } } } else if ( !lstrcmp(xmlGetName(n), _T("ADR"))) { @@ -896,34 +896,34 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) else _tcsncpy(text, xmlGetText(m), SIZEOF(text)); text[SIZEOF(text)-1] = '\0'; - JSetStringT(hContact, "Street", text); + setTString(hContact, "Street", text); } else { - JSetStringT(hContact, "Street", xmlGetText(m)); + setTString(hContact, "Street", xmlGetText(m)); if ((m=xmlGetChild(n , "EXTADR")) == NULL) m = xmlGetChild(n , "EXTADD"); if (m!=NULL && xmlGetText(m)!=NULL) { hasHomeStreet2 = TRUE; - JSetStringT(hContact, "Street2", xmlGetText(m)); + setTString(hContact, "Street2", xmlGetText(m)); } } } if ((m=xmlGetChild(n , "LOCALITY"))!=NULL && xmlGetText(m)!=NULL) { hasHomeLocality = TRUE; - JSetStringT(hContact, "City", xmlGetText(m)); + setTString(hContact, "City", xmlGetText(m)); } if ((m=xmlGetChild(n , "REGION"))!=NULL && xmlGetText(m)!=NULL) { hasHomeRegion = TRUE; - JSetStringT(hContact, "State", xmlGetText(m)); + setTString(hContact, "State", xmlGetText(m)); } if ((m=xmlGetChild(n , "PCODE"))!=NULL && xmlGetText(m)!=NULL) { hasHomePcode = TRUE; - JSetStringT(hContact, "ZIP", xmlGetText(m)); + setTString(hContact, "ZIP", xmlGetText(m)); } if ((m=xmlGetChild(n , "CTRY"))==NULL || xmlGetText(m)==NULL) // Some bad client use instead of m = xmlGetChild(n , "COUNTRY"); if (m!=NULL && xmlGetText(m)!=NULL) { hasHomeCtry = TRUE; - JSetStringT(hContact, "Country", xmlGetText(m)); + setTString(hContact, "Country", xmlGetText(m)); } } if ( !hasWork && xmlGetChild(n , "WORK")!=NULL) { @@ -939,34 +939,34 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) else _tcsncpy(text, xmlGetText(m), SIZEOF(text)); text[SIZEOF(text)-1] = '\0'; - JSetStringT(hContact, "CompanyStreet", text); + setTString(hContact, "CompanyStreet", text); } else { - JSetStringT(hContact, "CompanyStreet", xmlGetText(m)); + setTString(hContact, "CompanyStreet", xmlGetText(m)); if ((m=xmlGetChild(n , "EXTADR")) == NULL) m = xmlGetChild(n , "EXTADD"); if (m!=NULL && xmlGetText(m)!=NULL) { hasWorkStreet2 = TRUE; - JSetStringT(hContact, "CompanyStreet2", xmlGetText(m)); + setTString(hContact, "CompanyStreet2", xmlGetText(m)); } } } if ((m=xmlGetChild(n , "LOCALITY"))!=NULL && xmlGetText(m)!=NULL) { hasWorkLocality = TRUE; - JSetStringT(hContact, "CompanyCity", xmlGetText(m)); + setTString(hContact, "CompanyCity", xmlGetText(m)); } if ((m=xmlGetChild(n , "REGION"))!=NULL && xmlGetText(m)!=NULL) { hasWorkRegion = TRUE; - JSetStringT(hContact, "CompanyState", xmlGetText(m)); + setTString(hContact, "CompanyState", xmlGetText(m)); } if ((m=xmlGetChild(n , "PCODE"))!=NULL && xmlGetText(m)!=NULL) { hasWorkPcode = TRUE; - JSetStringT(hContact, "CompanyZIP", xmlGetText(m)); + setTString(hContact, "CompanyZIP", xmlGetText(m)); } if ((m=xmlGetChild(n , "CTRY"))==NULL || xmlGetText(m)==NULL) // Some bad client use instead of m = xmlGetChild(n , "COUNTRY"); if (m!=NULL && xmlGetText(m)!=NULL) { hasWorkCtry = TRUE; - JSetStringT(hContact, "CompanyCountry", xmlGetText(m)); + setTString(hContact, "CompanyCountry", xmlGetText(m)); } } } else if ( !lstrcmp(xmlGetName(n), _T("TEL"))) { @@ -975,11 +975,11 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) if (hContact != NULL) { if ( !hasFax && xmlGetChild(n , "FAX")!=NULL) { hasFax = TRUE; - JSetStringT(hContact, "Fax", xmlGetText(m)); + setTString(hContact, "Fax", xmlGetText(m)); } else if ( !hasCell && xmlGetChild(n , "CELL")!=NULL) { hasCell = TRUE; - JSetStringT(hContact, "Cellular", xmlGetText(m)); + setTString(hContact, "Cellular", xmlGetText(m)); } else if ( !hasPhone && (xmlGetChild(n , "HOME")!=NULL || @@ -995,13 +995,13 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) xmlGetChild(n , "ISDN")==NULL && xmlGetChild(n , "PCS")==NULL))) { hasPhone = TRUE; - JSetStringT(hContact, "Phone", xmlGetText(m)); + setTString(hContact, "Phone", xmlGetText(m)); } } else { char text[ 100 ]; sprintf(text, "Phone%d", nPhone); - JSetStringT(NULL, text, xmlGetText(m)); + setTString(NULL, text, xmlGetText(m)); sprintf(text, "PhoneFlag%d", nPhone); int nFlag = 0; @@ -1017,7 +1017,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) if (xmlGetChild(n ,"MODEM") != NULL) nFlag |= JABBER_VCTEL_MODEM; if (xmlGetChild(n ,"ISDN") != NULL) nFlag |= JABBER_VCTEL_ISDN; if (xmlGetChild(n ,"PCS") != NULL) nFlag |= JABBER_VCTEL_PCS; - JSetWord(NULL, text, nFlag); + setWord(text, nFlag); nPhone++; } } } @@ -1025,37 +1025,37 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) // Homepage if ( !hasUrl && xmlGetText(n)!=NULL) { hasUrl = TRUE; - JSetStringT(hContact, "Homepage", xmlGetText(n)); + setTString(hContact, "Homepage", xmlGetText(n)); } } else if ( !lstrcmp(xmlGetName(n), _T("ORG"))) { if ( !hasOrgname && !hasOrgunit) { if ((m=xmlGetChild(n ,"ORGNAME"))!=NULL && xmlGetText(m)!=NULL) { hasOrgname = TRUE; - JSetStringT(hContact, "Company", xmlGetText(m)); + setTString(hContact, "Company", xmlGetText(m)); } if ((m=xmlGetChild(n ,"ORGUNIT"))!=NULL && xmlGetText(m)!=NULL) { // The real vCard can have multiple but we will only display the first one hasOrgunit = TRUE; - JSetStringT(hContact, "CompanyDepartment", xmlGetText(m)); + setTString(hContact, "CompanyDepartment", xmlGetText(m)); } } } else if ( !lstrcmp(xmlGetName(n), _T("ROLE"))) { if ( !hasRole && xmlGetText(n)!=NULL) { hasRole = TRUE; - JSetStringT(hContact, "Role", xmlGetText(n)); + setTString(hContact, "Role", xmlGetText(n)); } } else if ( !lstrcmp(xmlGetName(n), _T("TITLE"))) { if ( !hasTitle && xmlGetText(n)!=NULL) { hasTitle = TRUE; - JSetStringT(hContact, "CompanyPosition", xmlGetText(n)); + setTString(hContact, "CompanyPosition", xmlGetText(n)); } } else if ( !lstrcmp(xmlGetName(n), _T("DESC"))) { if ( !hasDesc && xmlGetText(n)!=NULL) { hasDesc = TRUE; TCHAR* szMemo = JabberUnixToDosT(xmlGetText(n)); - JSetStringT(hContact, "About", szMemo); + setTString(hContact, "About", szMemo); mir_free(szMemo); } } @@ -1068,7 +1068,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) TCHAR *nick = JGetStringT(hContact, "Nick"); TCHAR *jidNick = JabberNickFromJID(jid); if ( !nick || (jidNick && !_tcsicmp(nick, jidNick))) - JSetStringT(hContact, "Nick", name); + setTString(hContact, "Nick", name); mir_free(jidNick); mir_free(nick); @@ -1370,7 +1370,7 @@ void CJabberProto::OnIqResultGetVCardAvatar(HXML iqNode) if (xmlGetChildCount(vCard) == 0) { JDeleteSetting(hContact, "AvatarHash"); DBVARIANT dbv = {0}; - if ( !JGetStringT(hContact, "AvatarSaved", &dbv)) { + if ( !getTString(hContact, "AvatarSaved", &dbv)) { db_free(&dbv); JDeleteSetting(hContact, "AvatarSaved"); ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, NULL); @@ -1386,7 +1386,7 @@ void CJabberProto::OnIqResultGetVCardAvatar(HXML iqNode) if (n == NULL) return; - JSetByte(hContact, "AvatarXVcard", 1); + setByte(hContact, "AvatarXVcard", 1); OnIqResultGotAvatar(hContact, n, mimeType); } @@ -1513,12 +1513,12 @@ LBL_ErrFormat: AI.format = pictureType; AI.hContact = hContact; - if (JGetByte(hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) { + if (getByte(hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) { GetAvatarFileName(hContact, tszFileName, SIZEOF(tszFileName)); DeleteFile(tszFileName); } - JSetByte(hContact, "AvatarType", pictureType); + setByte(hContact, "AvatarType", pictureType); char buffer[ 41 ]; mir_sha1_byte_t digest[20]; @@ -1536,7 +1536,7 @@ LBL_ErrFormat: if (out != NULL) { fwrite(body, resultLen, 1, out); fclose(out); - JSetString(hContact, "AvatarSaved", buffer); + setString(hContact, "AvatarSaved", buffer); ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, HANDLE(&AI), NULL); Log("Broadcast new avatar: %s",AI.filename); } @@ -1702,11 +1702,11 @@ void CJabberProto::OnIqResultEntityTime(HXML pIqNode, CJabberIqInfo* pInfo) if (GetTimeZoneInformation(&tzinfo) == TIME_ZONE_ID_DAYLIGHT) nTz -= tzinfo.DaylightBias / 30; - JSetByte(pInfo->m_hContact, "Timezone", (signed char)nTz); + setByte(pInfo->m_hContact, "Timezone", (signed char)nTz); LPCTSTR szTz = XPathFmt(pIqNode, _T("time[@xmlns='%s']/tz"), _T(JABBER_FEAT_ENTITY_TIME)); if (szTz) - JSetStringT(pInfo->m_hContact, "TzName", szTz); + setTString(pInfo->m_hContact, "TzName", szTz); else JDeleteSetting(pInfo->m_hContact, "TzName"); return; @@ -1714,7 +1714,7 @@ void CJabberProto::OnIqResultEntityTime(HXML pIqNode, CJabberIqInfo* pInfo) } else if (pInfo->m_nIqType == JABBER_IQ_TYPE_ERROR) { - if (JGetWord(pInfo->m_hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) + if (getWord(pInfo->m_hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) return; } diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index 5f4cb29764..4c145e1cfc 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -355,11 +355,11 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) if ((hContact=(HANDLE)wParam) == NULL) return 0; - BYTE bIsChatRoom = (BYTE)JGetByte(hContact, "ChatRoom", 0); - BYTE bIsTransport = (BYTE)JGetByte(hContact, "IsTransport", 0); + BYTE bIsChatRoom = (BYTE)getByte(hContact, "ChatRoom", 0); + BYTE bIsTransport = (BYTE)getByte(hContact, "IsTransport", 0); if ((bIsChatRoom == GCW_CHATROOM) || bIsChatRoom == 0) { - if ( !JGetStringT(hContact, bIsChatRoom?(char*)"ChatRoomID":(char*)"jid", &dbv)) { + if ( !getTString(hContact, bIsChatRoom?(char*)"ChatRoomID":(char*)"jid", &dbv)) { db_free(&dbv); Menu_ShowItem(g_hMenuConvert, TRUE); @@ -382,7 +382,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) } if (bIsChatRoom) { - if ( !JGetStringT(hContact, "ChatRoomID", &dbv)) { + if ( !getTString(hContact, "ChatRoomID", &dbv)) { Menu_ShowItem(g_hMenuRosterAdd, FALSE); if (ListGetItemPtr(LIST_BOOKMARK, dbv.ptszVal) == NULL) @@ -401,7 +401,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) Menu_ShowItem(g_hMenuRefresh, TRUE); } - if ( !JGetStringT(hContact, "jid", &dbv)) { + if ( !getTString(hContact, "jid", &dbv)) { JabberCapsBits jcb = GetTotalJidCapabilites(dbv.ptszVal); JABBER_LIST_ITEM* item = ListGetItemPtr(LIST_ROSTER, dbv.ptszVal); db_free(&dbv); @@ -486,14 +486,14 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuConvertChatContact(WPARAM wParam, LPARAM) { - BYTE bIsChatRoom = (BYTE)JGetByte((HANDLE) wParam, "ChatRoom", 0); + BYTE bIsChatRoom = (BYTE)getByte((HANDLE) wParam, "ChatRoom", 0); if ((bIsChatRoom == GCW_CHATROOM) || bIsChatRoom == 0) { DBVARIANT dbv; - if ( !JGetStringT((HANDLE) wParam, (bIsChatRoom == GCW_CHATROOM)?(char*)"ChatRoomID":(char*)"jid", &dbv)) { + if ( !getTString((HANDLE) wParam, (bIsChatRoom == GCW_CHATROOM)?(char*)"ChatRoomID":(char*)"jid", &dbv)) { JDeleteSetting((HANDLE) wParam, (bIsChatRoom == GCW_CHATROOM)?"ChatRoomID":"jid"); - JSetStringT((HANDLE) wParam, (bIsChatRoom != GCW_CHATROOM)?"ChatRoomID":"jid", dbv.ptszVal); + setTString((HANDLE) wParam, (bIsChatRoom != GCW_CHATROOM)?"ChatRoomID":"jid", dbv.ptszVal); db_free(&dbv); - JSetByte((HANDLE) wParam, "ChatRoom", (bIsChatRoom == GCW_CHATROOM)?0:GCW_CHATROOM); + setByte((HANDLE) wParam, "ChatRoom", (bIsChatRoom == GCW_CHATROOM)?0:GCW_CHATROOM); } } return 0; } @@ -502,7 +502,7 @@ INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM wParam, LPARAM) { DBVARIANT dbv; if ( !wParam) return 0; // we do not add ourself to the roster. (buggy situation - should not happen) - if ( JGetStringT((HANDLE)wParam, "ChatRoomID", &dbv)) return 0; + if ( getTString((HANDLE)wParam, "ChatRoomID", &dbv)) return 0; TCHAR *roomID = NEWTSTR_ALLOCA(dbv.ptszVal); db_free(&dbv); @@ -514,7 +514,7 @@ INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM wParam, LPARAM) group = NEWTSTR_ALLOCA(dbv.ptszVal); db_free(&dbv); } - if ( !JGetStringT((HANDLE)wParam, "Nick", &dbv)) { + if ( !getTString((HANDLE)wParam, "Nick", &dbv)) { nick = NEWTSTR_ALLOCA(dbv.ptszVal); db_free(&dbv); } @@ -525,7 +525,7 @@ INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM wParam, LPARAM) item = (JABBER_LIST_ITEM*)mir_calloc(sizeof(JABBER_LIST_ITEM)); item->jid = mir_tstrdup(roomID); item->name = mir_tstrdup(nick); - if ( !JGetStringT((HANDLE)wParam, "MyNick", &dbv)) { + if ( !getTString((HANDLE)wParam, "MyNick", &dbv)) { item->nick = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } @@ -545,7 +545,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleRequestAuth(WPARAM wParam, LPARAM) DBVARIANT dbv; if ((hContact=(HANDLE)wParam)!=NULL && m_bJabberOnline) { - if ( !JGetStringT(hContact, "jid", &dbv)) { + if ( !getTString(hContact, "jid", &dbv)) { m_ThreadInfo->send(XmlNode(_T("presence")) << XATTR(_T("to"), dbv.ptszVal) << XATTR(_T("type"), _T("subscribe"))); db_free(&dbv); } } @@ -559,7 +559,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleGrantAuth(WPARAM wParam, LPARAM) DBVARIANT dbv; if ((hContact=(HANDLE)wParam)!=NULL && m_bJabberOnline) { - if ( !JGetStringT(hContact, "jid", &dbv)) { + if ( !getTString(hContact, "jid", &dbv)) { m_ThreadInfo->send(XmlNode(_T("presence")) << XATTR(_T("to"), dbv.ptszVal) << XATTR(_T("type"), _T("subscribed"))); db_free(&dbv); } } @@ -573,7 +573,7 @@ INT_PTR __cdecl CJabberProto::OnMenuRevokeAuth(WPARAM wParam, LPARAM) DBVARIANT dbv; if ((hContact=(HANDLE)wParam) != NULL && m_bJabberOnline) { - if ( !JGetStringT(hContact, "jid", &dbv)) { + if ( !getTString(hContact, "jid", &dbv)) { m_ThreadInfo->send(XmlNode(_T("presence")) << XATTR(_T("to"), dbv.ptszVal) << XATTR(_T("type"), _T("unsubscribed"))); db_free(&dbv); } } @@ -584,11 +584,11 @@ INT_PTR __cdecl CJabberProto::OnMenuRevokeAuth(WPARAM wParam, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuTransportLogin(WPARAM wParam, LPARAM) { HANDLE hContact = (HANDLE)wParam; - if ( !JGetByte(hContact, "IsTransport", 0)) + if ( !getByte(hContact, "IsTransport", 0)) return 0; DBVARIANT jid; - if (JGetStringT(hContact, "jid", &jid)) + if (getTString(hContact, "jid", &jid)) return 0; JABBER_LIST_ITEM* item = ListGetItemPtr(LIST_ROSTER, jid.ptszVal); @@ -606,11 +606,11 @@ INT_PTR __cdecl CJabberProto::OnMenuTransportLogin(WPARAM wParam, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuTransportResolve(WPARAM wParam, LPARAM) { HANDLE hContact = (HANDLE)wParam; - if ( !JGetByte(hContact, "IsTransport", 0)) + if ( !getByte(hContact, "IsTransport", 0)) return 0; DBVARIANT jid; - if ( !JGetStringT(hContact, "jid", &jid)) { + if ( !getTString(hContact, "jid", &jid)) { ResolveTransportNicks(jid.ptszVal); db_free(&jid); } @@ -624,12 +624,12 @@ INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd(WPARAM wParam, LPARAM) return 0; // we do not add ourself to the roster. (buggy situation - should not happen) DBVARIANT dbv; - if ( !JGetStringT(hContact, "ChatRoomID", &dbv)) { + if ( !getTString(hContact, "ChatRoomID", &dbv)) { TCHAR *roomID = mir_tstrdup(dbv.ptszVal); db_free(&dbv); if (ListGetItemPtr(LIST_BOOKMARK, roomID) == NULL) { TCHAR *nick = 0; - if ( !JGetStringT(hContact, "Nick", &dbv)) { + if ( !getTString(hContact, "Nick", &dbv)) { nick = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } @@ -638,7 +638,7 @@ INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd(WPARAM wParam, LPARAM) item->jid = mir_tstrdup(roomID); item->name = pcli->pfnGetContactDisplayName(hContact, 0); item->type = _T("conference"); - if ( !JGetStringT(hContact, "MyNick", &dbv)) { + if ( !getTString(hContact, "MyNick", &dbv)) { item->nick = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } @@ -821,7 +821,7 @@ void CJabberProto::MenuInit() Menu_AddProtoMenuItem(&mi); } - UpdatePriorityMenu((short)JGetWord(NULL, "Priority", 0)); + UpdatePriorityMenu((short)getWord("Priority", 0)); ////////////////////////////////////////////////////////////////////////////////////// // finalize status menu @@ -839,10 +839,10 @@ INT_PTR CJabberProto::OnMenuSetPriority(WPARAM, LPARAM, LPARAM dwDelta) { int iDelta = (int)dwDelta; short priority = 0; - priority = (short)JGetWord(NULL, "Priority", 0) + iDelta; + priority = (short)getWord("Priority", 0) + iDelta; if (priority > 127) priority = 127; else if (priority < -128) priority = -128; - JSetWord(NULL, "Priority", priority); + setWord("Priority", priority); SendPresence(m_iStatus, true); return 0; } @@ -1055,7 +1055,7 @@ int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam) bSupportTyping = dbv.bVal == 1; db_free(&dbv); } - if (bSupportTyping && !JGetStringT(event->hContact, "jid", &dbv)) { + if (bSupportTyping && !getTString(event->hContact, "jid", &dbv)) { TCHAR jid[ JABBER_MAX_JID_LEN ]; GetClientJID(dbv.ptszVal, jid, SIZEOF(jid)); db_free(&dbv); @@ -1086,7 +1086,7 @@ int CJabberProto::OnProcessSrmmIconClick(WPARAM wParam, LPARAM lParam) return 0; DBVARIANT dbv; - if (JGetStringT(hContact, "jid", &dbv)) + if (getTString(hContact, "jid", &dbv)) return 0; JABBER_LIST_ITEM *LI = ListGetItemPtr(LIST_ROSTER, dbv.ptszVal); @@ -1145,7 +1145,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleResource(WPARAM wParam, LPARAM, LPARAM HANDLE hContact = (HANDLE)wParam; DBVARIANT dbv; - if (JGetStringT(hContact, "jid", &dbv)) + if (getTString(hContact, "jid", &dbv)) return 0; JABBER_LIST_ITEM *LI = ListGetItemPtr(LIST_ROSTER, dbv.ptszVal); @@ -1182,10 +1182,10 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM wParam, LPARAM l TCHAR *jid, text[ 1024 ]; DBVARIANT dbv; - int result = JGetStringT(hContact, "jid", &dbv); + int result = getTString(hContact, "jid", &dbv); if (result) { - result = JGetStringT(hContact, "ChatRoomID", &dbv); + result = getTString(hContact, "ChatRoomID", &dbv); if (result) return 0; JABBER_LIST_ITEM* item = ListGetItemPtr(LIST_CHATROOM, dbv.ptszVal); diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 1829f58653..dbe400af80 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -120,7 +120,7 @@ void CJabberProto::DBAddAuthRequest(const TCHAR *jid, const TCHAR *nick) { HANDLE hContact = DBCreateContact(jid, NULL, TRUE, TRUE); JDeleteSetting(hContact, "Hidden"); - //JSetStringT(hContact, "Nick", nick); + //setTString(hContact, "Nick", nick); char* szJid = mir_utf8encodeT(jid); char* szNick = mir_utf8encodeT(nick); @@ -175,7 +175,7 @@ HANDLE CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL t // We can't use JabberHContactFromJID() here because of the stripResource option for (hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { DBVARIANT dbv; - if ( !JGetStringT(hContact, "jid", &dbv)) { + if ( !getTString(hContact, "jid", &dbv)) { p = dbv.ptszVal; if (p && _tcslen(p) >= len && (p[len]=='\0'||p[len]=='/') && !_tcsnicmp(p, s, len)) { db_free(&dbv); @@ -188,9 +188,9 @@ HANDLE CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL t if (hContact == NULL) { hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName); - JSetStringT(hContact, "jid", s); + setTString(hContact, "jid", s); if (nick != NULL && *nick != '\0') - JSetStringT(hContact, "Nick", nick); + setTString(hContact, "Nick", nick); if (temporary) db_set_b(hContact, "CList", "NotOnList", 1); else @@ -268,7 +268,7 @@ void CJabberProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbL pszDest[ tPathLen++ ] = '\\'; char* szFileType = NULL; - switch(JGetByte(hContact, "AvatarType", PA_FORMAT_PNG)) { + switch(getByte(hContact, "AvatarType", PA_FORMAT_PNG)) { case PA_FORMAT_JPEG: szFileType = "jpg"; break; case PA_FORMAT_PNG: szFileType = "png"; break; case PA_FORMAT_GIF: szFileType = "gif"; break; @@ -317,13 +317,13 @@ void CJabberProto::ResolveTransportNicks(const TCHAR *jid) hContact = (HANDLE)db_find_first(m_szModuleName); for (; hContact != NULL; hContact = db_find_next(hContact, m_szModuleName)) { - if ( !JGetByte(hContact, "IsTransported", 0)) + if ( !getByte(hContact, "IsTransported", 0)) continue; DBVARIANT dbv, nick; - if (JGetStringT(hContact, "jid", &dbv)) + if (getTString(hContact, "jid", &dbv)) continue; - if (JGetStringT(hContact, "Nick", &nick)) { + if (getTString(hContact, "Nick", &nick)) { db_free(&dbv); continue; } @@ -545,18 +545,18 @@ void CJabberProto::UpdateMirVer(HANDLE hContact, JABBER_RESOURCE_STATUS *resourc TCHAR szMirVer[ 512 ]; FormatMirVer(resource, szMirVer, SIZEOF(szMirVer)); if (szMirVer[0]) - JSetStringT(hContact, "MirVer", szMirVer); + setTString(hContact, "MirVer", szMirVer); // else // JDeleteSetting(hContact, "MirVer"); DBVARIANT dbv; - if ( !JGetStringT(hContact, "jid", &dbv)) { + if ( !getTString(hContact, "jid", &dbv)) { TCHAR szFullJid[ JABBER_MAX_JID_LEN ]; if (resource->resourceName) mir_sntprintf(szFullJid, SIZEOF(szFullJid), _T("%s/%s"), dbv.ptszVal, resource->resourceName); else lstrcpyn(szFullJid, dbv.ptszVal, SIZEOF(szFullJid)); - JSetStringT(hContact, DBSETTING_DISPLAY_UID, szFullJid); + setTString(hContact, DBSETTING_DISPLAY_UID, szFullJid); db_free(&dbv); } } @@ -566,36 +566,36 @@ void CJabberProto::UpdateSubscriptionInfo(HANDLE hContact, JABBER_LIST_ITEM *ite switch (item->subscription) { case SUB_TO: - JSetStringT(hContact, "SubscriptionText", TranslateT("To")); - JSetString(hContact, "Subscription", "to"); - JSetByte(hContact, "Auth", 0); - JSetByte(hContact, "Grant", 1); + setTString(hContact, "SubscriptionText", TranslateT("To")); + setString(hContact, "Subscription", "to"); + setByte(hContact, "Auth", 0); + setByte(hContact, "Grant", 1); break; case SUB_FROM: - JSetStringT(hContact, "SubscriptionText", TranslateT("From")); - JSetString(hContact, "Subscription", "from"); - JSetByte(hContact, "Auth", 1); - JSetByte(hContact, "Grant", 0); + setTString(hContact, "SubscriptionText", TranslateT("From")); + setString(hContact, "Subscription", "from"); + setByte(hContact, "Auth", 1); + setByte(hContact, "Grant", 0); break; case SUB_BOTH: - JSetStringT(hContact, "SubscriptionText", TranslateT("Both")); - JSetString(hContact, "Subscription", "both"); - JSetByte(hContact, "Auth", 0); - JSetByte(hContact, "Grant", 0); + setTString(hContact, "SubscriptionText", TranslateT("Both")); + setString(hContact, "Subscription", "both"); + setByte(hContact, "Auth", 0); + setByte(hContact, "Grant", 0); break; case SUB_NONE: - JSetStringT(hContact, "SubscriptionText", TranslateT("None")); - JSetString(hContact, "Subscription", "none"); - JSetByte(hContact, "Auth", 1); - JSetByte(hContact, "Grant", 1); + setTString(hContact, "SubscriptionText", TranslateT("None")); + setString(hContact, "Subscription", "none"); + setByte(hContact, "Auth", 1); + setByte(hContact, "Grant", 1); break; } } void CJabberProto::SetContactOfflineStatus(HANDLE hContact) { - if (JGetWord(hContact, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) - JSetWord(hContact, "Status", ID_STATUS_OFFLINE); + if (getWord(hContact, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) + setWord(hContact, "Status", ID_STATUS_OFFLINE); JDeleteSetting(hContact, DBSETTING_XSTATUSID); JDeleteSetting(hContact, DBSETTING_XSTATUSNAME); diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp index 0a0ac98132..435eb17903 100644 --- a/protocols/JabberG/src/jabber_notes.cpp +++ b/protocols/JabberG/src/jabber_notes.cpp @@ -856,7 +856,7 @@ INT_PTR __cdecl CJabberProto::OnMenuSendNote(WPARAM wParam, LPARAM) if ( !wParam) return 0; TCHAR szClientJid[ JABBER_MAX_JID_LEN ]; - GetClientJID(JGetStringT((HANDLE)wParam, "jid"), szClientJid, SIZEOF(szClientJid)); + GetClientJID( JGetStringT((HANDLE)wParam, "jid"), szClientJid, SIZEOF(szClientJid)); CNoteItem *pItem = new CNoteItem(NULL, szClientJid); CJabberDlgBase *pDlg = new CJabberDlgNoteItem(this, pItem, &CJabberProto::ProcessOutgoingNote); diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index df48e8c672..0cc72adcdd 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -346,7 +346,7 @@ static void sttStoreJidFromUI(CJabberProto *ppro, CCtrlEdit &txtUsername, CCtrlC int len = lstrlen(user) + lstrlen(server) + 2; TCHAR *jid = (TCHAR *)mir_alloc(len * sizeof(TCHAR)); mir_sntprintf(jid, len, _T("%s@%s"), user, server); - ppro->JSetStringT(NULL, "jid", jid); + ppro->setTString(NULL, "jid", jid); mir_free(jid); mir_free(server); mir_free(user); @@ -526,7 +526,7 @@ protected: { TCHAR *szLanguageCode = (TCHAR *)m_cbLocale.GetItemData(index); if (szLanguageCode) { - m_proto->JSetStringT(NULL, "XmlLang", szLanguageCode); + m_proto->setTString(NULL, "XmlLang", szLanguageCode); mir_free(m_proto->m_tszSelectedLang); m_proto->m_tszSelectedLang = mir_tstrdup(szLanguageCode); @@ -871,11 +871,11 @@ public: HANDLE hContact = m_proto->HContactFromJID(item->jid); if (hContact != NULL) { if (bChecked) { - if (item->itemResource.status != m_proto->JGetWord(hContact, "Status", ID_STATUS_OFFLINE)) { - m_proto->JSetWord(hContact, "Status", (WORD)item->itemResource.status); + if (item->itemResource.status != m_proto->getWord(hContact, "Status", ID_STATUS_OFFLINE)) { + m_proto->setWord(hContact, "Status", (WORD)item->itemResource.status); } } - else if (m_proto->JGetWord(hContact, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) - m_proto->JSetWord(hContact, "Status", ID_STATUS_OFFLINE); + else if (m_proto->getWord(hContact, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) + m_proto->setWord(hContact, "Status", ID_STATUS_OFFLINE); } } } } @@ -1059,7 +1059,7 @@ void CJabberProto::_RosterHandleGetRequest(HXML node) // now it is require to process whole contact list to add not in roster contacts for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { DBVARIANT dbv; - if ( !JGetStringT(hContact, "jid", &dbv)) { + if ( !getTString(hContact, "jid", &dbv)) { LVFINDINFO lvfi={0}; lvfi.flags = LVFI_STRING; lvfi.psz = dbv.ptszVal; @@ -1777,11 +1777,11 @@ protected: db_free(&dbv); } - m_txtPort.SetInt(m_proto->JGetWord(NULL, "ManualPort", m_txtPort.GetInt())); + m_txtPort.SetInt(m_proto->getWord("ManualPort", m_txtPort.GetInt())); } else { int defPort = m_txtPort.GetInt(); - int port = m_proto->JGetWord(NULL, "Port", defPort); + int port = m_proto->getWord("Port", defPort); if (port != defPort) { @@ -1844,7 +1844,7 @@ protected: break; case ACC_GTALK: - m_proto->JSetWord(NULL, "Priority", 24); + m_proto->setWord("Priority", 24); { int port = m_txtPort.GetInt(); if (port == 443 || port == 5223) @@ -1882,15 +1882,15 @@ protected: if ((m_chkManualHost.GetState() == BST_CHECKED) && lstrcmpA(server, manualServer)) { m_proto->m_options.ManualConnect = TRUE; - m_proto->JSetString(NULL, "ManualHost", manualServer); - m_proto->JSetWord(NULL, "ManualPort", m_txtPort.GetInt()); - m_proto->JSetWord(NULL, "Port", m_txtPort.GetInt()); + m_proto->setString("ManualHost", manualServer); + m_proto->setWord("ManualPort", m_txtPort.GetInt()); + m_proto->setWord("Port", m_txtPort.GetInt()); } else { m_proto->m_options.ManualConnect = FALSE; m_proto->JDeleteSetting(NULL, "ManualHost"); m_proto->JDeleteSetting(NULL, "ManualPort"); - m_proto->JSetWord(NULL, "Port", m_txtPort.GetInt()); + m_proto->setWord("Port", m_txtPort.GetInt()); } sttStoreJidFromUI(m_proto, m_txtUsername, m_cbServer); diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 465d1a87ea..3dca46515f 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -434,7 +434,7 @@ public: for (HANDLE hContact = db_find_first(m_proto->m_szModuleName); hContact; hContact = db_find_next(hContact, m_proto->m_szModuleName)) { DBVARIANT dbv; - if ( !m_proto->JGetStringT(hContact, "jid", &dbv)) { + if ( !m_proto->getTString(hContact, "jid", &dbv)) { SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_ADDSTRING, 0, (LPARAM)dbv.ptszVal); db_free(&dbv); } @@ -1569,8 +1569,8 @@ void CJabberDlgPrivacyLists::CListBuildList(HWND hwndList, CPrivacyList *pList) hItem = m_clcClist.FindContact(hContact); DBVARIANT dbv = {0}; - if (m_proto->JGetStringT(hContact, "jid", &dbv)) - if (m_proto->JGetStringT(hContact, "ChatRoomID", &dbv)) + if (m_proto->getTString(hContact, "jid", &dbv)) + if (m_proto->getTString(hContact, "ChatRoomID", &dbv)) continue; szJid = dbv.ptszVal; diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index b6ca54517c..3a67f25fe6 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -179,7 +179,7 @@ CJabberProto::CJabberProto(const char* aProtoName, const TCHAR *aUserName) : db_set_resident(m_szModuleName, "Grant"); DBVARIANT dbv; - if ( !JGetStringT(NULL, "XmlLang", &dbv)) { + if ( !getTString(NULL, "XmlLang", &dbv)) { m_tszSelectedLang = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } @@ -312,11 +312,11 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM) for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { SetContactOfflineStatus(hContact); - if ( !JGetByte(hContact, "IsTransport", 0)) + if ( !getByte(hContact, "IsTransport", 0)) continue; DBVARIANT dbv; - if ( !JGetStringT(hContact, "jid", &dbv)) { + if ( !getTString(hContact, "jid", &dbv)) { TCHAR* domain = NEWTSTR_ALLOCA(dbv.ptszVal); TCHAR* resourcepos = _tcschr(domain, '/'); if (resourcepos != NULL) @@ -382,10 +382,10 @@ HANDLE CJabberProto::AddToListByJID(const TCHAR *newJid, DWORD flags) Log("Add new jid to contact jid = %S", jid); hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName); - JSetStringT(hContact, "jid", jid); + setTString(hContact, "jid", jid); if ((nick=JabberNickFromJID(newJid)) == NULL) nick = mir_tstrdup(newJid); -// JSetStringT(hContact, "Nick", nick); +// setTString(hContact, "Nick", nick); mir_free(nick); mir_free(jid); @@ -695,7 +695,7 @@ DWORD_PTR __cdecl CJabberProto::GetCaps(int type, HANDLE hContact) case PFLAG_MAXCONTACTSPERPACKET: { DBVARIANT dbv; - if (JGetStringT(hContact, "jid", &dbv)) + if (getTString(hContact, "jid", &dbv)) return 0; TCHAR szClientJid[ JABBER_MAX_JID_LEN ]; GetClientJID(dbv.ptszVal, szClientJid, SIZEOF(szClientJid)); @@ -717,10 +717,10 @@ int __cdecl CJabberProto::GetInfo(HANDLE hContact, int /*infoType*/) int result = 1; DBVARIANT dbv; - if (JGetByte(hContact, "ChatRoom", 0)) + if (getByte(hContact, "ChatRoom", 0)) return 1; - if ( !JGetStringT(hContact, "jid", &dbv)) { + if ( !getTString(hContact, "jid", &dbv)) { if (m_ThreadInfo) { TCHAR jid[ JABBER_MAX_JID_LEN ]; GetClientJID(dbv.ptszVal, jid, SIZEOF(jid)); @@ -988,7 +988,7 @@ int __cdecl CJabberProto::RecvUrl(HANDLE /*hContact*/, PROTORECVEVENT*) int __cdecl CJabberProto::SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList) { DBVARIANT dbv; - if ( !m_bJabberOnline || JGetStringT(hContact, "jid", &dbv)) + if ( !m_bJabberOnline || getTString(hContact, "jid", &dbv)) return 0; TCHAR szClientJid[ JABBER_MAX_JID_LEN ]; @@ -1004,7 +1004,7 @@ int __cdecl CJabberProto::SendContacts(HANDLE hContact, int flags, int nContacts HXML x = m << XCHILDNS(_T("x"), _T(JABBER_FEAT_ROSTER_EXCHANGE)); for (int i = 0; i < nContacts; i++) { - if ( !JGetStringT(hContactsList[i], "jid", &dbv)) { + if ( !getTString(hContactsList[i], "jid", &dbv)) { x << XCHILD(_T("item")) << XATTR(_T("action"), _T("add")) << XATTR(_T("jid"), dbv.ptszVal); db_free(&dbv); @@ -1025,11 +1025,11 @@ HANDLE __cdecl CJabberProto::SendFile(HANDLE hContact, const TCHAR *szDescriptio { if ( !m_bJabberOnline) return 0; - if (JGetWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) + if (getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) return 0; DBVARIANT dbv; - if (JGetStringT(hContact, "jid", &dbv)) + if (getTString(hContact, "jid", &dbv)) return 0; int i, j; @@ -1210,7 +1210,7 @@ int __cdecl CJabberProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc // if message sent to groupchat !lstrcmp(msgType, _T("groupchat")) || // if message delivery check disabled in settings - !m_options.MsgAck || !JGetByte(hContact, "MsgAck", TRUE)) + !m_options.MsgAck || !getByte(hContact, "MsgAck", TRUE)) { if ( !lstrcmp(msgType, _T("groupchat"))) xmlAddAttr(m, _T("to"), (TCHAR*)ptszJid); @@ -1254,16 +1254,16 @@ int __cdecl CJabberProto::SetApparentMode(HANDLE hContact, int mode) if (mode != 0 && mode != ID_STATUS_ONLINE && mode != ID_STATUS_OFFLINE) return 1; - int oldMode = JGetWord(hContact, "ApparentMode", 0); + int oldMode = getWord(hContact, "ApparentMode", 0); if (mode == oldMode) return 1; - JSetWord(hContact, "ApparentMode", (WORD)mode); + setWord(hContact, "ApparentMode", (WORD)mode); if ( !m_bJabberOnline) return 0; DBVARIANT dbv; - if ( !JGetStringT(hContact, "jid", &dbv)) { + if ( !getTString(hContact, "jid", &dbv)) { TCHAR* jid = dbv.ptszVal; switch (mode) { case ID_STATUS_ONLINE: @@ -1346,7 +1346,7 @@ void __cdecl CJabberProto::GetAwayMsgThread(void* hContact) int i, msgCount; size_t len; - if ( !JGetStringT(hContact, "jid", &dbv)) { + if ( !getTString(hContact, "jid", &dbv)) { if ((item = ListGetItemPtr(LIST_ROSTER, dbv.ptszVal)) != NULL) { db_free(&dbv); if (item->resourceCount > 0) { @@ -1483,7 +1483,7 @@ int __cdecl CJabberProto::UserIsTyping(HANDLE hContact, int type) if ( !m_bJabberOnline) return 0; DBVARIANT dbv; - if (JGetStringT(hContact, "jid", &dbv)) + if (getTString(hContact, "jid", &dbv)) return 0; JABBER_LIST_ITEM *item; diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 848381579d..81e0f8a3a7 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -784,22 +784,13 @@ struct CJabberProto : public PROTO //---- jabber_std.cpp ---------------------------------------------- void JDeleteSetting(HANDLE hContact, const char* valueName); - DWORD JGetByte(HANDLE hContact, const char* valueName, int parDefltValue); - DWORD JGetDword(HANDLE hContact, const char* valueName, DWORD parDefltValue); int JGetStaticString(const char* valueName, HANDLE hContact, char* dest, int dest_len); int JGetStringUtf(HANDLE hContact, char* valueName, DBVARIANT* dbv); - int JGetStringT(HANDLE hContact, char* valueName, DBVARIANT* dbv); TCHAR *JGetStringT(HANDLE hContact, char* valueName); TCHAR *JGetStringT(HANDLE hContact, char* valueName, TCHAR *&out); TCHAR *JGetStringT(HANDLE hContact, char* valueName, TCHAR *buf, int size); - WORD JGetWord(HANDLE hContact, const char* valueName, int parDefltValue); void JLoginFailed(int errorCode); - DWORD JSetByte(HANDLE hContact, const char* valueName, int parValue); - DWORD JSetDword(HANDLE hContact, const char* valueName, DWORD parValue); - DWORD JSetString(HANDLE hContact, const char* valueName, const char* parValue); - DWORD JSetStringT(HANDLE hContact, const char* valueName, const TCHAR *parValue); DWORD JSetStringUtf(HANDLE hContact, const char* valueName, const char* parValue); - DWORD JSetWord(HANDLE hContact, const char* valueName, int parValue); TCHAR* JGetStringCrypt(HANDLE hContact, char* valueName); DWORD JSetStringCrypt(HANDLE hContact, char* valueName, const TCHAR *parValue); diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index 05adbeb2e6..dbe490c9c1 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -312,7 +312,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhoc // priority TCHAR szPriority[ 256 ]; - mir_sntprintf(szPriority, SIZEOF(szPriority), _T("%d"), (short)JGetWord(NULL, "Priority", 5)); + mir_sntprintf(szPriority, SIZEOF(szPriority), _T("%d"), (short)getWord("Priority", 5)); xNode << XCHILD(_T("field")) << XATTR(_T("label"), TranslateT("Priority")) << XATTR(_T("type"), _T("text-single")) << XATTR(_T("var"), _T("status-priority")) << XCHILD(_T("value"), szPriority); @@ -370,7 +370,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhoc } if (priority >= -128 && priority <= 127) - JSetWord(NULL, "Priority", (WORD)priority); + setWord("Priority", (WORD)priority); const TCHAR *szStatusMessage = NULL; fieldNode = xmlGetChildByTag(xNode, "field", "var", _T("status-message")); @@ -479,7 +479,7 @@ int CJabberProto::RcGetUnreadEventsCount() int nEventsSent = 0; for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { DBVARIANT dbv; - if ( !JGetStringT(hContact, "jid", &dbv)) { + if ( !getTString(hContact, "jid", &dbv)) { HANDLE hDbEvent = db_event_firstUnread(hContact); while (hDbEvent) { DBEVENTINFO dbei = { sizeof(dbei) }; @@ -570,7 +570,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhocSe int nEventsSent = 0; for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { DBVARIANT dbv; - if ( JGetStringT(hContact, "jid", &dbv)) + if ( getTString(hContact, "jid", &dbv)) continue; HANDLE hDbEvent = db_event_firstUnread(hContact); diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index a3fb0ec390..a02630dca3 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -486,14 +486,14 @@ void CJabberProto::SearchDeleteFromRecent(const TCHAR *szAddr, BOOL deleteLastFr //search in recent for (int i=0; i<10; i++) { sprintf(key,"RecentlySearched_%d",i); - if ( !JGetStringT(NULL, key, &dbv)) { + if ( !getTString(NULL, key, &dbv)) { if ( !_tcsicmp(szAddr, dbv.ptszVal)) { db_free(&dbv); for (int j=i; j<10; j++) { sprintf(key, "RecentlySearched_%d", j+1); - if ( !JGetStringT(NULL, key, &dbv)) { + if ( !getTString(NULL, key, &dbv)) { sprintf(key,"RecentlySearched_%d",j); - JSetStringT(NULL,key,dbv.ptszVal); + setTString(NULL,key,dbv.ptszVal); db_free(&dbv); } else { @@ -515,14 +515,14 @@ void CJabberProto::SearchAddToRecent(const TCHAR *szAddr, HWND hwndDialog) SearchDeleteFromRecent(szAddr); for (int j=9; j > 0; j--) { sprintf(key, "RecentlySearched_%d", j-1); - if ( !JGetStringT(NULL, key, &dbv)) { + if ( !getTString(NULL, key, &dbv)) { sprintf(key,"RecentlySearched_%d",j); - JSetStringT(NULL,key,dbv.ptszVal); + setTString(NULL,key,dbv.ptszVal); db_free(&dbv); } } sprintf(key, "RecentlySearched_%d", 0); - JSetStringT(NULL, key, szAddr); + setTString(NULL, key, szAddr); if (hwndDialog) JabberSearchAddUrlToRecentCombo(hwndDialog, szAddr); } @@ -557,7 +557,7 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR char key[30]; for (i=0; i < 10; i++) { sprintf(key,"RecentlySearched_%d",i); - if ( !dat->ppro->JGetStringT(NULL, key, &dbv)) { + if ( !dat->ppro->getTString(NULL, key, &dbv)) { JabberSearchAddUrlToRecentCombo(hwndDlg, dbv.ptszVal); db_free(&dbv); } } diff --git a/protocols/JabberG/src/jabber_std.cpp b/protocols/JabberG/src/jabber_std.cpp index 4eff7b90c9..df45146891 100644 --- a/protocols/JabberG/src/jabber_std.cpp +++ b/protocols/JabberG/src/jabber_std.cpp @@ -30,16 +30,6 @@ void CJabberProto::JDeleteSetting(HANDLE hContact, const char* valueName) db_unset(hContact, m_szModuleName, valueName); } -DWORD CJabberProto::JGetByte(HANDLE hContact, const char* valueName, int parDefltValue) -{ - return db_get_b(hContact, m_szModuleName, valueName, parDefltValue); -} - -DWORD CJabberProto::JGetDword(HANDLE hContact, const char* valueName, DWORD parDefltValue) -{ - return db_get_dw(hContact, m_szModuleName, valueName, parDefltValue); -} - int CJabberProto::JGetStaticString(const char* valueName, HANDLE hContact, char* dest, int dest_len) { DBVARIANT dbv; @@ -62,15 +52,10 @@ int CJabberProto::JGetStringUtf(HANDLE hContact, char* valueName, DBVARIANT* dbv return db_get_utf(hContact, m_szModuleName, valueName, dbv); } -int CJabberProto::JGetStringT(HANDLE hContact, char* valueName, DBVARIANT* dbv) -{ - return db_get_ts(hContact, m_szModuleName, valueName, dbv); -} - TCHAR *CJabberProto::JGetStringT(HANDLE hContact, char* valueName) { DBVARIANT dbv = {0}; - if (JGetStringT(hContact, valueName, &dbv)) + if (getTString(hContact, valueName, &dbv)) return NULL; TCHAR *res = mir_tstrdup(dbv.ptszVal); @@ -86,7 +71,7 @@ TCHAR *CJabberProto::JGetStringT(HANDLE hContact, char* valueName, TCHAR *&out) TCHAR *CJabberProto::JGetStringT(HANDLE hContact, char* valueName, TCHAR *buf, int size) { DBVARIANT dbv = {0}; - if (JGetStringT(hContact, valueName, &dbv)) + if (getTString(hContact, valueName, &dbv)) return NULL; lstrcpyn(buf, dbv.ptszVal, size); @@ -94,53 +79,17 @@ TCHAR *CJabberProto::JGetStringT(HANDLE hContact, char* valueName, TCHAR *buf, i return buf; } -WORD CJabberProto::JGetWord(HANDLE hContact, const char* valueName, int parDefltValue) -{ - return db_get_w(hContact, m_szModuleName, valueName, parDefltValue); -} - void CJabberProto::JLoginFailed(int errorCode) { *m_savedPassword = 0; ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, errorCode); } -/* -DWORD CJabberProto::JSetByte(const char* valueName, int parValue) -{ - return db_set_b(NULL, m_szModuleName, valueName, parValue); -} -*/ -DWORD CJabberProto::JSetByte(HANDLE hContact, const char* valueName, int parValue) -{ - return db_set_b(hContact, m_szModuleName, valueName, parValue); -} - -DWORD CJabberProto::JSetDword(HANDLE hContact, const char* valueName, DWORD parValue) -{ - return db_set_dw(hContact, m_szModuleName, valueName, parValue); -} - -DWORD CJabberProto::JSetString(HANDLE hContact, const char* valueName, const char* parValue) -{ - return db_set_s(hContact, m_szModuleName, valueName, parValue); -} - -DWORD CJabberProto::JSetStringT(HANDLE hContact, const char* valueName, const TCHAR *parValue) -{ - return db_set_ts(hContact, m_szModuleName, valueName, parValue); -} - DWORD CJabberProto::JSetStringUtf(HANDLE hContact, const char* valueName, const char* parValue) { return db_set_utf(hContact, m_szModuleName, valueName, parValue); } -DWORD CJabberProto::JSetWord(HANDLE hContact, const char* valueName, int parValue) -{ - return db_set_w(hContact, m_szModuleName, valueName, parValue); -} - // save/load crypted strings void __forceinline sttCryptString(char *str) { @@ -166,7 +115,7 @@ DWORD CJabberProto::JSetStringCrypt(HANDLE hContact, char *valueName, const TCHA { char *tmp = mir_utf8encodeT(parValue); sttCryptString(tmp); - DWORD res = JSetString(hContact, valueName, tmp); + setString(hContact, valueName, tmp); mir_free(tmp); - return res; + return 0; } diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index 46753f4a74..bb43eb2406 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -139,7 +139,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam) GetAvatarFileName(AI->hContact, tszFileName, SIZEOF(tszFileName)); _tcsncpy(AI->filename, tszFileName, SIZEOF(AI->filename)); - AI->format = (AI->hContact == NULL) ? PA_FORMAT_PNG : JGetByte(AI->hContact, "AvatarType", 0); + AI->format = (AI->hContact == NULL) ? PA_FORMAT_PNG : getByte(AI->hContact, "AvatarType", 0); if (::_taccess(AI->filename, 0) == 0) { char szSavedHash[ 256 ]; @@ -151,10 +151,10 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam) if ((wParam & GAIF_FORCE) != 0 && AI->hContact != NULL && m_bJabberOnline) { DBVARIANT dbv; - if ( !JGetStringT(AI->hContact, "jid", &dbv)) { + if ( !getTString(AI->hContact, "jid", &dbv)) { JABBER_LIST_ITEM* item = ListGetItemPtr(LIST_ROSTER, dbv.ptszVal); if (item != NULL) { - BOOL isXVcard = JGetByte(AI->hContact, "AvatarXVcard", 0); + BOOL isXVcard = getByte(AI->hContact, "AvatarXVcard", 0); TCHAR szJid[ JABBER_MAX_JID_LEN ]; if (item->resourceCount != NULL && !isXVcard) { @@ -338,7 +338,7 @@ INT_PTR __cdecl CJabberProto::JabberSetAvatar(WPARAM, LPARAM lParam) } delete[] pResult; - JSetString(NULL, "AvatarSaved", buf); + setString("AvatarSaved", buf); } return 0; @@ -351,7 +351,7 @@ INT_PTR __cdecl CJabberProto::JabberSetNickname(WPARAM wParam, LPARAM lParam) { TCHAR *nickname = (wParam & SMNN_UNICODE) ? mir_u2t((WCHAR *) lParam) : mir_a2t((char *) lParam); - JSetStringT(NULL, "Nick", nickname); + setTString(NULL, "Nick", nickname); SetServerVcard(FALSE, _T("")); return 0; } @@ -590,7 +590,7 @@ INT_PTR __cdecl CJabberProto::JabberSendNudge(WPARAM wParam, LPARAM) HANDLE hContact = (HANDLE)wParam; DBVARIANT dbv; - if ( !JGetStringT(hContact, "jid", &dbv)) { + if ( !getTString(hContact, "jid", &dbv)) { TCHAR tszJid[ JABBER_MAX_JID_LEN ]; TCHAR *szResource = ListGetBestClientResourceNamePtr(dbv.ptszVal); if (szResource) @@ -788,7 +788,7 @@ HANDLE CJabberSysInterface::ContactFromJID(LPCTSTR jid) LPTSTR CJabberSysInterface::ContactToJID(HANDLE hContact) { - return m_psProto->JGetStringT(hContact, m_psProto->JGetByte(hContact, "ChatRoom", 0) ? "ChatRoomID" : "jid"); + return m_psProto->JGetStringT(hContact, m_psProto->getByte(hContact, "ChatRoom", 0) ? "ChatRoomID" : "jid"); } LPTSTR CJabberSysInterface::GetBestResourceName(LPCTSTR jid) diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 49b4e045e4..6168589863 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -79,7 +79,7 @@ static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa mir_sntprintf(text, SIZEOF(text), _T("%s %s"), TranslateT("Enter password for"), (TCHAR*)param->ptszJid); SetDlgItemText(hwndDlg, IDC_JID, text); - int bSavePassword = param->pro->JGetByte(NULL, "SaveSessionPassword", 0); + int bSavePassword = param->pro->getByte(NULL, "SaveSessionPassword", 0); CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, (bSavePassword) ? BST_CHECKED : BST_UNCHECKED); } return TRUE; @@ -91,12 +91,12 @@ static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa break; case IDOK: param->saveOnlinePassword = IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD); - param->pro->JSetByte(NULL, "SaveSessionPassword", param->saveOnlinePassword); + param->pro->setByte(NULL, "SaveSessionPassword", param->saveOnlinePassword); GetDlgItemText(hwndDlg, IDC_PASSWORD, param->onlinePassword, SIZEOF(param->onlinePassword)); { BOOL savePassword = IsDlgButtonChecked(hwndDlg, IDC_SAVE_PERM); - param->pro->JSetByte(NULL, "SavePassword", savePassword); + param->pro->setByte(NULL, "SavePassword", savePassword); if (savePassword) { param->pro->JSetStringCrypt(NULL,"LoginPassword",param->onlinePassword); param->saveOnlinePassword = TRUE; @@ -264,9 +264,9 @@ void CJabberProto::ServerThread(ThreadData* info) info->manualHost[SIZEOF(info->manualHost)-1] = '\0'; db_free(&dbv); } - info->port = JGetWord(NULL, "ManualPort", JABBER_DEFAULT_PORT); + info->port = getWord("ManualPort", JABBER_DEFAULT_PORT); } - else info->port = JGetWord(NULL, "Port", JABBER_DEFAULT_PORT); + else info->port = getWord("Port", JABBER_DEFAULT_PORT); info->useSSL = m_options.UseSSL; @@ -291,7 +291,7 @@ LBL_Exit: if (m_szStreamId) mir_free(m_szStreamId); m_szStreamId = NULL; - if ( !JGetStringT(NULL, "LoginName", &dbv)) { + if ( !getTString(NULL, "LoginName", &dbv)) { _tcsncpy(info->username, dbv.ptszVal, SIZEOF(info->username)-1); db_free(&dbv); } @@ -299,7 +299,7 @@ LBL_Exit: if (*rtrimt(info->username) == '\0') { DWORD dwSize = SIZEOF(info->username); if (GetUserName(info->username, &dwSize)) - JSetStringT(NULL, "LoginName", info->username); + setTString(NULL, "LoginName", info->username); else info->username[0] = 0; } @@ -326,7 +326,7 @@ LBL_FatalError: } if (m_options.HostNameAsResource == FALSE) { - if ( !JGetStringT(NULL, "Resource", &dbv)) { + if ( !getTString(NULL, "Resource", &dbv)) { _tcsncpy(info->resource, dbv.ptszVal, SIZEOF(info->resource) - 1); db_free(&dbv); } @@ -461,7 +461,7 @@ LBL_FatalError: m_szJabberJID = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len+1)); mir_sntprintf(m_szJabberJID, len+1, _T("%s@%S"), info->username, info->server); m_bSendKeepAlive = m_options.KeepAlive != 0; - JSetStringT(NULL, "jid", m_szJabberJID); // store jid in database + setTString(NULL, "jid", m_szJabberJID); // store jid in database } xmlStreamInitializeNow(info); @@ -914,7 +914,7 @@ void CJabberProto::OnProcessSuccess(HXML node, ThreadData* info) Log("Success: Logged-in."); if ( db_get_s(NULL, m_szModuleName, "Nick", &dbv)) - JSetStringT(NULL, "Nick", info->username); + setTString(NULL, "Nick", info->username); else db_free(&dbv); xmlStreamInitialize("after successful sasl"); @@ -1099,7 +1099,7 @@ HANDLE CJabberProto::CreateTemporaryContact(const TCHAR *szJid, JABBER_LIST_ITEM for (int i=0; i < chatItem->resourceCount; i++) { if ( !lstrcmp(chatItem->resource[i].resourceName, p)) { - JSetWord(hContact, "Status", chatItem->resource[i].status); + setWord(hContact, "Status", chatItem->resource[i].status); break; } } @@ -1578,8 +1578,8 @@ void CJabberProto::UpdateJidDbSettings(const TCHAR *jid) else JDeleteSetting(hContact, DBSETTING_DISPLAY_UID); if (_tcschr(jid, '@') != NULL || m_options.ShowTransport == TRUE) - if (JGetWord(hContact, "Status", ID_STATUS_OFFLINE) != status) - JSetWord(hContact, "Status", (WORD)status); + if (getWord(hContact, "Status", ID_STATUS_OFFLINE) != status) + setWord(hContact, "Status", (WORD)status); if (status == ID_STATUS_OFFLINE) { // remove x-status icon @@ -1680,10 +1680,10 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) if ((xNode = xmlGetChild(xNode , "hash")) != NULL && xmlGetText(xNode) != NULL) { JDeleteSetting(hContact,"AvatarXVcard"); Log("AvatarXVcard deleted"); - JSetStringT(hContact, "AvatarHash", xmlGetText(xNode)); + setTString(hContact, "AvatarHash", xmlGetText(xNode)); hasAvatar = true; DBVARIANT dbv; - int result = JGetStringT(hContact, "AvatarSaved", &dbv); + int result = getTString(hContact, "AvatarSaved", &dbv); if (result || lstrcmp(dbv.ptszVal, xmlGetText(xNode))) { Log("Avatar was changed"); ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, NULL); @@ -1700,12 +1700,12 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) if ((xNode = xmlGetChild(xNode , "photo")) != NULL) { LPCTSTR txt = xmlGetText(xNode); if (txt != NULL && txt[0] != 0) { - JSetByte(hContact, "AvatarXVcard", 1); + setByte(hContact, "AvatarXVcard", 1); Log("AvatarXVcard set"); - JSetStringT(hContact, "AvatarHash", txt); + setTString(hContact, "AvatarHash", txt); hasAvatar = true; DBVARIANT dbv; - int result = JGetStringT(hContact, "AvatarSaved", &dbv); + int result = getTString(hContact, "AvatarSaved", &dbv); if (result || lstrcmp(dbv.ptszVal, txt)) { Log("Avatar was changed. Using vcard-temp:x:update"); ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, NULL); @@ -1720,7 +1720,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) Log("Has no avatar"); JDeleteSetting(hContact, "AvatarHash"); DBVARIANT dbv = {0}; - if ( !JGetStringT(hContact, "AvatarSaved", &dbv)) { + if ( !getTString(hContact, "AvatarSaved", &dbv)) { db_free(&dbv); JDeleteSetting(hContact, "AvatarSaved"); ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, NULL); diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index ac7a4e0e79..14a39aea14 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -474,7 +474,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa if ( !dat->item) { DBVARIANT dbv = {0}; - if (dat->ppro->JGetStringT(dat->hContact, "jid", &dbv)) + if (dat->ppro->getTString(dat->hContact, "jid", &dbv)) break; if ( !(dat->item = dat->ppro->ListGetItemPtr(LIST_VCARD_TEMP, dbv.ptszVal))) @@ -569,7 +569,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa dat->ppro = (CJabberProto*)(CJabberProto*)((PSHNOTIFY*)lParam)->lParam; if (dat->hContact != NULL) { DBVARIANT dbv = {0}; - if (dat->ppro->JGetStringT(dat->hContact, "jid", &dbv)) + if (dat->ppro->getTString(dat->hContact, "jid", &dbv)) break; if ( !(dat->item = dat->ppro->ListGetItemPtr(LIST_VCARD_TEMP, dbv.ptszVal))) @@ -654,7 +654,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP photoInfo->hBitmap = NULL; } ShowWindow(GetDlgItem(hwndDlg, IDC_SAVE), SW_HIDE); - if ( !photoInfo->ppro->JGetStringT(photoInfo->hContact, "jid", &dbv)) { + if ( !photoInfo->ppro->getTString(photoInfo->hContact, "jid", &dbv)) { TCHAR* jid = dbv.ptszVal; if ((item = photoInfo->ppro->ListGetItemPtr(LIST_VCARD_TEMP, jid)) == NULL) item = photoInfo->ppro->ListGetItemPtr(LIST_ROSTER, jid); @@ -687,7 +687,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP TCHAR szFileName[MAX_PATH]; DWORD n; - if (photoInfo->ppro->JGetStringT(photoInfo->hContact, "jid", &dbv)) + if (photoInfo->ppro->getTString(photoInfo->hContact, "jid", &dbv)) break; TCHAR* jid = dbv.ptszVal; diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index d6895cc6cb..4fe35b0694 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -76,15 +76,15 @@ HANDLE CJabberProto::ChatRoomHContactFromJID(const TCHAR *jid) for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { DBVARIANT dbv; - int result = JGetStringT(hContact, "ChatRoomID", &dbv); + int result = getTString(hContact, "ChatRoomID", &dbv); if (result) - result = JGetStringT(hContact, "jid", &dbv); + result = getTString(hContact, "jid", &dbv); if ( !result) { int result; result = lstrcmpi(jid, dbv.ptszVal); db_free(&dbv); - if ( !result && JGetByte(hContact, "ChatRoom", 0) != 0) + if ( !result && getByte(hContact, "ChatRoom", 0) != 0) return hContact; } } @@ -106,9 +106,9 @@ HANDLE CJabberProto::HContactFromJID(const TCHAR *jid , BOOL bStripResource) int result; //safer way to check UID (coz some contact have both setting from convert to chat) if (db_get_b(hContact, m_szModuleName, "ChatRoom",0)) - result = JGetStringT(hContact, "ChatRoomID", &dbv); + result = getTString(hContact, "ChatRoomID", &dbv); else - result = JGetStringT(hContact, "jid", &dbv); + result = getTString(hContact, "jid", &dbv); if ( !result) { int result; @@ -116,7 +116,7 @@ HANDLE CJabberProto::HContactFromJID(const TCHAR *jid , BOOL bStripResource) result = lstrcmpi(jid, dbv.ptszVal); else { if (bStripResource == 3) { - if (JGetByte(hContact, "ChatRoom", 0)) + if (getByte(hContact, "ChatRoom", 0)) result = lstrcmpi(jid, dbv.ptszVal); // for chat room we have to have full contact matched else if (TRUE) result = _tcsnicmp(jid, dbv.ptszVal, _tcslen(dbv.ptszVal)); @@ -186,7 +186,7 @@ JABBER_RESOURCE_STATUS* CJabberProto::ResourceInfoFromJID(const TCHAR *jid) JABBER_LIST_ITEM* CJabberProto::GetItemFromContact(HANDLE hContact) { DBVARIANT dbv; - if (JGetStringT(hContact, "jid", &dbv)) + if (getTString(hContact, "jid", &dbv)) return NULL; JABBER_LIST_ITEM *pItem = ListGetItemPtr(LIST_ROSTER, dbv.ptszVal); @@ -611,7 +611,7 @@ void CJabberProto::SendVisibleInvisiblePresence(BOOL invisible) if (hContact == NULL) continue; - WORD apparentMode = JGetWord(hContact, "ApparentMode", 0); + WORD apparentMode = getWord(hContact, "ApparentMode", 0); if (invisible==TRUE && apparentMode==ID_STATUS_OFFLINE) m_ThreadInfo->send(XmlNode(_T("presence")) << XATTR(_T("to"), item->jid) << XATTR(_T("type"), _T("invisible"))); else if (invisible==FALSE && apparentMode==ID_STATUS_ONLINE) @@ -791,7 +791,7 @@ void CJabberProto::SendPresenceTo(int status, TCHAR* to, HXML extra, const TCHAR if ( !m_bJabberOnline) return; // Send update for status (we won't handle ID_STATUS_OFFLINE here) - short iPriority = (short)JGetWord(NULL, "Priority", 0); + short iPriority = (short)getWord("Priority", 0); UpdatePriorityMenu(iPriority); TCHAR szPriority[40]; @@ -1181,7 +1181,7 @@ void CJabberProto::ComboLoadRecentStrings(HWND hwndDlg, UINT idcCombo, char *par DBVARIANT dbv; char setting[MAXMODULELABELLENGTH]; mir_snprintf(setting, sizeof(setting), "%s%d", param, i); - if ( !JGetStringT(NULL, setting, &dbv)) { + if ( !getTString(NULL, setting, &dbv)) { SendDlgItemMessage(hwndDlg, idcCombo, CB_ADDSTRING, 0, (LPARAM)dbv.ptszVal); db_free(&dbv); } } @@ -1201,11 +1201,11 @@ void CJabberProto::ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param if ((id = SendDlgItemMessage(hwndDlg, idcCombo, CB_FINDSTRING, (WPARAM)-1, (LPARAM)_T(""))) != CB_ERR) SendDlgItemMessage(hwndDlg, idcCombo, CB_DELETESTRING, id, 0); - id = JGetByte(NULL, param, 0); + id = getByte(NULL, param, 0); char setting[MAXMODULELABELLENGTH]; mir_snprintf(setting, sizeof(setting), "%s%d", param, id); - JSetStringT(NULL, setting, string); - JSetByte(NULL, param, (id+1)%recentCount); + setTString(NULL, setting, string); + setByte(NULL, param, (id+1)%recentCount); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -1775,12 +1775,12 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) AI.format = pictureType; AI.hContact = avs[i].hContact; - if (JGetByte(AI.hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) { + if (getByte(AI.hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) { GetAvatarFileName(AI.hContact, tszFileName, SIZEOF(tszFileName)); DeleteFile(tszFileName); } - JSetByte(AI.hContact, "AvatarType", pictureType); + setByte(AI.hContact, "AvatarType", pictureType); char cmpsha[ 41 ]; char buffer[ 41 ]; @@ -1800,7 +1800,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) if (out != NULL) { fwrite(res->pData, res->dataLength, 1, out); fclose(out); - JSetString(AI.hContact, "AvatarSaved", buffer); + setString(AI.hContact, "AvatarSaved", buffer); ProtoBroadcastAck(AI.hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &AI, 0); Log("Broadcast new avatar: %s",AI.filename); } diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index fd036db767..be168868ce 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -595,7 +595,7 @@ static INT_PTR CALLBACK EditEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, } } GetDlgItemText(hwndDlg, IDC_EMAIL, text, SIZEOF(text)); mir_snprintf(idstr, SIZEOF(idstr), "e-mail%d", dat->id); - dat->ppro->JSetStringT(NULL, idstr, text); + dat->ppro->setTString(NULL, idstr, text); nFlag = 0; if (IsDlgButtonChecked(hwndDlg, IDC_HOME)) nFlag |= JABBER_VCEMAIL_HOME; @@ -603,7 +603,7 @@ static INT_PTR CALLBACK EditEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (IsDlgButtonChecked(hwndDlg, IDC_INTERNET)) nFlag |= JABBER_VCEMAIL_INTERNET; if (IsDlgButtonChecked(hwndDlg, IDC_X400)) nFlag |= JABBER_VCEMAIL_X400; mir_snprintf(idstr, SIZEOF(idstr), "e-mailFlag%d", dat->id); - dat->ppro->JSetWord(NULL, idstr, nFlag); + dat->ppro->setWord(idstr, nFlag); } // fall through case IDCANCEL: @@ -636,7 +636,7 @@ static INT_PTR CALLBACK EditPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, SetDlgItemTextA(hwndDlg, IDC_PHONE, dbv.pszVal); db_free(&dbv); wsprintfA(idstr, "PhoneFlag%d", dat->id); - nFlag = dat->ppro->JGetWord(NULL, idstr, 0); + nFlag = dat->ppro->getWord(idstr, 0); if (nFlag & JABBER_VCTEL_HOME) CheckDlgButton(hwndDlg, IDC_HOME, TRUE); if (nFlag & JABBER_VCTEL_WORK) CheckDlgButton(hwndDlg, IDC_WORK, TRUE); if (nFlag & JABBER_VCTEL_VOICE) CheckDlgButton(hwndDlg, IDC_VOICE, TRUE); @@ -670,7 +670,7 @@ static INT_PTR CALLBACK EditPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, } GetDlgItemTextA(hwndDlg, IDC_PHONE, text, SIZEOF(text)); wsprintfA(idstr, "Phone%d", dat->id); - dat->ppro->JSetString(NULL, idstr, text); + dat->ppro->setString(idstr, text); nFlag = 0; if (IsDlgButtonChecked(hwndDlg, IDC_HOME)) nFlag |= JABBER_VCTEL_HOME; if (IsDlgButtonChecked(hwndDlg, IDC_WORK)) nFlag |= JABBER_VCTEL_WORK; @@ -685,7 +685,7 @@ static INT_PTR CALLBACK EditPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (IsDlgButtonChecked(hwndDlg, IDC_ISDN)) nFlag |= JABBER_VCTEL_ISDN; if (IsDlgButtonChecked(hwndDlg, IDC_PCS)) nFlag |= JABBER_VCTEL_PCS; wsprintfA(idstr, "PhoneFlag%d", dat->id); - dat->ppro->JSetWord(NULL, idstr, nFlag); + dat->ppro->setWord(idstr, nFlag); } // fall through case IDCANCEL: @@ -875,12 +875,12 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP wsprintfA(idstr, szIdTemplate, i+1); if ( db_get_s(NULL, ppro->m_szModuleName, idstr, &dbv)) break; wsprintfA(idstr,szIdTemplate,i); - ppro->JSetString(NULL, idstr, dbv.pszVal); + ppro->setString(idstr, dbv.pszVal); wsprintfA(idstr, szFlagTemplate, i+1); db_free(&dbv); - nFlag = ppro->JGetWord(NULL, idstr, 0); + nFlag = ppro->getWord(idstr, 0); wsprintfA(idstr, szFlagTemplate, i); - ppro->JSetWord(NULL, idstr, nFlag); + ppro->setWord(idstr, nFlag); } wsprintfA(idstr, szIdTemplate, i); ppro->JDeleteSetting(NULL, idstr); @@ -934,44 +934,44 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) switch (iPage) { case 0: GetDlgItemText(hwndPage, IDC_FULLNAME, text, SIZEOF(text)); - JSetStringT(NULL, "FullName", text); + setTString(NULL, "FullName", text); GetDlgItemText(hwndPage, IDC_NICKNAME, text, SIZEOF(text)); - JSetStringT(NULL, "Nick", text); + setTString(NULL, "Nick", text); GetDlgItemText(hwndPage, IDC_FIRSTNAME, text, SIZEOF(text)); - JSetStringT(NULL, "FirstName", text); + setTString(NULL, "FirstName", text); GetDlgItemText(hwndPage, IDC_MIDDLE, text, SIZEOF(text)); - JSetStringT(NULL, "MiddleName", text); + setTString(NULL, "MiddleName", text); GetDlgItemText(hwndPage, IDC_LASTNAME, text, SIZEOF(text)); - JSetStringT(NULL, "LastName", text); + setTString(NULL, "LastName", text); GetDlgItemText(hwndPage, IDC_BIRTH, text, SIZEOF(text)); - JSetStringT(NULL, "BirthDate", text); + setTString(NULL, "BirthDate", text); switch(SendMessage(GetDlgItem(hwndPage, IDC_GENDER), CB_GETCURSEL, 0, 0)) { - case 0: JSetString(NULL, "GenderString", "Male"); break; - case 1: JSetString(NULL, "GenderString", "Female"); break; - default: JSetString(NULL, "GenderString", ""); break; + case 0: setString("GenderString", "Male"); break; + case 1: setString("GenderString", "Female"); break; + default: setString("GenderString", ""); break; } GetDlgItemText(hwndPage, IDC_OCCUPATION, text, SIZEOF(text)); - JSetStringT(NULL, "Role", text); + setTString(NULL, "Role", text); GetDlgItemText(hwndPage, IDC_HOMEPAGE, text, SIZEOF(text)); - JSetStringT(NULL, "Homepage", text); + setTString(NULL, "Homepage", text); break; // Page 1: Home case 1: GetDlgItemText(hwndPage, IDC_ADDRESS1, text, SIZEOF(text)); - JSetStringT(NULL, "Street", text); + setTString(NULL, "Street", text); GetDlgItemText(hwndPage, IDC_ADDRESS2, text, SIZEOF(text)); - JSetStringT(NULL, "Street2", text); + setTString(NULL, "Street2", text); GetDlgItemText(hwndPage, IDC_CITY, text, SIZEOF(text)); - JSetStringT(NULL, "City", text); + setTString(NULL, "City", text); GetDlgItemText(hwndPage, IDC_STATE, text, SIZEOF(text)); - JSetStringT(NULL, "State", text); + setTString(NULL, "State", text); GetDlgItemText(hwndPage, IDC_ZIP, text, SIZEOF(text)); - JSetStringT(NULL, "ZIP", text); + setTString(NULL, "ZIP", text); { int i = SendMessage(GetDlgItem(hwndPage, IDC_COUNTRY), CB_GETCURSEL, 0, 0); TCHAR *country = mir_a2t((i) ? g_countries[i+2].szName : g_countries[1].szName); - JSetStringT(NULL, "Country", country); + setTString(NULL, "Country", country); mir_free(country); } break; @@ -979,25 +979,25 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) // Page 2: Work case 2: GetDlgItemText(hwndPage, IDC_COMPANY, text, SIZEOF(text)); - JSetStringT(NULL, "Company", text); + setTString(NULL, "Company", text); GetDlgItemText(hwndPage, IDC_DEPARTMENT, text, SIZEOF(text)); - JSetStringT(NULL, "CompanyDepartment", text); + setTString(NULL, "CompanyDepartment", text); GetDlgItemText(hwndPage, IDC_TITLE, text, SIZEOF(text)); - JSetStringT(NULL, "CompanyPosition", text); + setTString(NULL, "CompanyPosition", text); GetDlgItemText(hwndPage, IDC_ADDRESS1, text, SIZEOF(text)); - JSetStringT(NULL, "CompanyStreet", text); + setTString(NULL, "CompanyStreet", text); GetDlgItemText(hwndPage, IDC_ADDRESS2, text, SIZEOF(text)); - JSetStringT(NULL, "CompanyStreet2", text); + setTString(NULL, "CompanyStreet2", text); GetDlgItemText(hwndPage, IDC_CITY, text, SIZEOF(text)); - JSetStringT(NULL, "CompanyCity", text); + setTString(NULL, "CompanyCity", text); GetDlgItemText(hwndPage, IDC_STATE, text, SIZEOF(text)); - JSetStringT(NULL, "CompanyState", text); + setTString(NULL, "CompanyState", text); GetDlgItemText(hwndPage, IDC_ZIP, text, SIZEOF(text)); - JSetStringT(NULL, "CompanyZIP", text); + setTString(NULL, "CompanyZIP", text); { int i = SendMessage(GetDlgItem(hwndPage, IDC_COUNTRY), CB_GETCURSEL, 0, 0); TCHAR *country = mir_a2t((i) ? g_countries[i+2].szName : g_countries[1].szName); - JSetStringT(NULL, "CompanyCountry", country); + setTString(NULL, "CompanyCountry", country); mir_free(country); } break; @@ -1008,7 +1008,7 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) // Page 4: Note case 4: GetDlgItemText(hwndPage, IDC_DESC, text, SIZEOF(text)); - JSetStringT(NULL, "About", text); + setTString(NULL, "About", text); break; // Page 5: Contacts @@ -1113,7 +1113,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) AppendVcardFromDB(n, "NUMBER", idstr); wsprintfA(idstr, "PhoneFlag%d", i); - nFlag = JGetWord(NULL, idstr, 0); + nFlag = getWord(idstr, 0); if (nFlag & JABBER_VCTEL_HOME) n << XCHILD(_T("HOME")); if (nFlag & JABBER_VCTEL_WORK) n << XCHILD(_T("WORK")); if (nFlag & JABBER_VCTEL_VOICE) n << XCHILD(_T("VOICE")); @@ -1191,8 +1191,8 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) CopyFile(szFileName, szAvatarName, FALSE); } - JSetString(NULL, "AvatarHash", buf); - JSetString(NULL, "AvatarSaved", buf); + setString("AvatarHash", buf); + setString("AvatarSaved", buf); } } mir_free(buffer); } diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 6cbedb9267..922030b6dd 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -285,7 +285,7 @@ void CJabberDlgPepSimple::cbModes_OnChange(CCtrlData *) if ((m_prevSelected >= 0) && (m_modes[m_cbModes.GetItemData(m_prevSelected)].m_id >= 0)) { TCHAR *txt = m_txtDescription.GetText(); mir_snprintf(szSetting, SIZEOF(szSetting), "PepMsg_%s", m_modes[m_cbModes.GetItemData(m_prevSelected)].m_name); - m_proto->JSetStringT(NULL, szSetting, txt); + m_proto->setTString(NULL, szSetting, txt); mir_free(txt); } @@ -294,7 +294,7 @@ void CJabberDlgPepSimple::cbModes_OnChange(CCtrlData *) mir_snprintf(szSetting, SIZEOF(szSetting), "PepMsg_%s", m_modes[m_cbModes.GetItemData(m_prevSelected)].m_name); DBVARIANT dbv; - if ( !m_proto->JGetStringT(NULL, szSetting, &dbv)) { + if ( !m_proto->getTString(NULL, szSetting, &dbv)) { m_txtDescription.SetText(dbv.ptszVal); db_free(&dbv); } @@ -726,10 +726,10 @@ void CPepMood::SetMood(HANDLE hContact, const TCHAR *szMood, const TCHAR *szText else SetExtraIcon(hContact, mood < 0 ? NULL : g_arrMoods[mood].szTag); if (szMood) { - m_proto->JSetByte(hContact, DBSETTING_XSTATUSID, mood); - m_proto->JSetStringT(hContact, DBSETTING_XSTATUSNAME, TranslateTS(g_arrMoods[mood].szName)); + m_proto->setByte(hContact, DBSETTING_XSTATUSID, mood); + m_proto->setTString(hContact, DBSETTING_XSTATUSNAME, TranslateTS(g_arrMoods[mood].szName)); if (szText) - m_proto->JSetStringT(hContact, DBSETTING_XSTATUSMSG, szText); + m_proto->setTString(hContact, DBSETTING_XSTATUSMSG, szText); else m_proto->JDeleteSetting(hContact, DBSETTING_XSTATUSMSG); @@ -1234,7 +1234,7 @@ void CJabberProto::SetContactTune(HANDLE hContact, LPCTSTR szArtist, LPCTSTR szL mir_sntprintf(szListeningTo, 2047, _T("%s - %s"), szTitle ? szTitle : _T(""), szArtist ? szArtist : _T("")); } - JSetStringT(hContact, "ListeningTo", szListeningTo); + setTString(hContact, "ListeningTo", szListeningTo); char tuneIcon[128]; mir_snprintf(tuneIcon, SIZEOF(tuneIcon), "%s_%s", m_szModuleName, "main"); diff --git a/protocols/MRA/src/MraAdvancedSearch.cpp b/protocols/MRA/src/MraAdvancedSearch.cpp index 15c087aed1..641464c497 100644 --- a/protocols/MRA/src/MraAdvancedSearch.cpp +++ b/protocols/MRA/src/MraAdvancedSearch.cpp @@ -146,26 +146,26 @@ INT_PTR CALLBACK AdvancedSearchDlgProc(HWND hWndDlg, UINT message, WPARAM wParam ResetComboBox(GetDlgItem(hWndDlg, IDC_CITY)); - if ( ppro->mraGetByte(NULL, "AdvancedSearchRemember", MRA_DEFAULT_SEARCH_REMEMBER)) { - SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_GENDER, CB_SETCURSEL, ppro->mraGetWord(NULL, "AdvancedSearchGender", 0), 0); - SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_AGERANGE_FROM, CB_SETCURSEL, ppro->mraGetWord(NULL, "AdvancedSearchAgeFrom", 0), 0); - SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_AGERANGE_TO, CB_SETCURSEL, ppro->mraGetWord(NULL, "AdvancedSearchAgeTo", 0), 0); - SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BIRTHDAY_MONTH, CB_SETCURSEL, ppro->mraGetWord(NULL, "AdvancedSearchBirthDayMonth", 0), 0); - SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BIRTHDAY_DAY, CB_SETCURSEL, ppro->mraGetWord(NULL, "AdvancedSearchBirthDayDay", 0), 0); + if ( ppro->getByte(NULL, "AdvancedSearchRemember", MRA_DEFAULT_SEARCH_REMEMBER)) { + SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_GENDER, CB_SETCURSEL, ppro->getWord(NULL, "AdvancedSearchGender", 0), 0); + SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_AGERANGE_FROM, CB_SETCURSEL, ppro->getWord(NULL, "AdvancedSearchAgeFrom", 0), 0); + SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_AGERANGE_TO, CB_SETCURSEL, ppro->getWord(NULL, "AdvancedSearchAgeTo", 0), 0); + SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BIRTHDAY_MONTH, CB_SETCURSEL, ppro->getWord(NULL, "AdvancedSearchBirthDayMonth", 0), 0); + SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BIRTHDAY_DAY, CB_SETCURSEL, ppro->getWord(NULL, "AdvancedSearchBirthDayDay", 0), 0); - SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_ZODIAK, CB_SETCURSEL, ppro->mraGetWord(NULL, "AdvancedSearchZodiakID", 0), 0); + SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_ZODIAK, CB_SETCURSEL, ppro->getWord(NULL, "AdvancedSearchZodiakID", 0), 0); - SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_COUNTRY, CB_SETCURSEL, ppro->mraGetWord(NULL, "AdvancedSearchCountryID", 0), 0); + SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_COUNTRY, CB_SETCURSEL, ppro->getWord(NULL, "AdvancedSearchCountryID", 0), 0); SendMessageW(hWndDlg, WM_COMMAND, (WPARAM)MAKELONG(IDC_COUNTRY, CBN_SELCHANGE), (LPARAM)GetDlgItem(hWndDlg, IDC_COUNTRY)); - SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_STATE, CB_SETCURSEL, ppro->mraGetWord(NULL, "AdvancedSearchStateID", 0), 0); + SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_STATE, CB_SETCURSEL, ppro->getWord(NULL, "AdvancedSearchStateID", 0), 0); SendMessageW(hWndDlg, WM_COMMAND, (WPARAM)MAKELONG(IDC_STATE, CBN_SELCHANGE), (LPARAM)GetDlgItem(hWndDlg, IDC_STATE)); - SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_CITY, CB_SETCURSEL, ppro->mraGetWord(NULL, "AdvancedSearchCityID", 0), 0); + SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_CITY, CB_SETCURSEL, ppro->getWord(NULL, "AdvancedSearchCityID", 0), 0); - CHECK_DLG_BUTTON(hWndDlg, IDC_ONLINEONLY, ppro->mraGetByte(NULL, "AdvancedSearchOnlineOnly", FALSE)); + CHECK_DLG_BUTTON(hWndDlg, IDC_ONLINEONLY, ppro->getByte(NULL, "AdvancedSearchOnlineOnly", FALSE)); CHECK_DLG_BUTTON(hWndDlg, IDC_CHK_REMEMBER, TRUE); } TranslateDialogDefault(hWndDlg); @@ -173,20 +173,20 @@ INT_PTR CALLBACK AdvancedSearchDlgProc(HWND hWndDlg, UINT message, WPARAM wParam return TRUE; case WM_DESTROY: - ppro->mraSetWord(NULL, "AdvancedSearchGender", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_GENDER, CB_GETCURSEL, 0, 0)); - ppro->mraSetWord(NULL, "AdvancedSearchAgeFrom", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_AGERANGE_FROM, CB_GETCURSEL, 0, 0)); - ppro->mraSetWord(NULL, "AdvancedSearchAgeTo", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_AGERANGE_TO, CB_GETCURSEL, 0, 0)); - ppro->mraSetWord(NULL, "AdvancedSearchBirthDayMonth", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BIRTHDAY_MONTH, CB_GETCURSEL, 0, 0)); - ppro->mraSetWord(NULL, "AdvancedSearchBirthDayDay", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BIRTHDAY_DAY, CB_GETCURSEL, 0, 0)); + ppro->setWord(NULL, "AdvancedSearchGender", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_GENDER, CB_GETCURSEL, 0, 0)); + ppro->setWord(NULL, "AdvancedSearchAgeFrom", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_AGERANGE_FROM, CB_GETCURSEL, 0, 0)); + ppro->setWord(NULL, "AdvancedSearchAgeTo", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_AGERANGE_TO, CB_GETCURSEL, 0, 0)); + ppro->setWord(NULL, "AdvancedSearchBirthDayMonth", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BIRTHDAY_MONTH, CB_GETCURSEL, 0, 0)); + ppro->setWord(NULL, "AdvancedSearchBirthDayDay", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BIRTHDAY_DAY, CB_GETCURSEL, 0, 0)); - ppro->mraSetWord(NULL, "AdvancedSearchZodiakID", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_ZODIAK, CB_GETCURSEL, 0, 0)); + ppro->setWord(NULL, "AdvancedSearchZodiakID", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_ZODIAK, CB_GETCURSEL, 0, 0)); - ppro->mraSetWord(NULL, "AdvancedSearchCityID", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_CITY, CB_GETCURSEL, 0, 0)); - ppro->mraSetWord(NULL, "AdvancedSearchStateID", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_STATE, CB_GETCURSEL, 0, 0)); - ppro->mraSetWord(NULL, "AdvancedSearchCountryID", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_COUNTRY, CB_GETCURSEL, 0, 0)); + ppro->setWord(NULL, "AdvancedSearchCityID", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_CITY, CB_GETCURSEL, 0, 0)); + ppro->setWord(NULL, "AdvancedSearchStateID", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_STATE, CB_GETCURSEL, 0, 0)); + ppro->setWord(NULL, "AdvancedSearchCountryID", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_COUNTRY, CB_GETCURSEL, 0, 0)); - ppro->mraSetByte(NULL, "AdvancedSearchOnlineOnly", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_ONLINEONLY)); - ppro->mraSetByte(NULL, "AdvancedSearchRemember", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_CHK_REMEMBER)); + ppro->setByte(NULL, "AdvancedSearchOnlineOnly", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_ONLINEONLY)); + ppro->setByte(NULL, "AdvancedSearchRemember", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_CHK_REMEMBER)); break; case WM_COMMAND: diff --git a/protocols/MRA/src/MraAntiSpam.cpp b/protocols/MRA/src/MraAntiSpam.cpp index e3bc5edd82..527a1c8d81 100644 --- a/protocols/MRA/src/MraAntiSpam.cpp +++ b/protocols/MRA/src/MraAntiSpam.cpp @@ -85,14 +85,14 @@ INT_PTR CALLBACK MraAntiSpamDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, L SetWindowLongPtr(hWndDlg, GWLP_USERDATA, lParam); ppro = (CMraProto*)lParam; - CHECK_DLG_BUTTON(hWndDlg, IDC_ENABLE, ppro->mraGetByte(NULL, "AntiSpamEnable", MRA_ANTISPAM_DEFAULT_ENABLE)); - CHECK_DLG_BUTTON(hWndDlg, IDC_CHK_TEMP_CONTACTS, ppro->mraGetByte(NULL, "AntiSpamCheckTempContacts", MRA_ANTISPAM_DEFAULT_CHK_TEMP_CONTACTS)); - CHECK_DLG_BUTTON(hWndDlg, IDC_DELETE_SPAMBOT_CONTACT, ppro->mraGetByte(NULL, "AntiSpamDeteleSpamBotContacts", MRA_ANTISPAM_DEFAULT_DELETE_SPAMBOT_CONTACT)); - CHECK_DLG_BUTTON(hWndDlg, IDC_CLN_NON_ALPHNUM, ppro->mraGetByte(NULL, "AntiSpamCleanNonAlphaNumeric", MRA_ANTISPAM_DEFAULT_CLN_NON_ALPHNUM)); - SetDlgItemInt(hWndDlg, IDC_MAX_LANG_CHANGES, ppro->mraGetDword(NULL, "AntiSpamMaxLangChanges", MRA_ANTISPAM_DEFAULT_MAX_LNG_CHANGES), FALSE); - CHECK_DLG_BUTTON(hWndDlg, IDC_SHOWPOPUP, ppro->mraGetByte(NULL, "AntiSpamShowPopUp", MRA_ANTISPAM_DEFAULT_SHOWPOP)); - CHECK_DLG_BUTTON(hWndDlg, IDC_WRITETOSYSTEMHISTORY, ppro->mraGetByte(NULL, "AntiSpamWriteToSystemHistory", MRA_ANTISPAM_DEFAULT_WRITETOSYSTEMHISTORY)); - CHECK_DLG_BUTTON(hWndDlg, IDC_SEND_SPAM_REPORT_TO_SERVER, ppro->mraGetByte(NULL, "AntiSpamSendSpamReportToSrv", MRA_ANTISPAM_DEFAULT_SEND_SPAM_REPORT_TO_SERVER)); + CHECK_DLG_BUTTON(hWndDlg, IDC_ENABLE, ppro->getByte(NULL, "AntiSpamEnable", MRA_ANTISPAM_DEFAULT_ENABLE)); + CHECK_DLG_BUTTON(hWndDlg, IDC_CHK_TEMP_CONTACTS, ppro->getByte(NULL, "AntiSpamCheckTempContacts", MRA_ANTISPAM_DEFAULT_CHK_TEMP_CONTACTS)); + CHECK_DLG_BUTTON(hWndDlg, IDC_DELETE_SPAMBOT_CONTACT, ppro->getByte(NULL, "AntiSpamDeteleSpamBotContacts", MRA_ANTISPAM_DEFAULT_DELETE_SPAMBOT_CONTACT)); + CHECK_DLG_BUTTON(hWndDlg, IDC_CLN_NON_ALPHNUM, ppro->getByte(NULL, "AntiSpamCleanNonAlphaNumeric", MRA_ANTISPAM_DEFAULT_CLN_NON_ALPHNUM)); + SetDlgItemInt(hWndDlg, IDC_MAX_LANG_CHANGES, ppro->getDword(NULL, "AntiSpamMaxLangChanges", MRA_ANTISPAM_DEFAULT_MAX_LNG_CHANGES), FALSE); + CHECK_DLG_BUTTON(hWndDlg, IDC_SHOWPOPUP, ppro->getByte(NULL, "AntiSpamShowPopUp", MRA_ANTISPAM_DEFAULT_SHOWPOP)); + CHECK_DLG_BUTTON(hWndDlg, IDC_WRITETOSYSTEMHISTORY, ppro->getByte(NULL, "AntiSpamWriteToSystemHistory", MRA_ANTISPAM_DEFAULT_WRITETOSYSTEMHISTORY)); + CHECK_DLG_BUTTON(hWndDlg, IDC_SEND_SPAM_REPORT_TO_SERVER, ppro->getByte(NULL, "AntiSpamSendSpamReportToSrv", MRA_ANTISPAM_DEFAULT_SEND_SPAM_REPORT_TO_SERVER)); { // fill list char szSettingName[MAX_PATH]; @@ -163,14 +163,14 @@ INT_PTR CALLBACK MraAntiSpamDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, L WCHAR szBadWord[MAX_PATH]; size_t i, dwCount; - ppro->mraSetByte(NULL, "AntiSpamEnable", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_ENABLE)); - ppro->mraSetByte(NULL, "AntiSpamCheckTempContacts", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_CHK_TEMP_CONTACTS)); - ppro->mraSetByte(NULL, "AntiSpamDeteleSpamBotContacts", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_DELETE_SPAMBOT_CONTACT)); - ppro->mraSetByte(NULL, "AntiSpamCleanNonAlphaNumeric", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_CLN_NON_ALPHNUM)); - ppro->mraSetDword(NULL, "AntiSpamMaxLangChanges", (DWORD)GetDlgItemInt(hWndDlg, IDC_MAX_LANG_CHANGES, NULL, FALSE)); - ppro->mraSetByte(NULL, "AntiSpamShowPopUp", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_SHOWPOPUP)); - ppro->mraSetByte(NULL, "AntiSpamWriteToSystemHistory", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_WRITETOSYSTEMHISTORY)); - ppro->mraSetByte(NULL, "AntiSpamSendSpamReportToSrv", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_SEND_SPAM_REPORT_TO_SERVER)); + ppro->setByte(NULL, "AntiSpamEnable", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_ENABLE)); + ppro->setByte(NULL, "AntiSpamCheckTempContacts", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_CHK_TEMP_CONTACTS)); + ppro->setByte(NULL, "AntiSpamDeteleSpamBotContacts", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_DELETE_SPAMBOT_CONTACT)); + ppro->setByte(NULL, "AntiSpamCleanNonAlphaNumeric", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_CLN_NON_ALPHNUM)); + ppro->setDword(NULL, "AntiSpamMaxLangChanges", (DWORD)GetDlgItemInt(hWndDlg, IDC_MAX_LANG_CHANGES, NULL, FALSE)); + ppro->setByte(NULL, "AntiSpamShowPopUp", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_SHOWPOPUP)); + ppro->setByte(NULL, "AntiSpamWriteToSystemHistory", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_WRITETOSYSTEMHISTORY)); + ppro->setByte(NULL, "AntiSpamSendSpamReportToSrv", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_SEND_SPAM_REPORT_TO_SERVER)); dwCount = SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BAD_WORDS_LIST, LB_GETCOUNT, 0, 0); for (i = 0; i < dwCount; i++) { @@ -307,7 +307,7 @@ BOOL CMraProto::MraAntiSpamHasMessageBadWordsW(LPWSTR lpwszMessage, size_t dwMes CharLowerBuffW(lpwszMessageConverted, DWORD(dwMessageSize)); // 1 проход: считаем колличество переключений языка - dwtm = mraGetDword(NULL, "AntiSpamMaxLangChanges", MRA_ANTISPAM_DEFAULT_MAX_LNG_CHANGES); + dwtm = getDword(NULL, "AntiSpamMaxLangChanges", MRA_ANTISPAM_DEFAULT_MAX_LNG_CHANGES); if (dwtm) if (dwtm <= MraAntiSpamCalcLangChanges(lpwszMessageConverted, dwMessageSize)) bRet = TRUE; @@ -318,7 +318,7 @@ BOOL CMraProto::MraAntiSpamHasMessageBadWordsW(LPWSTR lpwszMessage, size_t dwMes // 3 проход: оставляем только буквы + цифры и снова ищем плохие слова if (bRet == FALSE) - if (mraGetByte(NULL, "AntiSpamCleanNonAlphaNumeric", MRA_ANTISPAM_DEFAULT_ENABLE)) { + if (getByte(NULL, "AntiSpamCleanNonAlphaNumeric", MRA_ANTISPAM_DEFAULT_ENABLE)) { dwMessageSize = MraAntiSpamCleanNonAlphaNumeric(lpwszMessageConverted, dwMessageSize); bRet = MraAntiSpamTestMessageForBadWordsW(lpwszMessageConverted, dwMessageSize); } @@ -334,7 +334,7 @@ DWORD CMraProto::MraAntiSpamReceivedMessageW(LPSTR lpszEMail, size_t dwEMailSize DWORD dwRet = MESSAGE_NOT_SPAM;; if ((dwMessageFlags&(MESSAGE_FLAG_SYSTEM|MESSAGE_FLAG_CONTACT|MESSAGE_FLAG_NOTIFY|MESSAGE_FLAG_SMS|MESSAGE_SMS_DELIVERY_REPORT|MESSAGE_FLAG_ALARM|MESSAGE_FLAG_MULTICHAT)) == 0) - if (mraGetByte(NULL, "AntiSpamEnable", MRA_ANTISPAM_DEFAULT_ENABLE)) + if (getByte(NULL, "AntiSpamEnable", MRA_ANTISPAM_DEFAULT_ENABLE)) if (IsEMailChatAgent(lpszEMail, dwEMailSize) == FALSE) { // enabled, message must be checked BOOL bCheckMessage = TRUE; dwRet = MESSAGE_SPAM; @@ -349,8 +349,8 @@ DWORD CMraProto::MraAntiSpamReceivedMessageW(LPSTR lpszEMail, size_t dwEMailSize dwRet = MESSAGE_NOT_SPAM; } else { // temp contact - if (mraGetByte(NULL, "AntiSpamCheckTempContacts", MRA_ANTISPAM_DEFAULT_CHK_TEMP_CONTACTS) == FALSE || - (((dwMessageFlags&MESSAGE_FLAG_AUTHORIZE) && mraGetByte(NULL, "AutoAuthGrandNewUsers", MRA_DEFAULT_AUTO_AUTH_GRAND_NEW_USERS) && mraGetByte(NULL, "AutoAuthGrandNewUsersDisableSPAMCheck", MRA_DEFAULT_AUTO_AUTH_GRAND_NEW_USERS_DISABLE_SPAM_CHECK)))) + if (getByte(NULL, "AntiSpamCheckTempContacts", MRA_ANTISPAM_DEFAULT_CHK_TEMP_CONTACTS) == FALSE || + (((dwMessageFlags&MESSAGE_FLAG_AUTHORIZE) && getByte(NULL, "AutoAuthGrandNewUsers", MRA_DEFAULT_AUTO_AUTH_GRAND_NEW_USERS) && getByte(NULL, "AutoAuthGrandNewUsersDisableSPAMCheck", MRA_DEFAULT_AUTO_AUTH_GRAND_NEW_USERS_DISABLE_SPAM_CHECK)))) {// проверка временного контакта bCheckMessage = FALSE; dwRet = MESSAGE_NOT_SPAM; @@ -365,9 +365,9 @@ DWORD CMraProto::MraAntiSpamReceivedMessageW(LPSTR lpszEMail, size_t dwEMailSize if (dwRet == MESSAGE_SPAM) { BOOL bAntiSpamShowPopup, bAntiSpamWriteToSystemHistory, bAntiSpamDeteleSpamBotContacts; - bAntiSpamShowPopup = (BOOL)mraGetByte(NULL, "AntiSpamShowPopUp", MRA_ANTISPAM_DEFAULT_SHOWPOP); - bAntiSpamWriteToSystemHistory = (BOOL)mraGetByte(NULL, "AntiSpamWriteToSystemHistory", MRA_ANTISPAM_DEFAULT_WRITETOSYSTEMHISTORY); - bAntiSpamDeteleSpamBotContacts = (BOOL)mraGetByte(NULL, "AntiSpamDeteleSpamBotContacts", MRA_ANTISPAM_DEFAULT_DELETE_SPAMBOT_CONTACT); + bAntiSpamShowPopup = (BOOL)getByte(NULL, "AntiSpamShowPopUp", MRA_ANTISPAM_DEFAULT_SHOWPOP); + bAntiSpamWriteToSystemHistory = (BOOL)getByte(NULL, "AntiSpamWriteToSystemHistory", MRA_ANTISPAM_DEFAULT_WRITETOSYSTEMHISTORY); + bAntiSpamDeteleSpamBotContacts = (BOOL)getByte(NULL, "AntiSpamDeteleSpamBotContacts", MRA_ANTISPAM_DEFAULT_DELETE_SPAMBOT_CONTACT); if (bAntiSpamShowPopup || bAntiSpamWriteToSystemHistory) { char szEMail[MAX_EMAIL_LEN]; diff --git a/protocols/MRA/src/MraAvatars.h b/protocols/MRA/src/MraAvatars.h index 67c0eff121..683fb525e0 100644 --- a/protocols/MRA/src/MraAvatars.h +++ b/protocols/MRA/src/MraAvatars.h @@ -7,8 +7,8 @@ #endif // _MSC_VER > 1000 #define PA_FORMAT_DEFAULT 255 // return file name of def avatar -#define GetContactAvatarFormat(hContact, dwDefaultFormat) mraGetByte(hContact, "AvatarType", dwDefaultFormat) -#define SetContactAvatarFormat(hContact, dwFormat) mraSetByte(hContact, "AvatarType", (BYTE)dwFormat) +#define GetContactAvatarFormat(hContact, dwDefaultFormat) getByte(hContact, "AvatarType", dwDefaultFormat) +#define SetContactAvatarFormat(hContact, dwFormat) setByte(hContact, "AvatarType", (BYTE)dwFormat) INT_PTR CALLBACK MraAvatarsQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam); diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp index a7e55bc247..9efcbb1e2c 100644 --- a/protocols/MRA/src/MraChat.cpp +++ b/protocols/MRA/src/MraChat.cpp @@ -233,10 +233,10 @@ int CMraProto::MraChatGcEventHook(WPARAM, LPARAM lParam) size_t dwMessageSize = lstrlenW(gch->ptszText); size_t dwEMailSize = (WideCharToMultiByte(MRA_CODE_PAGE, 0, gch->pDest->ptszID, -1, szEMail, SIZEOF(szEMail), NULL, NULL)-1); HANDLE hContact = MraHContactFromEmail(szEMail, dwEMailSize, FALSE, TRUE, NULL); - BOOL bSlowSend = mraGetByte(NULL, "SlowSend", MRA_DEFAULT_SLOW_SEND); + BOOL bSlowSend = getByte(NULL, "SlowSend", MRA_DEFAULT_SLOW_SEND); DWORD dwFlags = 0; - if (mraGetByte(NULL, "RTFSendEnable", MRA_DEFAULT_RTF_SEND_ENABLE) && (MraContactCapabilitiesGet(hContact)&FEATURE_FLAG_RTF_MESSAGE)) + if (getByte(NULL, "RTFSendEnable", MRA_DEFAULT_RTF_SEND_ENABLE) && (MraContactCapabilitiesGet(hContact)&FEATURE_FLAG_RTF_MESSAGE)) dwFlags |= MESSAGE_FLAG_RTF; INT_PTR iSendRet = MraMessageW(bSlowSend, hContact, ACKTYPE_MESSAGE, dwFlags, szEMail, dwEMailSize, gch->ptszText, dwMessageSize, NULL, 0); diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp index 21d853f511..7ba7402c54 100644 --- a/protocols/MRA/src/MraFilesQueue.cpp +++ b/protocols/MRA/src/MraFilesQueue.cpp @@ -82,19 +82,19 @@ INT_PTR CALLBACK MraFilesQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, ppro = (CMraProto*)lParam; { WCHAR szBuff[MAX_PATH]; - CHECK_DLG_BUTTON(hWndDlg, IDC_FILE_SEND_ENABLE_DIRECT_CONN, ppro->mraGetByte(NULL, "FileSendEnableDirectConn", MRA_DEF_FS_ENABLE_DIRECT_CONN)); - CHECK_DLG_BUTTON(hWndDlg, IDC_FILE_SEND_NOOUTCONNECTIONONRECEIVE, ppro->mraGetByte(NULL, "FileSendNoOutConnOnRcv", MRA_DEF_FS_NO_OUT_CONN_ON_RCV)); - CHECK_DLG_BUTTON(hWndDlg, IDC_FILE_SEND_NOOUTCONNECTIONONSEND, ppro->mraGetByte(NULL, "FileSendNoOutConnOnSend", MRA_DEF_FS_NO_OUT_CONN_ON_SEND)); - CHECK_DLG_BUTTON(hWndDlg, IDC_FILE_SEND_IGNORYADDITIONALPORTS, ppro->mraGetByte(NULL, "FileSendIgnoryAdditionalPorts", MRA_DEF_FS_IGNORY_ADDITIONAL_PORTS)); - CHECK_DLG_BUTTON(hWndDlg, IDC_FILE_SEND_HIDE_MY_ADDRESSES, ppro->mraGetByte(NULL, "FileSendHideMyAddresses", MRA_DEF_FS_HIDE_MY_ADDRESSES)); - CHECK_DLG_BUTTON(hWndDlg, IDC_FILE_SEND_ADD_EXTRA_ADDRESS, ppro->mraGetByte(NULL, "FileSendAddExtraAddresses", MRA_DEF_FS_ADD_EXTRA_ADDRESSES)); + CHECK_DLG_BUTTON(hWndDlg, IDC_FILE_SEND_ENABLE_DIRECT_CONN, ppro->getByte(NULL, "FileSendEnableDirectConn", MRA_DEF_FS_ENABLE_DIRECT_CONN)); + CHECK_DLG_BUTTON(hWndDlg, IDC_FILE_SEND_NOOUTCONNECTIONONRECEIVE, ppro->getByte(NULL, "FileSendNoOutConnOnRcv", MRA_DEF_FS_NO_OUT_CONN_ON_RCV)); + CHECK_DLG_BUTTON(hWndDlg, IDC_FILE_SEND_NOOUTCONNECTIONONSEND, ppro->getByte(NULL, "FileSendNoOutConnOnSend", MRA_DEF_FS_NO_OUT_CONN_ON_SEND)); + CHECK_DLG_BUTTON(hWndDlg, IDC_FILE_SEND_IGNORYADDITIONALPORTS, ppro->getByte(NULL, "FileSendIgnoryAdditionalPorts", MRA_DEF_FS_IGNORY_ADDITIONAL_PORTS)); + CHECK_DLG_BUTTON(hWndDlg, IDC_FILE_SEND_HIDE_MY_ADDRESSES, ppro->getByte(NULL, "FileSendHideMyAddresses", MRA_DEF_FS_HIDE_MY_ADDRESSES)); + CHECK_DLG_BUTTON(hWndDlg, IDC_FILE_SEND_ADD_EXTRA_ADDRESS, ppro->getByte(NULL, "FileSendAddExtraAddresses", MRA_DEF_FS_ADD_EXTRA_ADDRESSES)); if (ppro->mraGetStaticStringW(NULL, "FileSendExtraAddresses", szBuff, SIZEOF(szBuff), NULL)) SET_DLG_ITEM_TEXT(hWndDlg, IDC_FILE_SEND_EXTRA_ADDRESS, szBuff); - CHECK_DLG_BUTTON(hWndDlg, IDC_FILE_SEND_ENABLE_MRIMPROXY_CONS, ppro->mraGetByte(NULL, "FileSendEnableMRIMProxyCons", MRA_DEF_FS_ENABLE_MRIM_PROXY_CONS)); + CHECK_DLG_BUTTON(hWndDlg, IDC_FILE_SEND_ENABLE_MRIMPROXY_CONS, ppro->getByte(NULL, "FileSendEnableMRIMProxyCons", MRA_DEF_FS_ENABLE_MRIM_PROXY_CONS)); - SetDlgItemInt(hWndDlg, IDC_FILE_SEND_BLOCK_SIZE, ppro->mraGetDword(NULL, "FileSendBlockSize", MRA_DEFAULT_FILE_SEND_BLOCK_SIZE), FALSE); + SetDlgItemInt(hWndDlg, IDC_FILE_SEND_BLOCK_SIZE, ppro->getDword(NULL, "FileSendBlockSize", MRA_DEFAULT_FILE_SEND_BLOCK_SIZE), FALSE); MraFilesQueueDlgEnableDirectConsControls(hWndDlg, IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_FILE_SEND_ENABLE_DIRECT_CONN)); } @@ -117,16 +117,16 @@ INT_PTR CALLBACK MraFilesQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, { WCHAR szBuff[MAX_PATH]; - ppro->mraSetByte(NULL, "FileSendEnableDirectConn", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_FILE_SEND_ENABLE_DIRECT_CONN)); - ppro->mraSetByte(NULL, "FileSendNoOutConnOnRcv", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_FILE_SEND_NOOUTCONNECTIONONRECEIVE)); - ppro->mraSetByte(NULL, "FileSendNoOutConnOnSend", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_FILE_SEND_NOOUTCONNECTIONONSEND)); - ppro->mraSetByte(NULL, "FileSendIgnoryAdditionalPorts", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_FILE_SEND_IGNORYADDITIONALPORTS)); - ppro->mraSetByte(NULL, "FileSendHideMyAddresses", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_FILE_SEND_HIDE_MY_ADDRESSES)); - ppro->mraSetByte(NULL, "FileSendAddExtraAddresses", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_FILE_SEND_ADD_EXTRA_ADDRESS)); + ppro->setByte(NULL, "FileSendEnableDirectConn", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_FILE_SEND_ENABLE_DIRECT_CONN)); + ppro->setByte(NULL, "FileSendNoOutConnOnRcv", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_FILE_SEND_NOOUTCONNECTIONONRECEIVE)); + ppro->setByte(NULL, "FileSendNoOutConnOnSend", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_FILE_SEND_NOOUTCONNECTIONONSEND)); + ppro->setByte(NULL, "FileSendIgnoryAdditionalPorts", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_FILE_SEND_IGNORYADDITIONALPORTS)); + ppro->setByte(NULL, "FileSendHideMyAddresses", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_FILE_SEND_HIDE_MY_ADDRESSES)); + ppro->setByte(NULL, "FileSendAddExtraAddresses", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_FILE_SEND_ADD_EXTRA_ADDRESS)); GET_DLG_ITEM_TEXT(hWndDlg, IDC_FILE_SEND_EXTRA_ADDRESS, szBuff, SIZEOF(szBuff)); ppro->mraSetStringW(NULL, "FileSendExtraAddresses", szBuff); - ppro->mraSetDword(NULL, "FileSendBlockSize", (DWORD)GetDlgItemInt(hWndDlg, IDC_FILE_SEND_BLOCK_SIZE, NULL, FALSE)); - ppro->mraSetByte(NULL, "FileSendEnableMRIMProxyCons", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_FILE_SEND_ENABLE_MRIMPROXY_CONS)); + ppro->setDword(NULL, "FileSendBlockSize", (DWORD)GetDlgItemInt(hWndDlg, IDC_FILE_SEND_BLOCK_SIZE, NULL, FALSE)); + ppro->setByte(NULL, "FileSendEnableMRIMProxyCons", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_FILE_SEND_ENABLE_MRIMPROXY_CONS)); } return TRUE; } @@ -231,9 +231,9 @@ size_t CMraProto::MraFilesQueueGetLocalAddressesList(LPSTR lpszBuff, size_t dwBu CHAR szHostName[MAX_PATH] = {0}; LPSTR lpszCurPos = lpszBuff; - if (mraGetByte(NULL, "FileSendHideMyAddresses", MRA_DEF_FS_HIDE_MY_ADDRESSES)) + if (getByte(NULL, "FileSendHideMyAddresses", MRA_DEF_FS_HIDE_MY_ADDRESSES)) {// не выдаём врагу наш IP адрес!!! :) - if (mraGetByte(NULL, "FileSendAddExtraAddresses", MRA_DEF_FS_ADD_EXTRA_ADDRESSES) == FALSE) + if (getByte(NULL, "FileSendAddExtraAddresses", MRA_DEF_FS_ADD_EXTRA_ADDRESSES) == FALSE) {// только если не добавляем адрес роутера lpszCurPos += mir_snprintf(lpszCurPos, (dwBuffSize-((size_t)lpszCurPos-(size_t)lpszBuff)), MRA_FILES_NULL_ADDRR); } @@ -244,7 +244,7 @@ size_t CMraProto::MraFilesQueueGetLocalAddressesList(LPSTR lpszBuff, size_t dwBu size_t dwAdapter = 0; hostent *sh; - dwSelfExternalIP = NTOHL(mraGetDword(NULL, "IP", 0)); + dwSelfExternalIP = NTOHL(getDword(NULL, "IP", 0)); if (dwSelfExternalIP) { memmove(&btAddress, &dwSelfExternalIP, sizeof(DWORD)); lpszCurPos += mir_snprintf(lpszCurPos, (dwBuffSize-((size_t)lpszCurPos-(size_t)lpszBuff)), "%lu.%lu.%lu.%lu:%lu;", btAddress[0], btAddress[1], btAddress[2], btAddress[3], dwPort); @@ -259,7 +259,7 @@ size_t CMraProto::MraFilesQueueGetLocalAddressesList(LPSTR lpszBuff, size_t dwBu } } - if (mraGetByte(NULL, "FileSendAddExtraAddresses", MRA_DEF_FS_ADD_EXTRA_ADDRESSES))// добавляем произвольный адрес + if (getByte(NULL, "FileSendAddExtraAddresses", MRA_DEF_FS_ADD_EXTRA_ADDRESSES))// добавляем произвольный адрес if (mraGetStaticStringA(NULL, "FileSendExtraAddresses", szHostName, SIZEOF(szHostName), NULL)) lpszCurPos += mir_snprintf(lpszCurPos, (dwBuffSize-((size_t)lpszCurPos-(size_t)lpszBuff)), "%s:%lu;", szHostName, dwPort); @@ -336,7 +336,7 @@ DWORD CMraProto::MraFilesQueueCancel(HANDLE hFilesQueueHandle, DWORD dwIDRequest DWORD CMraProto::MraFilesQueueStartMrimProxy(HANDLE hFilesQueueHandle, DWORD dwIDRequest) { - if (!hFilesQueueHandle || !mraGetByte(NULL, "FileSendEnableMRIMProxyCons", MRA_DEF_FS_ENABLE_MRIM_PROXY_CONS)) + if (!hFilesQueueHandle || !getByte(NULL, "FileSendEnableMRIMProxyCons", MRA_DEF_FS_ENABLE_MRIM_PROXY_CONS)) return ERROR_INVALID_HANDLE; MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hFilesQueueHandle; @@ -445,17 +445,17 @@ HANDLE CMraProto::MraFilesQueueConnectOut(MRA_FILES_QUEUE_ITEM *dat) if (!dat) return NULL; - if (mraGetByte(NULL, "FileSendEnableDirectConn", MRA_DEF_FS_ENABLE_DIRECT_CONN) && InterlockedExchangeAdd((volatile LONG*)&dat->bIsWorking, 0) && ((dat->bSending == FALSE && mraGetByte(NULL, "FileSendNoOutConnOnRcv", MRA_DEF_FS_NO_OUT_CONN_ON_RCV) == FALSE) || (dat->bSending == TRUE && mraGetByte(NULL, "FileSendNoOutConnOnSend", MRA_DEF_FS_NO_OUT_CONN_ON_SEND) == FALSE))) { + if (getByte(NULL, "FileSendEnableDirectConn", MRA_DEF_FS_ENABLE_DIRECT_CONN) && InterlockedExchangeAdd((volatile LONG*)&dat->bIsWorking, 0) && ((dat->bSending == FALSE && getByte(NULL, "FileSendNoOutConnOnRcv", MRA_DEF_FS_NO_OUT_CONN_ON_RCV) == FALSE) || (dat->bSending == TRUE && getByte(NULL, "FileSendNoOutConnOnSend", MRA_DEF_FS_NO_OUT_CONN_ON_SEND) == FALSE))) { BOOL bFiltering = FALSE, bIsHTTPSProxyUsed = IsHTTPSProxyUsed(hNetlibUser); DWORD dwLocalPort = 0, dwConnectReTryCount, dwCurConnectReTryCount; size_t dwAddrCount; NETLIBOPENCONNECTION nloc = {0}; - if (mraGetByte(NULL, "FileSendIgnoryAdditionalPorts", MRA_DEF_FS_IGNORY_ADDITIONAL_PORTS) || bIsHTTPSProxyUsed) + if (getByte(NULL, "FileSendIgnoryAdditionalPorts", MRA_DEF_FS_IGNORY_ADDITIONAL_PORTS) || bIsHTTPSProxyUsed) {// фильтруем порты для одного IP, вместо 3 будем коннектится только к одному if (bIsHTTPSProxyUsed) dwLocalPort = MRA_SERVER_PORT_HTTPS; - else if ((dwLocalPort = mraGetWord(NULL, "ServerPort", MRA_DEFAULT_SERVER_PORT)) == MRA_SERVER_PORT_STANDART_NLB) + else if ((dwLocalPort = getWord(NULL, "ServerPort", MRA_DEFAULT_SERVER_PORT)) == MRA_SERVER_PORT_STANDART_NLB) dwLocalPort = MRA_SERVER_PORT_STANDART; dwAddrCount = 0; @@ -472,10 +472,10 @@ HANDLE CMraProto::MraFilesQueueConnectOut(MRA_FILES_QUEUE_ITEM *dat) if (dwAddrCount) { dat->hConnection = NULL; - dwConnectReTryCount = mraGetDword(NULL, "ConnectReTryCountFileSend", MRA_DEFAULT_CONN_RETRY_COUNT_FILES); + dwConnectReTryCount = getDword(NULL, "ConnectReTryCountFileSend", MRA_DEFAULT_CONN_RETRY_COUNT_FILES); nloc.cbSize = sizeof(nloc); nloc.flags = NLOCF_V2; - nloc.timeout = mraGetDword(NULL, "TimeOutConnectFileSend", ((MRA_TIMEOUT_DIRECT_CONN-1)/(dwAddrCount*dwConnectReTryCount)));// -1 сек чтобы был запас + nloc.timeout = getDword(NULL, "TimeOutConnectFileSend", ((MRA_TIMEOUT_DIRECT_CONN-1)/(dwAddrCount*dwConnectReTryCount)));// -1 сек чтобы был запас if (nloc.timeoutMRA_TIMEOUT_CONN_МАХ) nloc.timeout = MRA_TIMEOUT_CONN_МАХ; @@ -497,8 +497,8 @@ HANDLE CMraProto::MraFilesQueueConnectOut(MRA_FILES_QUEUE_ITEM *dat) ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTED, (HANDLE)dat->dwIDRequest, 0); if (MraFilesQueueHandCheck(dat->hConnection, dat)) { // связь установленная с тем кем нужно - mraSetDword(dat->hContact, "OldIP", mraGetDword(dat->hContact, "IP", 0)); - mraSetDword(dat->hContact, "IP", HTONL(dat->malAddrList.pmaliAddress[i].dwAddr)); + setDword(dat->hContact, "OldIP", getDword(dat->hContact, "IP", 0)); + setDword(dat->hContact, "IP", HTONL(dat->malAddrList.pmaliAddress[i].dwAddr)); break; } else { @@ -543,7 +543,7 @@ HANDLE CMraProto::MraFilesQueueConnectIn(MRA_FILES_QUEUE_ITEM *dat) size_t dwAddrListSize; // копируем адреса в соответствии с правилами и начинаем слушать порт - if (mraGetByte(NULL, "FileSendEnableDirectConn", MRA_DEF_FS_ENABLE_DIRECT_CONN)) { + if (getByte(NULL, "FileSendEnableDirectConn", MRA_DEF_FS_ENABLE_DIRECT_CONN)) { NETLIBBIND nlbBind = {0}; nlbBind.cbSize = sizeof(nlbBind); @@ -628,8 +628,8 @@ void MraFilesQueueConnectionReceived(HANDLE hNewConnection, DWORD dwRemoteIP, vo if ( dat->ppro->MraFilesQueueHandCheck(hNewConnection, dat)) { // связь установленная с тем кем нужно dat->hConnection = hNewConnection; ProtoBroadcastAck(dat->ppro->m_szModuleName, dat->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTED, (HANDLE)dat->dwIDRequest, 0); - dat->ppro->mraSetDword(dat->hContact, "OldIP", dat->ppro->mraGetDword(dat->hContact, "IP", 0)); - dat->ppro->mraSetDword(dat->hContact, "IP", dwRemoteIP); + dat->ppro->setDword(dat->hContact, "OldIP", dat->ppro->getDword(dat->hContact, "IP", 0)); + dat->ppro->setDword(dat->hContact, "IP", dwRemoteIP); SetEvent(dat->hWaitHandle); }else {// кажется кто то не туда подключилися :) ProtoBroadcastAck(dat->ppro->m_szModuleName, dat->hContact, ACKTYPE_FILE, ACKRESULT_LISTENING, (HANDLE)dat->dwIDRequest, 0); @@ -663,7 +663,7 @@ DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hFilesQueueHandle, DWORD dwFlags dat->dwIDRequest = dwIDRequest; dat->dwFlags = dwFlags; dat->hContact = hContact; - if (mraGetByte(NULL, "FileSendEnableMRIMProxyCons", MRA_DEF_FS_ENABLE_MRIM_PROXY_CONS)) + if (getByte(NULL, "FileSendEnableMRIMProxyCons", MRA_DEF_FS_ENABLE_MRIM_PROXY_CONS)) dat->hMraMrimProxyData = MraMrimProxyCreate(); dwFileNameTotalSize = 0; @@ -854,7 +854,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) bOK = FALSE; bContinue = TRUE; dwUpdateTimeNext = GetTickCount(); - nls.dwTimeout = (1000*mraGetDword(NULL, "TimeOutReceiveFileData", MRA_DEF_FS_TIMEOUT_RECV)); + nls.dwTimeout = (1000*getDword(NULL, "TimeOutReceiveFileData", MRA_DEF_FS_TIMEOUT_RECV)); nls.hReadConns[0] = dat->hConnection; ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_DATA, (HANDLE)dat->dwIDRequest, (LPARAM)&pfts); @@ -973,7 +973,7 @@ DWORD CMraProto::MraFilesQueueAddSend(HANDLE hFilesQueueHandle, DWORD dwFlags, H dat->dwIDRequest = InterlockedIncrement((LONG volatile*)&dwCMDNum);// уникальный, рандомный идентификатор dat->dwFlags = dwFlags; dat->hContact = hContact; - if (mraGetByte(NULL, "FileSendEnableMRIMProxyCons", MRA_DEF_FS_ENABLE_MRIM_PROXY_CONS)) dat->hMraMrimProxyData = MraMrimProxyCreate(); + if (getByte(NULL, "FileSendEnableMRIMProxyCons", MRA_DEF_FS_ENABLE_MRIM_PROXY_CONS)) dat->hMraMrimProxyData = MraMrimProxyCreate(); dat->dwFilesCount = dwFilesCount; dat->pmfqfFiles = (MRA_FILES_QUEUE_FILE*)mir_calloc((sizeof(MRA_FILES_QUEUE_FILE)*(dat->dwFilesCount+1))); dat->dwFilesTotalSize = 0; @@ -1034,7 +1034,7 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter) pfts.totalBytes = dat->dwFilesTotalSize; pfts.wszWorkingDir = dat->lpwszPath; - dwSendBlockSize = mraGetDword(NULL, "FileSendBlockSize", MRA_DEFAULT_FILE_SEND_BLOCK_SIZE); + dwSendBlockSize = getDword(NULL, "FileSendBlockSize", MRA_DEFAULT_FILE_SEND_BLOCK_SIZE); if (dwSendBlockSize>SIZEOF(btBuff)) dwSendBlockSize = SIZEOF(btBuff); if (dwSendBlockSize<512) dwSendBlockSize = MRA_DEFAULT_FILE_SEND_BLOCK_SIZE; diff --git a/protocols/MRA/src/MraMRIMProxy.cpp b/protocols/MRA/src/MraMRIMProxy.cpp index ebb4bfc722..bdbdf8eac6 100644 --- a/protocols/MRA/src/MraMRIMProxy.cpp +++ b/protocols/MRA/src/MraMRIMProxy.cpp @@ -111,7 +111,7 @@ DWORD CMraProto::MraMrimProxyConnect(HANDLE hMraMrimProxyData, HANDLE *phConnect if (pmmpd->malAddrList.dwAddrCount) { pmmpd->hConnection = NULL; bIsHTTPSProxyUsed = IsHTTPSProxyUsed(hNetlibUser); - dwConnectReTryCount = mraGetDword(NULL, "ConnectReTryCountMRIMProxy", MRA_DEFAULT_CONN_RETRY_COUNT_MRIMPROXY); + dwConnectReTryCount = getDword(NULL, "ConnectReTryCountMRIMProxy", MRA_DEFAULT_CONN_RETRY_COUNT_MRIMPROXY); nloc.cbSize = sizeof(nloc); nloc.flags = NLOCF_V2; nloc.timeout = ((MRA_TIMEOUT_DIRECT_CONN-1)/(pmmpd->malAddrList.dwAddrCount*dwConnectReTryCount));// -1 сек чтобы был запас diff --git a/protocols/MRA/src/MraPopUp.cpp b/protocols/MRA/src/MraPopUp.cpp index 0f301ade1c..3b6a4a46fa 100644 --- a/protocols/MRA/src/MraPopUp.cpp +++ b/protocols/MRA/src/MraPopUp.cpp @@ -44,24 +44,24 @@ INT_PTR CALLBACK MraPopupDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPAR char szBuff[MAX_PATH]; DWORD dwType = GET_CURRENT_COMBO_DATA(hWndDlg, IDC_COMBO_POPUP_TYPE); - bEnabled = GetBit(ppro->mraGetDword(NULL, "PopupsEventFilter", MRA_DEFAULT_POPUPS_EVENT_FILTER), dwType); + bEnabled = GetBit(ppro->getDword(NULL, "PopupsEventFilter", MRA_DEFAULT_POPUPS_EVENT_FILTER), dwType); CHECK_DLG_BUTTON(hWndDlg, IDC_CHK_ENABLE, bEnabled); mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SUseWinColors", lpcwszPopupsTypes[dwType]); - bUseWinColors = ppro->mraGetByte(NULL, szBuff, MRA_DEFAULT_POPUP_USE_WIN_COLORS); + bUseWinColors = ppro->getByte(NULL, szBuff, MRA_DEFAULT_POPUP_USE_WIN_COLORS); CHECK_DLG_BUTTON(hWndDlg, IDC_CHK_USE_WIN_COLORS, bUseWinColors); EnableWindow(GetDlgItem(hWndDlg, IDC_CHK_USE_WIN_COLORS), bEnabled); mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorBack", lpcwszPopupsTypes[dwType]); - SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_POPUP_BACKCOLOR, CPM_SETCOLOUR, 0, ppro->mraGetDword(NULL, szBuff, MRA_DEFAULT_POPUP_COLOR_BACK)); + SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_POPUP_BACKCOLOR, CPM_SETCOLOUR, 0, ppro->getDword(NULL, szBuff, MRA_DEFAULT_POPUP_COLOR_BACK)); EnableWindow(GetDlgItem(hWndDlg, IDC_POPUP_BACKCOLOR), (bEnabled && bUseWinColors == FALSE)); mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorText", lpcwszPopupsTypes[dwType]); - SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_POPUP_TEXTCOLOR, CPM_SETCOLOUR, 0, ppro->mraGetDword(NULL, szBuff, MRA_DEFAULT_POPUP_COLOR_TEXT)); + SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_POPUP_TEXTCOLOR, CPM_SETCOLOUR, 0, ppro->getDword(NULL, szBuff, MRA_DEFAULT_POPUP_COLOR_TEXT)); EnableWindow(GetDlgItem(hWndDlg, IDC_POPUP_TEXTCOLOR), (bEnabled && bUseWinColors == FALSE)); mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%STimeout", lpcwszPopupsTypes[dwType]); - SetDlgItemInt(hWndDlg, IDC_POPUP_TIMEOUT, ppro->mraGetDword(NULL, szBuff, MRA_DEFAULT_POPUP_TIMEOUT), FALSE); + SetDlgItemInt(hWndDlg, IDC_POPUP_TIMEOUT, ppro->getDword(NULL, szBuff, MRA_DEFAULT_POPUP_TIMEOUT), FALSE); EnableWindow(GetDlgItem(hWndDlg, IDC_POPUP_TIMEOUT), bEnabled); } break; @@ -98,25 +98,25 @@ INT_PTR CALLBACK MraPopupDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPAR { char szBuff[MAX_PATH]; DWORD dwType = GET_CURRENT_COMBO_DATA(hWndDlg, IDC_COMBO_POPUP_TYPE); - DWORD dwPopupsEventFilter = ppro->mraGetDword(NULL, "PopupsEventFilter", MRA_DEFAULT_POPUPS_EVENT_FILTER); + DWORD dwPopupsEventFilter = ppro->getDword(NULL, "PopupsEventFilter", MRA_DEFAULT_POPUPS_EVENT_FILTER); if (IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_CHK_ENABLE)) dwPopupsEventFilter |= (1<mraSetDword(NULL, "PopupsEventFilter", dwPopupsEventFilter); + ppro->setDword(NULL, "PopupsEventFilter", dwPopupsEventFilter); mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SUseWinColors", lpcwszPopupsTypes[dwType]); - ppro->mraSetByte(NULL, szBuff, IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_CHK_USE_WIN_COLORS)); + ppro->setByte(NULL, szBuff, IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_CHK_USE_WIN_COLORS)); mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorBack", lpcwszPopupsTypes[dwType]); - ppro->mraSetDword(NULL, szBuff, SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_POPUP_BACKCOLOR, CPM_GETCOLOUR, 0, 0)); + ppro->setDword(NULL, szBuff, SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_POPUP_BACKCOLOR, CPM_GETCOLOUR, 0, 0)); mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorText", lpcwszPopupsTypes[dwType]); - ppro->mraSetDword(NULL, szBuff, SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_POPUP_TEXTCOLOR, CPM_GETCOLOUR, 0, 0)); + ppro->setDword(NULL, szBuff, SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_POPUP_TEXTCOLOR, CPM_GETCOLOUR, 0, 0)); mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%STimeout", lpcwszPopupsTypes[dwType]); - ppro->mraSetDword(NULL, szBuff, GetDlgItemInt(hWndDlg, IDC_POPUP_TIMEOUT, NULL, FALSE)); + ppro->setDword(NULL, szBuff, GetDlgItemInt(hWndDlg, IDC_POPUP_TIMEOUT, NULL, FALSE)); } return TRUE; } @@ -229,8 +229,8 @@ void CMraProto::MraPopupShowFromContactW(HANDLE hContact, DWORD dwType, DWORD dw void CMraProto::MraPopupShowW(HANDLE hContact, DWORD dwType, DWORD dwFlags, LPWSTR lpszTitle, LPWSTR lpszMessage) { - if (mraGetByte(NULL, "PopupsEnabled", MRA_DEFAULT_POPUPS_ENABLED)) - if (GetBit(mraGetDword(NULL, "PopupsEventFilter", MRA_DEFAULT_POPUPS_EVENT_FILTER), dwType)) + if (getByte(NULL, "PopupsEnabled", MRA_DEFAULT_POPUPS_ENABLED)) + if (GetBit(getDword(NULL, "PopupsEventFilter", MRA_DEFAULT_POPUPS_EVENT_FILTER), dwType)) if ( ServiceExists(MS_POPUP_ADDPOPUPW)) { BOOL bUseWinColors; char szBuff[MAX_PATH]; @@ -281,21 +281,21 @@ void CMraProto::MraPopupShowW(HANDLE hContact, DWORD dwType, DWORD dwFlags, LPWS ppd->PluginData = dat; mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SUseWinColors", lpcwszPopupsTypes[dwType]); - bUseWinColors = mraGetByte(NULL, szBuff, MRA_DEFAULT_POPUP_USE_WIN_COLORS); + bUseWinColors = getByte(NULL, szBuff, MRA_DEFAULT_POPUP_USE_WIN_COLORS); if (bUseWinColors) { ppd->colorBack = GetSysColor(COLOR_BTNFACE); ppd->colorText = GetSysColor(COLOR_WINDOWTEXT); } else { mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorBack", lpcwszPopupsTypes[dwType]); - ppd->colorBack = mraGetDword(NULL, szBuff, MRA_DEFAULT_POPUP_COLOR_BACK); + ppd->colorBack = getDword(NULL, szBuff, MRA_DEFAULT_POPUP_COLOR_BACK); mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorText", lpcwszPopupsTypes[dwType]); - ppd->colorText = mraGetDword(NULL, szBuff, MRA_DEFAULT_POPUP_COLOR_TEXT); + ppd->colorText = getDword(NULL, szBuff, MRA_DEFAULT_POPUP_COLOR_TEXT); } mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%STimeout", lpcwszPopupsTypes[dwType]); - ppd->iSeconds = mraGetDword(NULL, szBuff, MRA_DEFAULT_POPUP_TIMEOUT); + ppd->iSeconds = getDword(NULL, szBuff, MRA_DEFAULT_POPUP_TIMEOUT); MraPopupThreadMarandaCallback((ULONG_PTR)ppd); } diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 50bb5891b1..dd1353cebb 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -63,7 +63,7 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) : hExtraInfo = ExtraIcon_Register("MRAStatus", LPGEN("Mail.ru extra info"), "mra_xstatus49"); bHideXStatusUI = FALSE; - m_iXStatus = mraGetByte(NULL, DBSETTING_XSTATUSID, MRA_MIR_XSTATUS_NONE); + m_iXStatus = getByte(NULL, DBSETTING_XSTATUSID, MRA_MIR_XSTATUS_NONE); if ( !IsXStatusValid(m_iXStatus)) m_iXStatus = MRA_MIR_XSTATUS_NONE; @@ -417,7 +417,7 @@ int CMraProto::SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* h } } - bSlowSend = mraGetByte(NULL, "SlowSend", MRA_DEFAULT_SLOW_SEND); + bSlowSend = getByte(NULL, "SlowSend", MRA_DEFAULT_SLOW_SEND); iRet = MraMessageW(bSlowSend, hContact, ACKTYPE_CONTACTS, MESSAGE_FLAG_CONTACT, szEMail, dwEMailSize, lpwszData, (lpwszDataCurrent-lpwszData), NULL, 0); if (bSlowSend == FALSE) ProtoBroadcastAck(hContact, ACKTYPE_CONTACTS, ACKRESULT_SUCCESS, (HANDLE)iRet, 0); @@ -468,8 +468,8 @@ int CMraProto::SendMsg(HANDLE hContact, int flags, const char *lpszMessage) size_t dwEMailSize; if ( mraGetStaticStringA(hContact, "e-mail", szEMail, SIZEOF(szEMail), &dwEMailSize)) { - BOOL bSlowSend = mraGetByte(NULL, "SlowSend", MRA_DEFAULT_SLOW_SEND); - if ( mraGetByte(NULL, "RTFSendEnable", MRA_DEFAULT_RTF_SEND_ENABLE) && (MraContactCapabilitiesGet(hContact) & FEATURE_FLAG_RTF_MESSAGE)) + BOOL bSlowSend = getByte(NULL, "SlowSend", MRA_DEFAULT_SLOW_SEND); + if ( getByte(NULL, "RTFSendEnable", MRA_DEFAULT_RTF_SEND_ENABLE) && (MraContactCapabilitiesGet(hContact) & FEATURE_FLAG_RTF_MESSAGE)) dwFlags |= MESSAGE_FLAG_RTF; iRet = MraMessageW(bSlowSend, hContact, ACKTYPE_MESSAGE, dwFlags, szEMail, dwEMailSize, lpwszMessage, lstrlen(lpwszMessage), NULL, 0); @@ -490,7 +490,7 @@ int CMraProto::SetApparentMode(HANDLE hContact, int mode) // Only 3 modes are supported if (hContact && (mode == 0 || mode == ID_STATUS_ONLINE || mode == ID_STATUS_OFFLINE)) { - DWORD dwOldMode = mraGetWord(hContact, "ApparentMode", 0); + DWORD dwOldMode = getWord(hContact, "ApparentMode", 0); // Dont send redundant updates if (mode != dwOldMode) { @@ -598,7 +598,7 @@ HANDLE CMraProto::GetAwayMsg(HANDLE hContact) if ( mraGetStaticStringW(hContact, DBSETTING_BLOGSTATUS, szBlogStatus, SIZEOF(szBlogStatus), NULL)) { SYSTEMTIME tt = {0}; - dwTime = mraGetDword(hContact, DBSETTING_BLOGSTATUSTIME, 0); + dwTime = getDword(hContact, DBSETTING_BLOGSTATUSTIME, 0); if (dwTime && MakeLocalSystemTimeFromTime32(dwTime, &tt)) mir_sntprintf(szTime, SIZEOF(szTime), _T("%04ld.%02ld.%02ld %02ld:%02ld: "), tt.wYear, tt.wMonth, tt.wDay, tt.wHour, tt.wMinute); else diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index 0037dcb81c..e47b815c0c 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -90,21 +90,6 @@ struct CMraProto : public PROTO __forceinline void mraDelValue(HANDLE Contact, const char *valueName) { db_unset(Contact, m_szModuleName, valueName); } - __forceinline DWORD mraGetDword(HANDLE Contact, const char *valueName, DWORD parDefltValue) { - return db_get_dw(Contact, m_szModuleName, valueName, parDefltValue); } - __forceinline void mraSetDword(HANDLE Contact, const char *valueName, DWORD parValue) { - db_set_dw(Contact, m_szModuleName, valueName, parValue); } - - __forceinline WORD mraGetWord(HANDLE Contact, const char *valueName, WORD parDefltValue) { - return db_get_w(Contact, m_szModuleName, valueName, parDefltValue); } - __forceinline void mraSetWord(HANDLE Contact, const char *valueName, WORD parValue) { - db_set_w(Contact, m_szModuleName, valueName, parValue); } - - __forceinline BYTE mraGetByte(HANDLE Contact, const char *valueName, BYTE parDefltValue) { - return db_get_b(Contact, m_szModuleName, valueName, parDefltValue); } - __forceinline void mraSetByte(HANDLE Contact, const char *valueName, BYTE parValue) { - db_set_b(Contact, m_szModuleName, valueName, parValue); } - __forceinline BOOL mraGetStaticStringA(HANDLE Contact, const char *ValueName, char *Ret, size_t RetBuffSize, size_t *pRetBuffSize) { return DB_GetStaticStringA(Contact, m_szModuleName, ValueName, Ret, RetBuffSize, pRetBuffSize); } __forceinline BOOL mraGetStaticStringW(HANDLE Contact, const char *ValueName, WCHAR *Ret, size_t RetBuffSize, size_t *pRetBuffSize) { diff --git a/protocols/MRA/src/MraRTFMsg.cpp b/protocols/MRA/src/MraRTFMsg.cpp index 34a6389f2e..52a370da10 100644 --- a/protocols/MRA/src/MraRTFMsg.cpp +++ b/protocols/MRA/src/MraRTFMsg.cpp @@ -213,7 +213,7 @@ DWORD CMraProto::MraConvertToRTFW(LPCWSTR lpwszMessage, size_t dwMessageSize, LP WideCharToMultiByte(MRA_CODE_PAGE, 0, lpwszMessage, dwMessageSize, lpszMessage, (dwMessageSize+32), NULL, NULL); - dwRTFFontColour = mraGetDword(NULL, "RTFFontColour", MRA_DEFAULT_RTF_FONT_COLOUR); + dwRTFFontColour = getDword(NULL, "RTFFontColour", MRA_DEFAULT_RTF_FONT_COLOUR); if ( !mraGetContactSettingBlob(NULL, "RTFFont", &lf, sizeof(LOGFONT), NULL)) { HDC hDC = GetDC(NULL);// kegl lf.lfCharSet = MRA_DEFAULT_RTF_FONT_CHARSET; diff --git a/protocols/MRA/src/MraSendCommand.cpp b/protocols/MRA/src/MraSendCommand.cpp index 00f7558033..4709a97415 100644 --- a/protocols/MRA/src/MraSendCommand.cpp +++ b/protocols/MRA/src/MraSendCommand.cpp @@ -107,7 +107,7 @@ DWORD CMraProto::MraMessageW(BOOL bAddToQueue, HANDLE hContact, DWORD dwAckType, lpszMessageRTF = (LPSTR)mir_calloc(dwRFTBuffSize); ptrA lpbRTFData((char*)mir_calloc(dwRFTBuffSize)); if (lpszMessageRTF && lpbRTFData) { - DWORD dwBackColour = mraGetDword(NULL, "RTFBackgroundColour", MRA_DEFAULT_RTF_BACKGROUND_COLOUR); + DWORD dwBackColour = getDword(NULL, "RTFBackgroundColour", MRA_DEFAULT_RTF_BACKGROUND_COLOUR); lpbDataCurrent = (LPBYTE)lpszMessageRTF; WideCharToMultiByte(MRA_CODE_PAGE, 0, lpwszMessage, dwMessageSize, (LPSTR)lpbRTFData, dwRFTBuffSize, NULL, NULL); @@ -133,7 +133,7 @@ DWORD CMraProto::MraMessageW(BOOL bAddToQueue, HANDLE hContact, DWORD dwAckType, ptrA lpbRTFData((char*)mir_calloc(dwRFTBuffSize)); if (lpszMessageRTF && lpbRTFData) { if ( !MraConvertToRTFW(lpwszMessage, dwMessageSize, (LPSTR)lpbRTFData, dwRFTBuffSize, &dwRTFDataSize)) { - DWORD dwBackColour = mraGetDword(NULL, "RTFBackgroundColour", MRA_DEFAULT_RTF_BACKGROUND_COLOUR); + DWORD dwBackColour = getDword(NULL, "RTFBackgroundColour", MRA_DEFAULT_RTF_BACKGROUND_COLOUR); lpbDataCurrent = (LPBYTE)lpszMessageRTF; SetUL(&lpbDataCurrent, 2); diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 3d5b14bc64..6bb3bff0b3 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -186,11 +186,11 @@ void CMraProto::MraAddrListStoreToContact(HANDLE hContact, MRA_ADDR_LIST *pmalAd if (!pmalAddrList->dwAddrCount) return; - mraSetDword(hContact, "OldIP", mraGetDword(hContact, "IP", 0)); - mraSetDword(hContact, "IP", HTONL(pmalAddrList->pmaliAddress[0].dwAddr)); + setDword(hContact, "OldIP", getDword(hContact, "IP", 0)); + setDword(hContact, "IP", HTONL(pmalAddrList->pmaliAddress[0].dwAddr)); if (pmalAddrList->dwAddrCount > 1) { - mraSetDword(hContact, "OldRealIP", mraGetDword(hContact, "RealIP", 0)); - mraSetDword(hContact, "RealIP", HTONL(pmalAddrList->pmaliAddress[1].dwAddr)); + setDword(hContact, "OldRealIP", getDword(hContact, "RealIP", 0)); + setDword(hContact, "RealIP", HTONL(pmalAddrList->pmaliAddress[1].dwAddr)); } } @@ -343,7 +343,7 @@ DWORD CMraProto::GetContactFlags(HANDLE hContact) CHAR szEMail[MAX_EMAIL_LEN]; size_t dwEMailSize; - dwRet = mraGetDword(hContact, "ContactFlags", 0); + dwRet = getDword(hContact, "ContactFlags", 0); dwRet &= ~(CONTACT_FLAG_REMOVED|CONTACT_FLAG_GROUP|CONTACT_FLAG_INVISIBLE|CONTACT_FLAG_VISIBLE|CONTACT_FLAG_IGNORE|CONTACT_FLAG_SHADOW|CONTACT_FLAG_MULTICHAT); dwRet |= CONTACT_FLAG_UNICODE_NAME; @@ -357,7 +357,7 @@ DWORD CMraProto::GetContactFlags(HANDLE hContact) if (db_get_b(hContact, "CList", "Hidden", 0)) dwRet |= CONTACT_FLAG_SHADOW; - switch (mraGetWord(hContact, "ApparentMode", 0)) { + switch (getWord(hContact, "ApparentMode", 0)) { case ID_STATUS_OFFLINE: dwRet |= CONTACT_FLAG_INVISIBLE; break; @@ -376,7 +376,7 @@ DWORD CMraProto::SetContactFlags(HANDLE hContact, DWORD dwContactFlag) if ( !IsContactMra(hContact)) return ERROR_INVALID_HANDLE; - mraSetDword(hContact, "ContactFlags", dwContactFlag); + setDword(hContact, "ContactFlags", dwContactFlag); if (dwContactFlag&CONTACT_FLAG_SHADOW) db_set_b(hContact, "CList", "Hidden", 1); @@ -385,13 +385,13 @@ DWORD CMraProto::SetContactFlags(HANDLE hContact, DWORD dwContactFlag) switch (dwContactFlag&(CONTACT_FLAG_INVISIBLE|CONTACT_FLAG_VISIBLE)) { case CONTACT_FLAG_INVISIBLE: - mraSetWord(hContact, "ApparentMode", ID_STATUS_OFFLINE); + setWord(hContact, "ApparentMode", ID_STATUS_OFFLINE); break; case CONTACT_FLAG_VISIBLE: - mraSetWord(hContact, "ApparentMode", ID_STATUS_ONLINE); + setWord(hContact, "ApparentMode", ID_STATUS_ONLINE); break; default: - mraSetWord(hContact, "ApparentMode", 0); + setWord(hContact, "ApparentMode", 0); break; } @@ -409,11 +409,11 @@ DWORD CMraProto::GetContactBasicInfoW(HANDLE hContact, DWORD *pdwID, DWORD *pdwG return ERROR_INVALID_HANDLE; if (pdwID) - *pdwID = mraGetDword(hContact, "ContactID", -1); + *pdwID = getDword(hContact, "ContactID", -1); if (pdwGroupID) - *pdwGroupID = mraGetDword(hContact, "GroupID", -1); + *pdwGroupID = getDword(hContact, "GroupID", -1); if (pdwContactSeverFlags) - *pdwContactSeverFlags = mraGetDword(hContact, "ContactSeverFlags", 0); + *pdwContactSeverFlags = getDword(hContact, "ContactSeverFlags", 0); if (pdwStatus) *pdwStatus = MraGetContactStatus(hContact); if (pdwContactFlag) @@ -447,11 +447,11 @@ DWORD CMraProto::SetContactBasicInfoW(HANDLE hContact, DWORD dwSetInfoFlags, DWO // LOCK if (dwSetInfoFlags & SCBIFSI_LOCK_CHANGES_EVENTS) - mraSetDword(hContact, "HooksLocked", TRUE); + setDword(hContact, "HooksLocked", TRUE); // поля которые нужны, и изменения которых не отслеживаются if (dwFlags & SCBIF_ID) - mraSetDword(hContact, "ContactID", dwID); + setDword(hContact, "ContactID", dwID); if (dwFlags & SCBIF_EMAIL) if (lpszEMail && dwEMailSize) @@ -459,7 +459,7 @@ DWORD CMraProto::SetContactBasicInfoW(HANDLE hContact, DWORD dwSetInfoFlags, DWO // поля изменения которых отслеживаются if (dwFlags & SCBIF_GROUP_ID) - mraSetDword(hContact, "GroupID", dwGroupID); + setDword(hContact, "GroupID", dwGroupID); if (dwFlags & SCBIF_NICK) { if ((dwFlags & SCBIF_FLAG) && ((dwContactFlag&CONTACT_FLAG_UNICODE_NAME) == 0)) @@ -504,7 +504,7 @@ DWORD CMraProto::SetContactBasicInfoW(HANDLE hContact, DWORD dwSetInfoFlags, DWO SetContactFlags(hContact, dwContactFlag); if (dwFlags & SCBIF_SERVER_FLAG) - mraSetDword(hContact, "ContactSeverFlags", dwContactSeverFlags); + setDword(hContact, "ContactSeverFlags", dwContactSeverFlags); if (dwFlags & SCBIF_STATUS) MraSetContactStatus(hContact, dwStatus); @@ -512,7 +512,7 @@ DWORD CMraProto::SetContactBasicInfoW(HANDLE hContact, DWORD dwSetInfoFlags, DWO SetExtraIcons(hContact); // UNLOCK if (dwSetInfoFlags & SCBIFSI_LOCK_CHANGES_EVENTS) - mraSetDword(hContact, "HooksLocked", FALSE); + setDword(hContact, "HooksLocked", FALSE); return 0; } @@ -607,17 +607,17 @@ BOOL CMraProto::MraUpdateContactInfo(HANDLE hContact) DWORD CMraProto::MraContactCapabilitiesGet(HANDLE hContact) { - return mraGetDword(hContact, DBSETTING_CAPABILITIES, 0); + return getDword(hContact, DBSETTING_CAPABILITIES, 0); } void CMraProto::MraContactCapabilitiesSet(HANDLE hContact, DWORD dwFutureFlags) { - mraSetDword(hContact, DBSETTING_CAPABILITIES, dwFutureFlags); + setDword(hContact, DBSETTING_CAPABILITIES, dwFutureFlags); } DWORD CMraProto::MraGetContactStatus(HANDLE hContact) { - return mraGetWord(hContact, "Status", ID_STATUS_OFFLINE); + return getWord(hContact, "Status", ID_STATUS_OFFLINE); } DWORD CMraProto::MraSetContactStatus(HANDLE hContact, DWORD dwNewStatus) @@ -634,7 +634,7 @@ DWORD CMraProto::MraSetContactStatus(HANDLE hContact, DWORD dwNewStatus) { if (hContact) { - mraSetByte(hContact, DBSETTING_XSTATUSID, MRA_MIR_XSTATUS_NONE); + setByte(hContact, DBSETTING_XSTATUSID, MRA_MIR_XSTATUS_NONE); mraDelValue(hContact, DBSETTING_XSTATUSNAME); mraDelValue(hContact, DBSETTING_XSTATUSMSG); mraDelValue(hContact, DBSETTING_BLOGSTATUSTIME); @@ -644,7 +644,7 @@ DWORD CMraProto::MraSetContactStatus(HANDLE hContact, DWORD dwNewStatus) MraContactCapabilitiesSet(hContact, 0); if (bChatAgent) MraChatSessionDestroy(hContact); } - mraSetDword(hContact, "LogonTS", 0); + setDword(hContact, "LogonTS", 0); mraDelValue(hContact, "IP"); mraDelValue(hContact, "RealIP"); }else { @@ -652,15 +652,15 @@ DWORD CMraProto::MraSetContactStatus(HANDLE hContact, DWORD dwNewStatus) { DWORD dwTime = (DWORD)_time32(NULL); - mraSetDword(hContact, "LogonTS", dwTime); - mraSetDword(hContact, "OldLogonTS", dwTime); + setDword(hContact, "LogonTS", dwTime); + setDword(hContact, "OldLogonTS", dwTime); if (bChatAgent) MraChatSessionNew(hContact); } MraAvatarsQueueGetAvatarSimple(hAvatarsQueueHandle, 0, hContact, 0); } - mraSetWord(hContact, "Status", (WORD)dwNewStatus); + setWord(hContact, "Status", (WORD)dwNewStatus); } return(dwOldStatus); } @@ -670,7 +670,7 @@ void CMraProto::MraUpdateEmailStatus(LPSTR lpszFrom, size_t dwFromSize, LPSTR lp BOOL bTrayIconNewMailNotify; WCHAR szStatusText[MAX_SECONDLINE]; - bTrayIconNewMailNotify = mraGetByte(NULL, "TrayIconNewMailNotify", MRA_DEFAULT_TRAYICON_NEW_MAIL_NOTIFY); + bTrayIconNewMailNotify = getByte(NULL, "TrayIconNewMailNotify", MRA_DEFAULT_TRAYICON_NEW_MAIL_NOTIFY); if (dwEmailMessagesUnread) { @@ -714,7 +714,7 @@ void CMraProto::MraUpdateEmailStatus(LPSTR lpszFrom, size_t dwFromSize, LPSTR lp cle.pszService = ""; cle.ptszTooltip = szStatusText; - if (mraGetByte(NULL, "TrayIconNewMailClkToInbox", MRA_DEFAULT_TRAYICON_NEW_MAIL_CLK_TO_INBOX)) + if (getByte(NULL, "TrayIconNewMailClkToInbox", MRA_DEFAULT_TRAYICON_NEW_MAIL_CLK_TO_INBOX)) { strncpy(szServiceFunction, m_szModuleName, MAX_PATH); pszServiceFunctionName = szServiceFunction+strlen(m_szModuleName); @@ -733,7 +733,7 @@ void CMraProto::MraUpdateEmailStatus(LPSTR lpszFrom, size_t dwFromSize, LPSTR lp MraPopupShowFromAgentW(MRA_POPUP_TYPE_EMAIL_STATUS, (MRA_POPUP_ALLOW_ENTER), szStatusText); } }else { - if (mraGetByte(NULL, "IncrementalNewMailNotify", MRA_DEFAULT_INC_NEW_MAIL_NOTIFY)) + if (getByte(NULL, "IncrementalNewMailNotify", MRA_DEFAULT_INC_NEW_MAIL_NOTIFY)) { if (bTrayIconNewMailNotify) CallService(MS_CLIST_REMOVEEVENT, 0, (LPARAM)m_szModuleName); PUDeletePopup(hWndEMailPopupStatus); @@ -1304,7 +1304,7 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg, UINT message, WPARAM w } else SendMessage(hWndDlg, WM_SETTEXT, 0, (LPARAM)TranslateW(L"Set my blog status")); - DWORD dwTime = dat->ppro->mraGetDword(dat->hContact, DBSETTING_BLOGSTATUSTIME, 0); + DWORD dwTime = dat->ppro->getDword(dat->hContact, DBSETTING_BLOGSTATUSTIME, 0); if (dwTime && MakeLocalSystemTimeFromTime32(dwTime, &stBlogStatusTime)) mir_sntprintf(szBuff, SIZEOF(szBuff), L"%s: %04ld.%02ld.%02ld %02ld:%02ld", TranslateW(L"Writed"), stBlogStatusTime.wYear, stBlogStatusTime.wMonth, stBlogStatusTime.wDay, stBlogStatusTime.wHour, stBlogStatusTime.wMinute); else @@ -1552,7 +1552,7 @@ BOOL CMraProto::SetPassDB(LPSTR lpszBuff, size_t dwBuffSize) RC4(btCryptedPass, sizeof(btCryptedPass), bthmacSHA1, SHA1HashSize); - mraSetDword(NULL, "pCryptVer", MRA_PASS_CRYPT_VER); + setDword(NULL, "pCryptVer", MRA_PASS_CRYPT_VER); mraWriteContactSettingBlob(NULL, "pCryptData", btRandomData, sizeof(btRandomData)); mraWriteContactSettingBlob(NULL, "pCryptPass", btCryptedPass, sizeof(btCryptedPass)); @@ -1569,7 +1569,7 @@ BOOL CMraProto::GetPassDB_v1(LPSTR lpszBuff, size_t dwBuffSize, size_t *pdwBuffS char szEMail[MAX_EMAIL_LEN] = {0}; size_t dwRandomDataSize, dwCryptedPass, dwEMailSize, dwPassSize; - if (mraGetDword(NULL, "pCryptVer", 0) == 1) + if (getDword(NULL, "pCryptVer", 0) == 1) if (mraGetContactSettingBlob(NULL, "pCryptData", btRandomData, sizeof(btRandomData), &dwRandomDataSize)) if (dwRandomDataSize == sizeof(btRandomData)) if (mraGetContactSettingBlob(NULL, "pCryptPass", btCryptedPass, sizeof(btCryptedPass), &dwCryptedPass)) @@ -1606,7 +1606,7 @@ BOOL CMraProto::GetPassDB_v2(LPSTR lpszBuff, size_t dwBuffSize, size_t *pdwBuffS char szEMail[MAX_EMAIL_LEN] = {0}; size_t dwRandomDataSize, dwCryptedPass, dwEMailSize, dwPassSize; - if (mraGetDword(NULL, "pCryptVer", 0) == 2) + if (getDword(NULL, "pCryptVer", 0) == 2) if (mraGetContactSettingBlob(NULL, "pCryptData", btRandomData, sizeof(btRandomData), &dwRandomDataSize)) if (dwRandomDataSize == sizeof(btRandomData)) if (mraGetContactSettingBlob(NULL, "pCryptPass", btCryptedPass, sizeof(btCryptedPass), &dwCryptedPass)) @@ -1641,7 +1641,7 @@ BOOL CMraProto::GetPassDB(LPSTR lpszBuff, size_t dwBuffSize, size_t *pdwBuffSize mraGetStaticStringA(NULL, "Pass", lpszBuff, dwBuffSize, pdwBuffSize); return TRUE; #else - switch (mraGetDword(NULL, "pCryptVer", 0)) { + switch (getDword(NULL, "pCryptVer", 0)) { case 1: return GetPassDB_v1(lpszBuff, dwBuffSize, pdwBuffSize); case 2: diff --git a/protocols/MRA/src/Mra_options.cpp b/protocols/MRA/src/Mra_options.cpp index 30e4be9759..d97be771c1 100644 --- a/protocols/MRA/src/Mra_options.cpp +++ b/protocols/MRA/src/Mra_options.cpp @@ -117,30 +117,30 @@ INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, L else SET_DLG_ITEM_TEXTA(hWndDlg, IDC_SERVER, MRA_DEFAULT_SERVER); - SetDlgItemInt(hWndDlg, IDC_SERVERPORT, ppro->mraGetWord(NULL, "ServerPort", MRA_DEFAULT_SERVER_PORT), FALSE); + SetDlgItemInt(hWndDlg, IDC_SERVERPORT, ppro->getWord(NULL, "ServerPort", MRA_DEFAULT_SERVER_PORT), FALSE); // if set SSL proxy, setting will ignored - //CHECK_DLG_BUTTON(hWndDlg, IDC_KEEPALIVE, mraGetByte(NULL, "keepalive", 0)); - CHECK_DLG_BUTTON(hWndDlg, IDC_AUTO_ADD_CONTACTS_TO_SERVER, ppro->mraGetByte(NULL, "AutoAddContactsToServer", MRA_DEFAULT_AUTO_ADD_CONTACTS_TO_SERVER)); - CHECK_DLG_BUTTON(hWndDlg, IDC_AUTO_AUTH_REQ_ON_LOGON, ppro->mraGetByte(NULL, "AutoAuthRequestOnLogon", MRA_DEFAULT_AUTO_AUTH_REQ_ON_LOGON)); - CHECK_DLG_BUTTON(hWndDlg, IDC_AUTO_AUTH_GRAND_IN_CLIST, ppro->mraGetByte(NULL, "AutoAuthGrandUsersInCList", MRA_DEFAULT_AUTO_AUTH_GRAND_IN_CLIST)); - CHECK_DLG_BUTTON(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS, ppro->mraGetByte(NULL, "AutoAuthGrandNewUsers", MRA_DEFAULT_AUTO_AUTH_GRAND_NEW_USERS)); - CHECK_DLG_BUTTON(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS_DISABLE_SPAM_CHECK, ppro->mraGetByte(NULL, "AutoAuthGrandNewUsersDisableSPAMCheck", MRA_DEFAULT_AUTO_AUTH_GRAND_NEW_USERS_DISABLE_SPAM_CHECK)); + //CHECK_DLG_BUTTON(hWndDlg, IDC_KEEPALIVE, getByte(NULL, "keepalive", 0)); + CHECK_DLG_BUTTON(hWndDlg, IDC_AUTO_ADD_CONTACTS_TO_SERVER, ppro->getByte(NULL, "AutoAddContactsToServer", MRA_DEFAULT_AUTO_ADD_CONTACTS_TO_SERVER)); + CHECK_DLG_BUTTON(hWndDlg, IDC_AUTO_AUTH_REQ_ON_LOGON, ppro->getByte(NULL, "AutoAuthRequestOnLogon", MRA_DEFAULT_AUTO_AUTH_REQ_ON_LOGON)); + CHECK_DLG_BUTTON(hWndDlg, IDC_AUTO_AUTH_GRAND_IN_CLIST, ppro->getByte(NULL, "AutoAuthGrandUsersInCList", MRA_DEFAULT_AUTO_AUTH_GRAND_IN_CLIST)); + CHECK_DLG_BUTTON(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS, ppro->getByte(NULL, "AutoAuthGrandNewUsers", MRA_DEFAULT_AUTO_AUTH_GRAND_NEW_USERS)); + CHECK_DLG_BUTTON(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS_DISABLE_SPAM_CHECK, ppro->getByte(NULL, "AutoAuthGrandNewUsersDisableSPAMCheck", MRA_DEFAULT_AUTO_AUTH_GRAND_NEW_USERS_DISABLE_SPAM_CHECK)); EnableWindow(GetDlgItem(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS_DISABLE_SPAM_CHECK), IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS)); - CHECK_DLG_BUTTON(hWndDlg, IDC_SLOWSEND, ppro->mraGetByte(NULL, "SlowSend", MRA_DEFAULT_SLOW_SEND)); - CHECK_DLG_BUTTON(hWndDlg, IDC_INCREMENTAL_NEW_MAIL_NOTIFY, ppro->mraGetByte(NULL, "IncrementalNewMailNotify", MRA_DEFAULT_INC_NEW_MAIL_NOTIFY)); - CHECK_DLG_BUTTON(hWndDlg, IDC_TRAYICON_NEW_MAIL_NOTIFY, ppro->mraGetByte(NULL, "TrayIconNewMailNotify", MRA_DEFAULT_TRAYICON_NEW_MAIL_NOTIFY)); - CHECK_DLG_BUTTON(hWndDlg, IDC_TRAYICON_NEW_MAIL_NOTIFY_CLICK_TO_INBOX, ppro->mraGetByte(NULL, "TrayIconNewMailClkToInbox", MRA_DEFAULT_TRAYICON_NEW_MAIL_CLK_TO_INBOX)); - EnableWindow(GetDlgItem(hWndDlg, IDC_TRAYICON_NEW_MAIL_NOTIFY_CLICK_TO_INBOX), ppro->mraGetByte(NULL, "TrayIconNewMailNotify", MRA_DEFAULT_TRAYICON_NEW_MAIL_NOTIFY)); + CHECK_DLG_BUTTON(hWndDlg, IDC_SLOWSEND, ppro->getByte(NULL, "SlowSend", MRA_DEFAULT_SLOW_SEND)); + CHECK_DLG_BUTTON(hWndDlg, IDC_INCREMENTAL_NEW_MAIL_NOTIFY, ppro->getByte(NULL, "IncrementalNewMailNotify", MRA_DEFAULT_INC_NEW_MAIL_NOTIFY)); + CHECK_DLG_BUTTON(hWndDlg, IDC_TRAYICON_NEW_MAIL_NOTIFY, ppro->getByte(NULL, "TrayIconNewMailNotify", MRA_DEFAULT_TRAYICON_NEW_MAIL_NOTIFY)); + CHECK_DLG_BUTTON(hWndDlg, IDC_TRAYICON_NEW_MAIL_NOTIFY_CLICK_TO_INBOX, ppro->getByte(NULL, "TrayIconNewMailClkToInbox", MRA_DEFAULT_TRAYICON_NEW_MAIL_CLK_TO_INBOX)); + EnableWindow(GetDlgItem(hWndDlg, IDC_TRAYICON_NEW_MAIL_NOTIFY_CLICK_TO_INBOX), ppro->getByte(NULL, "TrayIconNewMailNotify", MRA_DEFAULT_TRAYICON_NEW_MAIL_NOTIFY)); - CHECK_DLG_BUTTON(hWndDlg, IDC_RTF_RECEIVE_ENABLE, ppro->mraGetByte(NULL, "RTFReceiveEnable", MRA_DEFAULT_RTF_RECEIVE_ENABLE)); + CHECK_DLG_BUTTON(hWndDlg, IDC_RTF_RECEIVE_ENABLE, ppro->getByte(NULL, "RTFReceiveEnable", MRA_DEFAULT_RTF_RECEIVE_ENABLE)); - CHECK_DLG_BUTTON(hWndDlg, IDC_RTF_SEND_ENABLE, ppro->mraGetByte(NULL, "RTFSendEnable", MRA_DEFAULT_RTF_SEND_ENABLE)); - EnableWindow(GetDlgItem(hWndDlg, IDC_RTF_SEND_SMART), ppro->mraGetByte(NULL, "RTFSendEnable", MRA_DEFAULT_RTF_SEND_ENABLE)); - EnableWindow(GetDlgItem(hWndDlg, IDC_BUTTON_FONT), ppro->mraGetByte(NULL, "RTFSendEnable", MRA_DEFAULT_RTF_SEND_ENABLE)); - EnableWindow(GetDlgItem(hWndDlg, IDC_RTF_BGCOLOUR), ppro->mraGetByte(NULL, "RTFSendEnable", MRA_DEFAULT_RTF_SEND_ENABLE)); - SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_RTF_BGCOLOUR, CPM_SETCOLOUR, 0, ppro->mraGetDword(NULL, "RTFBackgroundColour", MRA_DEFAULT_RTF_BACKGROUND_COLOUR)); + CHECK_DLG_BUTTON(hWndDlg, IDC_RTF_SEND_ENABLE, ppro->getByte(NULL, "RTFSendEnable", MRA_DEFAULT_RTF_SEND_ENABLE)); + EnableWindow(GetDlgItem(hWndDlg, IDC_RTF_SEND_SMART), ppro->getByte(NULL, "RTFSendEnable", MRA_DEFAULT_RTF_SEND_ENABLE)); + EnableWindow(GetDlgItem(hWndDlg, IDC_BUTTON_FONT), ppro->getByte(NULL, "RTFSendEnable", MRA_DEFAULT_RTF_SEND_ENABLE)); + EnableWindow(GetDlgItem(hWndDlg, IDC_RTF_BGCOLOUR), ppro->getByte(NULL, "RTFSendEnable", MRA_DEFAULT_RTF_SEND_ENABLE)); + SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_RTF_BGCOLOUR, CPM_SETCOLOUR, 0, ppro->getDword(NULL, "RTFBackgroundColour", MRA_DEFAULT_RTF_BACKGROUND_COLOUR)); return TRUE; case WM_COMMAND: @@ -167,7 +167,7 @@ INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, L cf.lStructSize = sizeof(cf); cf.lpLogFont = &lf; - cf.rgbColors = ppro->mraGetDword(NULL, "RTFFontColour", MRA_DEFAULT_RTF_FONT_COLOUR); + cf.rgbColors = ppro->getDword(NULL, "RTFFontColour", MRA_DEFAULT_RTF_FONT_COLOUR); cf.Flags = (CF_SCREENFONTS|CF_EFFECTS|CF_FORCEFONTEXIST|CF_INITTOLOGFONTSTRUCT); if (ppro->mraGetContactSettingBlob(NULL, "RTFFont", &lf, sizeof(LOGFONT), NULL) == FALSE) { HDC hDC = GetDC(NULL);// kegl @@ -179,7 +179,7 @@ INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, L if (ChooseFont(&cf)) { ppro->mraWriteContactSettingBlob(NULL, "RTFFont", &lf, sizeof(LOGFONT)); - ppro->mraSetDword(NULL, "RTFFontColour", cf.rgbColors); + ppro->setDword(NULL, "RTFFontColour", cf.rgbColors); } } break; @@ -193,21 +193,21 @@ INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, L case PSN_APPLY: GET_DLG_ITEM_TEXT(hWndDlg, IDC_SERVER, szBuff, SIZEOF(szBuff)); ppro->mraSetStringW(NULL, "Server", szBuff); - ppro->mraSetWord(NULL, "ServerPort", (WORD)GetDlgItemInt(hWndDlg, IDC_SERVERPORT, NULL, FALSE)); - ppro->mraSetByte(NULL, "AutoAddContactsToServer", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_AUTO_ADD_CONTACTS_TO_SERVER)); - ppro->mraSetByte(NULL, "AutoAuthRequestOnLogon", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_AUTO_AUTH_REQ_ON_LOGON)); - ppro->mraSetByte(NULL, "AutoAuthGrandUsersInCList", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_AUTO_AUTH_GRAND_IN_CLIST)); - ppro->mraSetByte(NULL, "AutoAuthGrandNewUsers", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS)); - ppro->mraSetByte(NULL, "AutoAuthGrandNewUsersDisableSPAMCheck", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS_DISABLE_SPAM_CHECK)); - - ppro->mraSetByte(NULL, "SlowSend", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_SLOWSEND)); - ppro->mraSetByte(NULL, "IncrementalNewMailNotify", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_INCREMENTAL_NEW_MAIL_NOTIFY)); - ppro->mraSetByte(NULL, "TrayIconNewMailNotify", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_TRAYICON_NEW_MAIL_NOTIFY)); - ppro->mraSetByte(NULL, "TrayIconNewMailClkToInbox", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_TRAYICON_NEW_MAIL_NOTIFY_CLICK_TO_INBOX)); - - ppro->mraSetByte(NULL, "RTFReceiveEnable", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_RTF_RECEIVE_ENABLE)); - ppro->mraSetByte(NULL, "RTFSendEnable", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_RTF_SEND_ENABLE)); - ppro->mraSetDword(NULL, "RTFBackgroundColour", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_RTF_BGCOLOUR, CPM_GETCOLOUR, 0, 0)); + ppro->setWord(NULL, "ServerPort", (WORD)GetDlgItemInt(hWndDlg, IDC_SERVERPORT, NULL, FALSE)); + ppro->setByte(NULL, "AutoAddContactsToServer", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_AUTO_ADD_CONTACTS_TO_SERVER)); + ppro->setByte(NULL, "AutoAuthRequestOnLogon", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_AUTO_AUTH_REQ_ON_LOGON)); + ppro->setByte(NULL, "AutoAuthGrandUsersInCList", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_AUTO_AUTH_GRAND_IN_CLIST)); + ppro->setByte(NULL, "AutoAuthGrandNewUsers", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS)); + ppro->setByte(NULL, "AutoAuthGrandNewUsersDisableSPAMCheck", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS_DISABLE_SPAM_CHECK)); + + ppro->setByte(NULL, "SlowSend", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_SLOWSEND)); + ppro->setByte(NULL, "IncrementalNewMailNotify", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_INCREMENTAL_NEW_MAIL_NOTIFY)); + ppro->setByte(NULL, "TrayIconNewMailNotify", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_TRAYICON_NEW_MAIL_NOTIFY)); + ppro->setByte(NULL, "TrayIconNewMailClkToInbox", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_TRAYICON_NEW_MAIL_NOTIFY_CLICK_TO_INBOX)); + + ppro->setByte(NULL, "RTFReceiveEnable", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_RTF_RECEIVE_ENABLE)); + ppro->setByte(NULL, "RTFSendEnable", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_RTF_SEND_ENABLE)); + ppro->setDword(NULL, "RTFBackgroundColour", SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_RTF_BGCOLOUR, CPM_GETCOLOUR, 0, 0)); return TRUE; } break; diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 8b4a9318ed..ee8c91cd66 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -54,12 +54,12 @@ void CMraProto::MraThreadProc(LPVOID lpParameter) SleepEx(100, FALSE);// to prevent high CPU load by some status plugins like allwaysonline - dwConnectReTryCount = mraGetDword(NULL, "ConnectReTryCountMRIM", MRA_DEFAULT_CONN_RETRY_COUNT_MRIM); + dwConnectReTryCount = getDword(NULL, "ConnectReTryCountMRIM", MRA_DEFAULT_CONN_RETRY_COUNT_MRIM); nloc.cbSize = sizeof(nloc); nloc.flags = NLOCF_V2; nloc.szHost = szHost; - nloc.timeout = mraGetDword(NULL, "TimeOutConnectMRIM", MRA_DEFAULT_TIMEOUT_CONN_MRIM); + nloc.timeout = getDword(NULL, "TimeOutConnectMRIM", MRA_DEFAULT_TIMEOUT_CONN_MRIM); if (nloc.timeoutMRA_TIMEOUT_CONN_МАХ) nloc.timeout = MRA_TIMEOUT_CONN_МАХ; @@ -77,11 +77,11 @@ void CMraProto::MraThreadProc(LPVOID lpParameter) } if (bConnected == FALSE) - if (mraGetByte(NULL, "NLBFailDirectConnect", MRA_DEFAULT_NLB_FAIL_DIRECT_CONNECT)) { + if (getByte(NULL, "NLBFailDirectConnect", MRA_DEFAULT_NLB_FAIL_DIRECT_CONNECT)) { if (IsHTTPSProxyUsed(hNetlibUser)) nloc.wPort = MRA_SERVER_PORT_HTTPS; else { - nloc.wPort = mraGetWord(NULL, "ServerPort", MRA_DEFAULT_SERVER_PORT); + nloc.wPort = getWord(NULL, "ServerPort", MRA_DEFAULT_SERVER_PORT); if (nloc.wPort == MRA_SERVER_PORT_STANDART_NLB) nloc.wPort = MRA_SERVER_PORT_STANDART; } @@ -143,7 +143,7 @@ DWORD CMraProto::MraGetNLBData(LPSTR lpszHost, size_t dwHostBuffSize, WORD *pwPo NETLIBSELECT nls = {0}; NETLIBOPENCONNECTION nloc = {0}; - dwConnectReTryCount = mraGetDword(NULL, "ConnectReTryCountNLB", MRA_DEFAULT_CONN_RETRY_COUNT_NLB); + dwConnectReTryCount = getDword(NULL, "ConnectReTryCountNLB", MRA_DEFAULT_CONN_RETRY_COUNT_NLB); nloc.cbSize = sizeof(nloc); nloc.flags = NLOCF_V2; @@ -155,9 +155,9 @@ DWORD CMraProto::MraGetNLBData(LPSTR lpszHost, size_t dwHostBuffSize, WORD *pwPo if ( IsHTTPSProxyUsed(hNetlibUser)) nloc.wPort = MRA_SERVER_PORT_HTTPS; else - nloc.wPort = mraGetWord(NULL, "ServerPort", MRA_DEFAULT_SERVER_PORT); + nloc.wPort = getWord(NULL, "ServerPort", MRA_DEFAULT_SERVER_PORT); - nloc.timeout = mraGetDword(NULL, "TimeOutConnectNLB", MRA_DEFAULT_TIMEOUT_CONN_NLB); + nloc.timeout = getDword(NULL, "TimeOutConnectNLB", MRA_DEFAULT_TIMEOUT_CONN_NLB); if (nloc.timeoutMRA_TIMEOUT_CONN_МАХ) nloc.timeout = MRA_TIMEOUT_CONN_МАХ; @@ -170,7 +170,7 @@ DWORD CMraProto::MraGetNLBData(LPSTR lpszHost, size_t dwHostBuffSize, WORD *pwPo if (nls.hReadConns[0]) { nls.cbSize = sizeof(nls); - nls.dwTimeout = 1000 * mraGetDword(NULL, "TimeOutReceiveNLB", MRA_DEFAULT_TIMEOUT_RECV_NLB); + nls.dwTimeout = 1000 * getDword(NULL, "TimeOutReceiveNLB", MRA_DEFAULT_TIMEOUT_RECV_NLB); InterlockedExchange((volatile LONG*)&dwThreadWorkerLastPingTime, GetTickCount()); while (m_iStatus != ID_STATUS_OFFLINE && bContinue) { @@ -434,7 +434,7 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd szSelfVersionString, __FILEVERSION_STRING, PROTO_VERSION_MAJOR, PROTO_VERSION_MINOR); } - dwFutureFlags = ((mraGetByte(NULL, "RTFReceiveEnable", MRA_DEFAULT_RTF_RECEIVE_ENABLE)? FEATURE_FLAG_RTF_MESSAGE:0)|MRA_FEATURE_FLAGS); + dwFutureFlags = ((getByte(NULL, "RTFReceiveEnable", MRA_DEFAULT_RTF_RECEIVE_ENABLE)? FEATURE_FLAG_RTF_MESSAGE:0)|MRA_FEATURE_FLAGS); if (mraGetStaticStringA(NULL, "e-mail", szEMail, SIZEOF(szEMail), &dwEMailSize)) MraLogin2W(szEMail, dwEMailSize, (LPSTR)szBuff, dwStringSize, dwStatus, lpcszStatusUri[dwXStatus], lstrlenA(lpcszStatusUri[dwXStatus]), lpwszStatusTitle, dwStatusTitleSize, lpwszStatusDesc, dwStatusDescSize, dwFutureFlags, szUserAgentFormated, dwUserAgentFormattedSize, szSelfVersionString, dwSelfVersionSize); @@ -552,7 +552,7 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd if (lpszDelimiter) { (*lpszDelimiter) = 0; lpszDelimiter = (LPSTR)szBuff; - mraSetDword(NULL, "IP", HTONL(inet_addr(lpszDelimiter))); + setDword(NULL, "IP", HTONL(inet_addr(lpszDelimiter))); } } else if ( !_strnicmp(lpsString.lpszData, "connect.xml", 11)) { @@ -574,7 +574,7 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd } else if ( !_strnicmp(lpsString.lpszData, "micblog.status.time", 19)) { GetLPS(lpbData, dwDataSize, &lpbDataCurrent, &lpsString); - mraSetDword(NULL, DBSETTING_BLOGSTATUSTIME, StrToUNum32(lpsString.lpszData, lpsString.dwSize)); + setDword(NULL, DBSETTING_BLOGSTATUSTIME, StrToUNum32(lpsString.lpszData, lpsString.dwSize)); } else if ( !_strnicmp(lpsString.lpszData, "micblog.status.text", 19)) { GetLPS(lpbData, dwDataSize, &lpbDataCurrent, &lpsString); @@ -582,31 +582,31 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd } else if ( !_strnicmp(lpsString.lpszData, "HAS_MYMAIL", 10)) { GetLPS(lpbData, dwDataSize, &lpbDataCurrent, &lpsString); - //mraSetDword(NULL, DBSETTING_BLOGSTATUSTIME, StrToUNum32(lpsString.lpszData, lpsString.dwSize)); + //setDword(NULL, DBSETTING_BLOGSTATUSTIME, StrToUNum32(lpsString.lpszData, lpsString.dwSize)); } else if ( !_strnicmp(lpsString.lpszData, "mrim.status.open_search", 23)) { GetLPS(lpbData, dwDataSize, &lpbDataCurrent, &lpsString); - //mraSetDword(NULL, DBSETTING_BLOGSTATUSTIME, StrToUNum32(lpsString.lpszData, lpsString.dwSize)); + //setDword(NULL, DBSETTING_BLOGSTATUSTIME, StrToUNum32(lpsString.lpszData, lpsString.dwSize)); } else if ( !_strnicmp(lpsString.lpszData, "rb.target.cookie", 16)) { GetLPS(lpbData, dwDataSize, &lpbDataCurrent, &lpsString); - //mraSetDword(NULL, DBSETTING_BLOGSTATUSTIME, StrToUNum32(lpsString.lpszData, lpsString.dwSize)); + //setDword(NULL, DBSETTING_BLOGSTATUSTIME, StrToUNum32(lpsString.lpszData, lpsString.dwSize)); } else if ( !_strnicmp(lpsString.lpszData, "show_web_history_link", 21)) { GetLPS(lpbData, dwDataSize, &lpbDataCurrent, &lpsString); - //mraSetDword(NULL, DBSETTING_BLOGSTATUSTIME, StrToUNum32(lpsString.lpszData, lpsString.dwSize)); + //setDword(NULL, DBSETTING_BLOGSTATUSTIME, StrToUNum32(lpsString.lpszData, lpsString.dwSize)); } else if ( !_strnicmp(lpsString.lpszData, "friends_suggest", 15)) { GetLPS(lpbData, dwDataSize, &lpbDataCurrent, &lpsString); - //mraSetDword(NULL, DBSETTING_BLOGSTATUSTIME, StrToUNum32(lpsString.lpszData, lpsString.dwSize)); + //setDword(NULL, DBSETTING_BLOGSTATUSTIME, StrToUNum32(lpsString.lpszData, lpsString.dwSize)); } else if ( !_strnicmp(lpsString.lpszData, "timestamp", 9)) { GetLPS(lpbData, dwDataSize, &lpbDataCurrent, &lpsString); - //mraSetDword(NULL, DBSETTING_BLOGSTATUSTIME, StrToUNum32(lpsString.lpszData, lpsString.dwSize)); + //setDword(NULL, DBSETTING_BLOGSTATUSTIME, StrToUNum32(lpsString.lpszData, lpsString.dwSize)); } else if ( !_strnicmp(lpsString.lpszData, "trusted_update", 14)) { GetLPS(lpbData, dwDataSize, &lpbDataCurrent, &lpsString); - //mraSetDword(NULL, DBSETTING_BLOGSTATUSTIME, StrToUNum32(lpsString.lpszData, lpsString.dwSize)); + //setDword(NULL, DBSETTING_BLOGSTATUSTIME, StrToUNum32(lpsString.lpszData, lpsString.dwSize)); } else { #ifdef _DEBUG @@ -675,9 +675,9 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd GetContactBasicInfoW(hContact, NULL, NULL, NULL, &dwTemp, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, 0, NULL); dwTemp &= ~CONTACT_INTFLAG_NOT_AUTHORIZED; SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, SCBIF_SERVER_FLAG, 0, 0, 0, dwTemp, 0, NULL, 0, NULL, 0, NULL, 0); - mraSetDword(hContact, "HooksLocked", TRUE); + setDword(hContact, "HooksLocked", TRUE); db_unset(hContact, "CList", "NotOnList"); - mraSetDword(hContact, "HooksLocked", FALSE); + setDword(hContact, "HooksLocked", FALSE); } break; @@ -785,13 +785,13 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd dwTemp = GetMiradaStatusFromMraStatus(dwStatus, GetMraXStatusIDFromMraUriStatus(lpsSpecStatusUri.lpszData, lpsSpecStatusUri.dwSize), &dwXStatus); MraContactCapabilitiesSet(hContact, dwFutureFlags); - mraSetByte(hContact, DBSETTING_XSTATUSID, (BYTE)dwXStatus); + setByte(hContact, DBSETTING_XSTATUSID, (BYTE)dwXStatus); mraSetLPSStringW(hContact, DBSETTING_XSTATUSNAME, &lpsStatusTitle); mraSetLPSStringW(hContact, DBSETTING_XSTATUSMSG, &lpsStatusDesc); if (dwTemp != ID_STATUS_OFFLINE) { // пишем клиента только если юзер не отключён, иначе не затираем старое if (lpsUserAgentFormated.dwSize) { - if (mraGetByte(NULL, "MirVerRaw", MRA_DEFAULT_MIRVER_RAW) == FALSE) { + if (getByte(NULL, "MirVerRaw", MRA_DEFAULT_MIRVER_RAW) == FALSE) { MraGetVersionStringFromFormatted(lpsUserAgentFormated.lpszData, lpsUserAgentFormated.dwSize, (LPSTR)szBuff, SIZEOF(szBuff), &dwStringSize); lpsUserAgentFormated.lpszData = (LPSTR)szBuff; lpsUserAgentFormated.dwSize = dwStringSize; @@ -893,7 +893,7 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd // write to DB and exit loop if (dwAckType == ACKTYPE_GETINFO && hContact) { - mraSetDword(hContact, "InfoTS", (DWORD)_time32(NULL)); + setDword(hContact, "InfoTS", (DWORD)_time32(NULL)); //MRA_LPS mralpsUsernameValue; for (i = 0; i < dwFeildsNum; i++) { if ( !_strnicmp(pmralpsFeilds[i].lpszData, "Username", 8)) @@ -911,10 +911,10 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd else if ( !_strnicmp(pmralpsFeilds[i].lpszData, "Sex", 3)) { switch (StrToUNum32(pmralpsValues[i].lpszData, pmralpsValues[i].dwSize)) { case 1:// мужской - mraSetByte(hContact, "Gender", 'M'); + setByte(hContact, "Gender", 'M'); break; case 2:// женский - mraSetByte(hContact, "Gender", 'F'); + setByte(hContact, "Gender", 'F'); break; default:// а фиг его знает mraDelValue(hContact, "Gender"); @@ -928,11 +928,11 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd stTime.wYear = (WORD)StrToUNum32(pmralpsValues[i].lpszData, 4); stTime.wMonth = (WORD)StrToUNum32((pmralpsValues[i].lpszData+5), 2); stTime.wDay = (WORD)StrToUNum32((pmralpsValues[i].lpszData+8), 2); - mraSetWord(hContact, "BirthYear", stTime.wYear); - mraSetByte(hContact, "BirthMonth", (BYTE)stTime.wMonth); - mraSetByte(hContact, "BirthDay", (BYTE)stTime.wDay); + setWord(hContact, "BirthYear", stTime.wYear); + setByte(hContact, "BirthMonth", (BYTE)stTime.wMonth); + setByte(hContact, "BirthDay", (BYTE)stTime.wDay); - mraSetWord(hContact, "Age", (WORD)GetYears(&stTime)); + setWord(hContact, "Age", (WORD)GetYears(&stTime)); } else { mraDelValue(hContact, "BirthYear"); @@ -1020,7 +1020,7 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd if (dwID == -1 || (dwContactSeverFlags & CONTACT_INTFLAG_NOT_AUTHORIZED)) { dwStatus = StrHexToUNum32(pmralpsValues[i].lpszData, pmralpsValues[i].dwSize); MraSetContactStatus(hContact, GetMiradaStatusFromMraStatus(dwStatus, MRA_MIR_XSTATUS_NONE, NULL)); - mraSetByte(hContact, DBSETTING_XSTATUSID, (BYTE)MRA_MIR_XSTATUS_NONE); + setByte(hContact, DBSETTING_XSTATUSID, (BYTE)MRA_MIR_XSTATUS_NONE); } } } @@ -1031,7 +1031,7 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd GetContactBasicInfoW(hContact, &dwID, NULL, NULL, &dwContactSeverFlags, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, 0, NULL); if (dwID == -1 || dwContactSeverFlags&CONTACT_INTFLAG_NOT_AUTHORIZED) { MraSetContactStatus(hContact, GetMiradaStatusFromMraStatus(dwStatus, GetMraXStatusIDFromMraUriStatus(pmralpsValues[i].lpszData, pmralpsValues[i].dwSize), &dwXStatus)); - mraSetByte(hContact, DBSETTING_XSTATUSID, (BYTE)dwXStatus); + setByte(hContact, DBSETTING_XSTATUSID, (BYTE)dwXStatus); } } } @@ -1157,7 +1157,7 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd dwAckType = dwEmailMessagesUnread;// save old value dwEmailMessagesUnread = dwTemp;// store new value - if (mraGetByte(NULL, "IncrementalNewMailNotify", MRA_DEFAULT_INC_NEW_MAIL_NOTIFY) == 0 || dwAckType TCHAR* GetContactNameT(HANDLE hContact); void deleteSetting(HANDLE hContact, const char* valueName); - int getByte(const char* name, BYTE defaultValue); - int getByte(HANDLE hContact, const char* name, BYTE defaultValue); - int getDword(const char* name, DWORD defaultValue); - int getDword(HANDLE hContact, const char* name, DWORD defaultValue); int getStaticString(HANDLE hContact, const char* valueName, char* dest, unsigned dest_len); - int getString(const char* name, DBVARIANT*); - int getString(HANDLE hContact, const char* name, DBVARIANT*); - int getTString(const char* name, DBVARIANT*); - int getTString(HANDLE hContact, const char* name, DBVARIANT*); int getStringUtf(HANDLE hContact, const char* name, DBVARIANT* result); int getStringUtf(const char* name, DBVARIANT* result); - WORD getWord(const char* name, WORD defaultValue); - WORD getWord(HANDLE hContact, const char* name, WORD defaultValue); - - void setByte(const char* name, BYTE value); - void setByte(HANDLE hContact, const char* name, BYTE value); - void setDword(const char* name, DWORD value); - void setDword(HANDLE hContact, const char* name, DWORD value); - void setString(const char* name, const char* value); - void setString(HANDLE hContact, const char* name, const char* value); void setStringUtf(HANDLE hContact, const char* name, const char* value); - void setTString(const char* name, const TCHAR* value); - void setTString(HANDLE hContact, const char* name, const TCHAR* value); - void setWord(const char* name, WORD value); - void setWord(HANDLE hContact, const char* name, WORD value); }; extern OBJLIST g_Instances; diff --git a/protocols/MSN/src/msn_std.cpp b/protocols/MSN/src/msn_std.cpp index da31858fd9..890f37b706 100644 --- a/protocols/MSN/src/msn_std.cpp +++ b/protocols/MSN/src/msn_std.cpp @@ -30,38 +30,6 @@ void CMsnProto::deleteSetting(HANDLE hContact, const char* valueName) { db_unset(hContact, m_szModuleName, valueName); } -int CMsnProto::getByte(const char* name, BYTE defaultValue) -{ return db_get_b(NULL, m_szModuleName, name, defaultValue); -} - -int CMsnProto::getByte(HANDLE hContact, const char* name, BYTE defaultValue) -{ return db_get_b(hContact, m_szModuleName, name, defaultValue); -} - -int CMsnProto::getDword(const char* name, DWORD defaultValue) -{ return db_get_dw(NULL, m_szModuleName, name, defaultValue); -} - -int CMsnProto::getDword(HANDLE hContact, const char* name, DWORD defaultValue) -{ return db_get_dw(hContact, m_szModuleName, name, defaultValue); -} - -int CMsnProto::getString(const char* name, DBVARIANT* result) -{ return db_get_s(NULL, m_szModuleName, name, result); -} - -int CMsnProto::getString(HANDLE hContact, const char* name, DBVARIANT* result) -{ return db_get_s(hContact, m_szModuleName, name, result); -} - -int CMsnProto::getTString(const char* name, DBVARIANT* result) -{ return db_get_ts(NULL, m_szModuleName, name, result); -} - -int CMsnProto::getTString(HANDLE hContact, const char* name, DBVARIANT* result) -{ return db_get_ts(hContact, m_szModuleName, name, result); -} - int CMsnProto::getStringUtf(HANDLE hContact, const char* name, DBVARIANT* result) { return db_get_utf(hContact, m_szModuleName, name, result); } @@ -87,58 +55,10 @@ int CMsnProto::getStaticString(HANDLE hContact, const char* valueName, char* de return (dbv.type != DBVT_ASCIIZ); } -WORD CMsnProto::getWord(const char* name, WORD defaultValue) -{ return db_get_w(NULL, m_szModuleName, name, defaultValue); -} - -WORD CMsnProto::getWord(HANDLE hContact, const char* name, WORD defaultValue) -{ return db_get_w(hContact, m_szModuleName, name, defaultValue); -} - -void CMsnProto::setByte(const char* name, BYTE value) -{ db_set_b(NULL, m_szModuleName, name, value); -} - -void CMsnProto::setByte(HANDLE hContact, const char* name, BYTE value) -{ db_set_b(hContact, m_szModuleName, name, value); -} - -void CMsnProto::setDword(const char* name, DWORD value) -{ db_set_dw(NULL, m_szModuleName, name, value); -} - -void CMsnProto::setDword(HANDLE hContact, const char* name, DWORD value) -{ db_set_dw(hContact, m_szModuleName, name, value); -} - -void CMsnProto::setString(const char* name, const char* value) -{ db_set_s(NULL, m_szModuleName, name, value); -} - -void CMsnProto::setString(HANDLE hContact, const char* name, const char* value) -{ db_set_s(hContact, m_szModuleName, name, value); -} - void CMsnProto::setStringUtf(HANDLE hContact, const char* name, const char* value) { db_set_utf(hContact, m_szModuleName, name, value); } -void CMsnProto::setTString(const char* name, const TCHAR* value) -{ db_set_ts(NULL, m_szModuleName, name, value); -} - -void CMsnProto::setTString(HANDLE hContact, const char* name, const TCHAR* value) -{ db_set_ts(hContact, m_szModuleName, name, value); -} - -void CMsnProto::setWord(const char* name, WORD value) -{ db_set_w(NULL, m_szModuleName, name, value); -} - -void CMsnProto::setWord(HANDLE hContact, const char* name, WORD value) -{ db_set_w(hContact, m_szModuleName, name, value); -} - ///////////////////////////////////////////////////////////////////////////////////////// TCHAR* CMsnProto::GetContactNameT(HANDLE hContact) diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp index 5aa80eb389..b76e4c4de2 100644 --- a/protocols/Yahoo/src/avatar.cpp +++ b/protocols/Yahoo/src/avatar.cpp @@ -111,14 +111,14 @@ void __cdecl CYahooProto::send_avt_thread(void *psf) return; } - SetByte("AvatarUL", 1); + setByte("AvatarUL", 1); yahoo_send_avatar(m_id, sf->filename, sf->filesize, &upload_avt, sf); free(sf->filename); free(sf); - if (GetByte("AvatarUL", 1) == 1) - SetByte("AvatarUL", 0); + if (getByte("AvatarUL", 1) == 1) + setByte("AvatarUL", 0); } void CYahooProto::SendAvatar(const TCHAR *szFile) @@ -178,8 +178,8 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt) LOG(("ERROR: Can't find buddy: %s", avt->who)); error = 1; } else if (!error) { - SetDword(hContact, "PictCK", avt->cksum); - SetDword(hContact, "PictLoading", 1); + setDword(hContact, "PictCK", avt->cksum); + setDword(hContact, "PictLoading", 1); } if (!error) { @@ -221,7 +221,7 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt) WriteFile(myhFile, nlhrReply->pData, nlhrReply->dataLength, &c, NULL); CloseHandle(myhFile); - SetDword(hContact, "PictLastCheck", 0); + setDword(hContact, "PictLastCheck", 0); } else { LOG(("Can not open file for writing: %s", buf)); error = 1; @@ -231,12 +231,12 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt) } } - if (GetDword(hContact, "PictCK", 0) != avt->cksum) { + if (getDword(hContact, "PictCK", 0) != avt->cksum) { LOG(("WARNING: Checksum updated during download?!")); error = 1; /* don't use this one? */ } - SetDword(hContact, "PictLoading", 0); + setDword(hContact, "PictLoading", 0); LOG(("File download complete!?")); if (error) @@ -252,7 +252,7 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt) _tcsncpy(AI.filename, buf, SIZEOF(AI.filename)); if (error) - SetDword(hContact, "PictCK", 0); + setDword(hContact, "PictCK", 0); ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, !error ? ACKRESULT_SUCCESS:ACKRESULT_FAILED,(HANDLE) &AI, 0); } @@ -277,7 +277,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p DBVARIANT dbv; /* need to send avatar info */ - if (!GetByte("ShowAvatars", 1 )) { + if (!getByte("ShowAvatars", 1 )) { LOG(("[ext_yahoo_got_picture] We are not using/showing avatars!")); yahoo_send_picture_update(m_id, who, 0); // no avatar (disabled) return; @@ -285,9 +285,9 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p LOG(("[ext_yahoo_got_picture] Getting ready to send info!")); /* need to read CheckSum */ - cksum = GetDword("AvatarHash", 0); + cksum = getDword("AvatarHash", 0); if (cksum) { - if (!GetString("AvatarURL", &dbv)) { + if (!getString("AvatarURL", &dbv)) { LOG(("[ext_yahoo_got_picture] Sending url: %s checksum: %d to '%s'!", dbv.pszVal, cksum, who)); //void yahoo_send_picture_info(int id, const char *me, const char *who, const char *pic_url, int cksum) yahoo_send_picture_info(m_id, who, 2, dbv.pszVal, cksum); @@ -299,7 +299,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p /* * Try to re-upload the avatar */ - if (GetByte("AvatarUL", 0) != 1) { + if (getByte("AvatarUL", 0) != 1) { // NO avatar URL?? if (!db_get_ts(NULL, m_szModuleName, "AvatarFile", &dbv)) { struct _stat statbuf; @@ -323,7 +323,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p case 2: /* * We got Avatar Info for our buddy. */ - if (!GetByte("ShowAvatars", 1 )) { + if (!getByte("ShowAvatars", 1 )) { LOG(("[ext_yahoo_got_picture] We are not using/showing avatars!")); return; } @@ -380,7 +380,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p DBVARIANT dbv; /* need to send avatar info */ - if (!GetByte("ShowAvatars", 1 )) { + if (!getByte("ShowAvatars", 1 )) { LOG(("[ext_yahoo_got_picture] We are not using/showing avatars!")); yahoo_send_picture_update(m_id, who, 0); // no avatar (disabled) return; @@ -388,7 +388,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p LOG(("[ext_yahoo_got_picture] Getting ready to send info!")); /* need to read CheckSum */ - mcksum = GetDword("AvatarHash", 0); + mcksum = getDword("AvatarHash", 0); if (mcksum == 0) { /* this should NEVER Happen??? */ LOG(("[ext_yahoo_got_picture] No personal checksum? and Invalidate?!")); @@ -398,7 +398,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p LOG(("[ext_yahoo_got_picture] My Checksum: %d", mcksum)); - if (!GetString("AvatarURL", &dbv)) { + if (!getString("AvatarURL", &dbv)) { if (lstrcmpiA(pic_url, dbv.pszVal) == 0) { DBVARIANT dbv2; /*time_t ts; @@ -408,7 +408,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p LOG(("[ext_yahoo_got_picture] WARNING: Checksums don't match!")); /*time(&ts); - ae = GetDword("AvatarExpires", 0); + ae = getDword("AvatarExpires", 0); if (ae != 0 && ae > (ts - 300)) { LOG(("[ext_yahoo_got_picture] Current Time: %lu Expires: %lu ", ts, ae)); @@ -481,7 +481,7 @@ void CYahooProto::ext_got_picture_checksum(const char *me, const char *who, int // Request new avatar here... (might also want to check the sharing status?) - if (GetByte("ShareAvatar", 0) == 2) + if (getByte("ShareAvatar", 0) == 2) request_avatar(who); } } @@ -536,10 +536,10 @@ void CYahooProto::ext_got_picture_upload(const char *me, const char *url,unsigne } - cksum = GetDword("TMPAvatarHash", 0); + cksum = getDword("TMPAvatarHash", 0); if (cksum != 0) { LOG(("[ext_yahoo_got_picture_upload] Updating Checksum to: %d", cksum)); - SetDword("AvatarHash", cksum); + setDword("AvatarHash", cksum); db_unset(NULL, m_szModuleName, "TMPAvatarHash"); // This is only meant for message sessions, but we don't got those in miranda yet @@ -549,12 +549,12 @@ void CYahooProto::ext_got_picture_upload(const char *me, const char *url,unsigne // need to tell the stupid Yahoo that our icon updated //YAHOO_bcast_picture_update(2); }else - cksum = GetDword("AvatarHash", 0); + cksum = getDword("AvatarHash", 0); - SetString(NULL, "AvatarURL", url); + setString(NULL, "AvatarURL", url); //YAHOO_SetDword("AvatarExpires", ts); - if (!GetString("AvatarInv", &dbv)) { + if (!getString("AvatarInv", &dbv)) { LOG(("[ext_yahoo_got_picture_upload] Buddy: %s told us this is bad??", dbv.pszVal)); LOG(("[ext_yahoo_got_picture] Sending url: %s checksum: %d to '%s'!", url, cksum, dbv.pszVal)); @@ -570,7 +570,7 @@ void CYahooProto::ext_got_avatar_share(int buddy_icon) { LOG(("[ext_yahoo_got_avatar_share] buddy icon: %d", buddy_icon)); - SetByte("ShareAvatar", buddy_icon ); + setByte("ShareAvatar", buddy_icon ); } void CYahooProto::reset_avatar(HANDLE hContact) @@ -586,7 +586,7 @@ void CYahooProto::request_avatar(const char* who) HANDLE hContact = 0; //char szFile[MAX_PATH]; - if (!GetByte("ShowAvatars", 1 )) { + if (!getByte("ShowAvatars", 1 )) { LOG(("Avatars disabled, but available for: %s", who)); return; } @@ -665,14 +665,14 @@ INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam) DBVARIANT dbv; int avtType; - if (!GetString(AI->hContact, YAHOO_LOGINID, &dbv)) { + if (!getString(AI->hContact, YAHOO_LOGINID, &dbv)) { DebugLog("[YAHOO_GETAVATARINFO] For: %s", dbv.pszVal); db_free(&dbv); }else { DebugLog("[YAHOO_GETAVATARINFO]"); } - if (!GetByte("ShowAvatars", 1 ) || !m_bLoggedIn) { + if (!getByte("ShowAvatars", 1 ) || !m_bLoggedIn) { DebugLog("[YAHOO_GETAVATARINFO] %s", m_bLoggedIn ? "We are not using/showing avatars!" : "We are not logged in. Can't load avatars now!"); return GAIR_NOAVATAR; @@ -700,14 +700,14 @@ INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam) if (( wParam & GAIF_FORCE ) != 0 && AI->hContact != NULL) { /* need to request it again? */ - if (GetDword(AI->hContact, "PictLoading", 0) != 0 && - (time(NULL) - GetDword(AI->hContact, "PictLastCheck", 0) < 500)) { + if (getDword(AI->hContact, "PictLoading", 0) != 0 && + (time(NULL) - getDword(AI->hContact, "PictLastCheck", 0) < 500)) { DebugLog("[YAHOO_GETAVATARINFO] Waiting for avatar to load!"); return GAIR_WAITFOR; } else if ( m_bLoggedIn ) { DBVARIANT dbv; - if (!GetString(AI->hContact, YAHOO_LOGINID, &dbv)) { + if (!getString(AI->hContact, YAHOO_LOGINID, &dbv)) { DebugLog("[YAHOO_GETAVATARINFO] Requesting avatar!"); request_avatar(dbv.pszVal); @@ -754,7 +754,7 @@ INT_PTR __cdecl CYahooProto::GetAvatarCaps(WPARAM wParam, LPARAM lParam) case AF_ENABLED: LOG(("[YahooGetAvatarCaps] AF_ENABLED")); - res = (GetByte("ShowAvatars", 1 )) ? 1 : 0; + res = (getByte("ShowAvatars", 1 )) ? 1 : 0; break; case AF_DONTNEEDDELAYS: @@ -792,13 +792,13 @@ INT_PTR __cdecl CYahooProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) if (buffer == NULL || size <= 0) return -1; - if (!GetByte("ShowAvatars", 1 )) + if (!getByte("ShowAvatars", 1 )) return -2; DBVARIANT dbv; int ret = -3; - if (GetDword("AvatarHash", 0)) { + if (getDword("AvatarHash", 0)) { if (!db_get_ts(NULL, m_szModuleName, "AvatarFile", &dbv)) { if (_taccess(dbv.ptszVal, 0) == 0) { lstrcpyn(buffer, dbv.ptszVal, size-1); @@ -839,7 +839,7 @@ INT_PTR __cdecl CYahooProto::SetMyAvatar(WPARAM wParam, LPARAM lParam) /* Send a Yahoo packet saying we don't got an avatar anymore */ yahoo_send_picture_status(m_id, 0); - SetByte("ShareAvatar",0); + setByte("ShareAvatar",0); DeleteFile(tszMyFile); } else { @@ -886,13 +886,13 @@ INT_PTR __cdecl CYahooProto::SetMyAvatar(WPARAM wParam, LPARAM lParam) LOG(("[YAHOO_SetAvatar] File: '%s' CK: %d", tszMyFile, hash)); /* now check and make sure we don't reupload same thing over again */ - if (hash != GetDword("AvatarHash", 0)) { - SetStringT(NULL, "AvatarFile", tszMyFile); + if (hash != getDword("AvatarHash", 0)) { + setTString(NULL, "AvatarFile", tszMyFile); db_set_dw(NULL, m_szModuleName, "TMPAvatarHash", hash); /* Set Sharing to ON if it's OFF */ - if (GetByte("ShareAvatar", 0) != 2) { - SetByte("ShareAvatar", 2 ); + if (getByte("ShareAvatar", 0) != 2) { + setByte("ShareAvatar", 2 ); yahoo_send_picture_status(m_id, 2); } diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp index 638d669de7..11eb0e44f8 100644 --- a/protocols/Yahoo/src/chat.cpp +++ b/protocols/Yahoo/src/chat.cpp @@ -440,7 +440,7 @@ static void clist_chat_invite_send(HANDLE hItem, HWND hwndList, YList* &who, cha else { DBVARIANT dbv; - if (!ppro->GetString(hItem, YAHOO_LOGINID, &dbv)) + if (!ppro->getString(hItem, YAHOO_LOGINID, &dbv)) who = y_list_append(who, dbv.pszVal); } } @@ -469,8 +469,8 @@ static void clist_chat_invite_send(HANDLE hItem, HWND hwndList, YList* &who, cha static void ClistValidateContact(HANDLE hItem, HWND hwndList, CYahooProto* ppro) { - if (!ppro->IsMyContact(hItem) || ppro->GetByte(hItem, "ChatRoom", 0) || - ppro->GetWord(hItem, "Status", ID_STATUS_OFFLINE) == ID_STATUS_ONTHEPHONE) + if (!ppro->IsMyContact(hItem) || ppro->getByte(hItem, "ChatRoom", 0) || + ppro->getWord(hItem, "Status", ID_STATUS_OFFLINE) == ID_STATUS_ONTHEPHONE) SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0); } diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp index b1cdd00da8..6e463ff6af 100644 --- a/protocols/Yahoo/src/file_transfer.cpp +++ b/protocols/Yahoo/src/file_transfer.cpp @@ -723,7 +723,7 @@ HANDLE __cdecl CYahooProto::SendFile( HANDLE hContact, const PROTOCHAR* szDescri DebugLog("Getting Yahoo ID"); */ - if (!GetString(hContact, YAHOO_LOGINID, &dbv)) { + if (!getString(hContact, YAHOO_LOGINID, &dbv)) { long tFileSize = 0; struct _stat statbuf; struct yahoo_file_info *fi; diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp index 65232c733a..e2800095cf 100644 --- a/protocols/Yahoo/src/im.cpp +++ b/protocols/Yahoo/src/im.cpp @@ -23,7 +23,7 @@ void CYahooProto::send_msg(const char *id, int protocol, const char *msg, int ut { LOG(("[send_msg] Who: %s: protocol: %d Msg: '%s', utf: %d", id, protocol, msg, utf8)); - int buddy_icon = (GetDword("AvatarHash", 0) != 0) ? 2: 0; + int buddy_icon = (getDword("AvatarHash", 0) != 0) ? 2: 0; yahoo_send_im(m_id, NULL, id, protocol, msg, utf8, buddy_icon); } @@ -51,7 +51,7 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons return; } - if (GetByte("IgnoreUnknown", 0)) { + if (getByte("IgnoreUnknown", 0)) { /* * Check our buddy list to see if we have it there. And if it's not on the list then we don't accept any IMs. @@ -101,7 +101,7 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons LOG(("%s: %s", who, umsg)); HANDLE hContact = add_buddy(who, who, protocol, PALF_TEMPORARY); - //SetWord(hContact, "yprotoid", protocol); + //setWord(hContact, "yprotoid", protocol); Set_Protocol(hContact, protocol); PROTORECVEVENT pre; @@ -194,8 +194,8 @@ int __cdecl CYahooProto::SendMsg( HANDLE hContact, int flags, const char* pszSrc } DBVARIANT dbv; - if (!GetString( hContact, YAHOO_LOGINID, &dbv)) { - send_msg(dbv.pszVal, GetWord( hContact, "yprotoid", 0), msg, 1); + if (!getString( hContact, YAHOO_LOGINID, &dbv)) { + send_msg(dbv.pszVal, getWord( hContact, "yprotoid", 0), msg, 1); ForkThread( &CYahooProto::im_sendacksuccess, hContact ); @@ -239,8 +239,8 @@ INT_PTR __cdecl CYahooProto::SendNudge(WPARAM wParam, LPARAM lParam) } DBVARIANT dbv; - if (!GetString(hContact, YAHOO_LOGINID, &dbv)) { - send_msg(dbv.pszVal, GetWord(hContact, "yprotoid", 0), "", 0); + if (!getString(hContact, YAHOO_LOGINID, &dbv)) { + send_msg(dbv.pszVal, getWord(hContact, "yprotoid", 0), "", 0); db_free(&dbv); ForkThread( &CYahooProto::im_sendacksuccess, hContact ); diff --git a/protocols/Yahoo/src/options.cpp b/protocols/Yahoo/src/options.cpp index 1cc64865da..d7f2e539ea 100644 --- a/protocols/Yahoo/src/options.cpp +++ b/protocols/Yahoo/src/options.cpp @@ -36,29 +36,29 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, ppro = (CYahooProto*)lParam; SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); - if ( !ppro->GetString( YAHOO_LOGINID, &dbv )) { + if ( !ppro->getString( YAHOO_LOGINID, &dbv )) { SetDlgItemTextA(hwndDlg,IDC_HANDLE,dbv.pszVal); db_free(&dbv); } - if ( !ppro->GetString("Nick", &dbv )) { + if ( !ppro->getString("Nick", &dbv )) { SetDlgItemTextA(hwndDlg,IDC_NICK,dbv.pszVal); db_free(&dbv); } - if ( !ppro->GetString( YAHOO_PASSWORD, &dbv )) { + if ( !ppro->getString( YAHOO_PASSWORD, &dbv )) { //bit of a security hole here, since it's easy to extract a password from an edit box CallService(MS_DB_CRYPT_DECODESTRING, strlen( dbv.pszVal )+1, (LPARAM)dbv.pszVal); SetDlgItemTextA( hwndDlg, IDC_PASSWORD, dbv.pszVal ); db_free( &dbv ); } - //SetButtonCheck( hwndDlg, IDC_DISABLE_UTF8, ppro->GetByte("DisableUTF8", 0)); - SetButtonCheck( hwndDlg, IDC_USE_YAB, ppro->GetByte("UseYAB", 1 )); - SetButtonCheck( hwndDlg, IDC_SHOW_AVATARS, ppro->GetByte("ShowAvatars", 1 )); - SetButtonCheck( hwndDlg, IDC_MAIL_AUTOLOGIN, ppro->GetByte("MailAutoLogin", 1 )); - SetButtonCheck( hwndDlg, IDC_DISABLEYAHOOMAIL, !ppro->GetByte("DisableYahoomail", 0)); - SetButtonCheck( hwndDlg, IDC_SHOW_ERRORS, ppro->GetByte("ShowErrors", 1 )); + //SetButtonCheck( hwndDlg, IDC_DISABLE_UTF8, ppro->getByte("DisableUTF8", 0)); + SetButtonCheck( hwndDlg, IDC_USE_YAB, ppro->getByte("UseYAB", 1 )); + SetButtonCheck( hwndDlg, IDC_SHOW_AVATARS, ppro->getByte("ShowAvatars", 1 )); + SetButtonCheck( hwndDlg, IDC_MAIL_AUTOLOGIN, ppro->getByte("MailAutoLogin", 1 )); + SetButtonCheck( hwndDlg, IDC_DISABLEYAHOOMAIL, !ppro->getByte("DisableYahoomail", 0)); + SetButtonCheck( hwndDlg, IDC_SHOW_ERRORS, ppro->getByte("ShowErrors", 1 )); return TRUE; @@ -67,7 +67,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, switch ( LOWORD( wParam )) { case IDC_NEWYAHOOACCOUNTLINK: CallService(MS_UTILS_OPENURL, 1, - ppro->GetByte("YahooJapan", 0) ? + ppro->getByte("YahooJapan", 0) ? (LPARAM)"http://edit.yahoo.co.jp/config/eval_register" : (LPARAM)"http://edit.yahoo.com/config/eval_register"); return TRUE; @@ -101,23 +101,23 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, GetDlgItemTextA( hwndDlg, IDC_HANDLE, str, sizeof( str )); dbv.pszVal = NULL; - if ( ppro->GetString( YAHOO_LOGINID, &dbv ) || lstrcmpA( str, dbv.pszVal )) + if ( ppro->getString( YAHOO_LOGINID, &dbv ) || lstrcmpA( str, dbv.pszVal )) reconnectRequired = TRUE; if ( dbv.pszVal != NULL) db_free( &dbv ); - ppro->SetString( YAHOO_LOGINID, str ); + ppro->setString( YAHOO_LOGINID, str ); GetDlgItemTextA( hwndDlg, IDC_PASSWORD, str, sizeof( str )); CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(str), (LPARAM)str); dbv.pszVal = NULL; - if ( ppro->GetString( YAHOO_PASSWORD, &dbv ) || lstrcmpA( str, dbv.pszVal )) + if ( ppro->getString( YAHOO_PASSWORD, &dbv ) || lstrcmpA( str, dbv.pszVal )) reconnectRequired = TRUE; if ( dbv.pszVal != NULL) db_free( &dbv ); - ppro->SetString( YAHOO_PASSWORD, str ); + ppro->setString( YAHOO_PASSWORD, str ); GetDlgItemTextA( hwndDlg, IDC_NICK, str, sizeof( str )); @@ -126,15 +126,15 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, db_unset( NULL, ppro->m_szModuleName, "Nick"); } else { /* otherwise save the new Nick */ - ppro->SetString("Nick", str ); + ppro->setString("Nick", str ); } - //ppro->SetByte("DisableUTF8", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_DISABLE_UTF8 )); - ppro->SetByte("UseYAB", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_USE_YAB )); - ppro->SetByte("ShowAvatars", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_SHOW_AVATARS )); - ppro->SetByte("MailAutoLogin", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_MAIL_AUTOLOGIN )); - ppro->SetByte("DisableYahoomail", ( BYTE )!IsDlgButtonChecked( hwndDlg, IDC_DISABLEYAHOOMAIL )); - ppro->SetByte("ShowErrors", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_SHOW_ERRORS )); + //ppro->setByte("DisableUTF8", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_DISABLE_UTF8 )); + ppro->setByte("UseYAB", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_USE_YAB )); + ppro->setByte("ShowAvatars", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_SHOW_AVATARS )); + ppro->setByte("MailAutoLogin", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_MAIL_AUTOLOGIN )); + ppro->setByte("DisableYahoomail", ( BYTE )!IsDlgButtonChecked( hwndDlg, IDC_DISABLEYAHOOMAIL )); + ppro->setByte("ShowErrors", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_SHOW_ERRORS )); if (reconnectRequired ) { db_unset(NULL, ppro->m_szModuleName, YAHOO_PWTOKEN); @@ -169,18 +169,18 @@ static INT_PTR CALLBACK DlgProcYahooOptsConn(HWND hwndDlg, UINT msg, WPARAM wPar ppro = ( CYahooProto* )lParam; SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); - if ( !ppro->GetString( YAHOO_LOGINSERVER, &dbv )) { + if ( !ppro->getString( YAHOO_LOGINSERVER, &dbv )) { SetDlgItemTextA( hwndDlg, IDC_LOGINSERVER, dbv.pszVal ); db_free( &dbv ); } else SetDlgItemTextA( hwndDlg, IDC_LOGINSERVER, - ppro->GetByte("YahooJapan", 0) + ppro->getByte("YahooJapan", 0) ? YAHOO_DEFAULT_JAPAN_LOGIN_SERVER : YAHOO_DEFAULT_LOGIN_SERVER ); - SetDlgItemInt( hwndDlg, IDC_YAHOOPORT, ppro->GetWord( NULL, YAHOO_LOGINPORT, YAHOO_DEFAULT_PORT ), FALSE ); + SetDlgItemInt( hwndDlg, IDC_YAHOOPORT, ppro->getWord( NULL, YAHOO_LOGINPORT, YAHOO_DEFAULT_PORT ), FALSE ); - SetButtonCheck( hwndDlg, IDC_YAHOO_JAPAN, ppro->GetByte("YahooJapan", 0)); + SetButtonCheck( hwndDlg, IDC_YAHOO_JAPAN, ppro->getByte("YahooJapan", 0)); return TRUE; case WM_COMMAND: @@ -221,21 +221,21 @@ static INT_PTR CALLBACK DlgProcYahooOptsConn(HWND hwndDlg, UINT msg, WPARAM wPar GetDlgItemTextA( hwndDlg, IDC_LOGINSERVER, str, sizeof( str )); - if ( ppro->GetString( YAHOO_LOGINSERVER, &dbv ) || lstrcmpA( str, dbv.pszVal )) + if ( ppro->getString( YAHOO_LOGINSERVER, &dbv ) || lstrcmpA( str, dbv.pszVal )) reconnectRequired = TRUE; if ( dbv.pszVal != NULL) db_free( &dbv ); - ppro->SetString( YAHOO_LOGINSERVER, str ); + ppro->setString( YAHOO_LOGINSERVER, str ); port = GetDlgItemInt( hwndDlg, IDC_YAHOOPORT, NULL, FALSE ); - if ( ppro->GetWord(NULL, YAHOO_LOGINPORT, -1) != port) + if ( ppro->getWord(NULL, YAHOO_LOGINPORT, -1) != port) reconnectRequired = TRUE; - ppro->SetWord( NULL, YAHOO_LOGINPORT, port); + ppro->setWord( NULL, YAHOO_LOGINPORT, port); - ppro->SetByte("YahooJapan", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_YAHOO_JAPAN )); + ppro->setByte("YahooJapan", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_YAHOO_JAPAN )); /*if ( restartRequired ) MessageBoxA( hwndDlg, Translate("The changes you have made require you to restart Miranda NG before they take effect"), Translate("YAHOO Options"), MB_OK ); @@ -265,7 +265,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsIgnore(HWND hwndDlg, UINT msg, WPARAM wP ppro = ( CYahooProto* )lParam; SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); - if ( ppro->GetByte("IgnoreUnknown", 0)) { + if ( ppro->getByte("IgnoreUnknown", 0)) { CheckDlgButton(hwndDlg, IDC_OPT_IGN_UNKNOWN, 1); EnableWindow( GetDlgItem(hwndDlg, IDC_IGN_ADD), 0); @@ -352,7 +352,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsIgnore(HWND hwndDlg, UINT msg, WPARAM wP case WM_NOTIFY: if (((LPNMHDR)lParam)->code == PSN_APPLY ) { - ppro->SetByte("IgnoreUnknown", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_OPT_IGN_UNKNOWN )); + ppro->setByte("IgnoreUnknown", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_OPT_IGN_UNKNOWN )); return TRUE; } break; diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 35444e3486..fee84eaccd 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -210,7 +210,7 @@ int CYahooProto::Authorize( HANDLE hdbe ) if (who) { ptrA myid( db_get_sa(hContact, m_szModuleName, "MyIdentity")); DebugLog("Accepting buddy:%s", who); - accept(myid, who, GetWord(hContact, "yprotoid", 0)); + accept(myid, who, getWord(hContact, "yprotoid", 0)); } } @@ -257,7 +257,7 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) ptrA u_reason( mir_utf8encodeT(reason)); DebugLog("Rejecting buddy:%s msg: %s", who, u_reason); - reject(myid, who, GetWord(hContact, "yprotoid", 0), u_reason); + reject(myid, who, getWord(hContact, "yprotoid", 0), u_reason); CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0); } } @@ -412,9 +412,9 @@ int __cdecl CYahooProto::SetApparentMode( HANDLE hContact, int mode ) if (mode && mode != ID_STATUS_OFFLINE) return 1; - int oldMode = GetWord(hContact, "ApparentMode", 0); + int oldMode = getWord(hContact, "ApparentMode", 0); if (mode != oldMode) - SetWord(hContact, "ApparentMode", mode); + setWord(hContact, "ApparentMode", mode); return 1; } @@ -442,7 +442,7 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus ) /* * Load Yahoo ID from the database. */ - if (!GetString(YAHOO_LOGINID, &dbv)) { + if (!getString(YAHOO_LOGINID, &dbv)) { if (lstrlenA(dbv.pszVal) > 0) { lstrcpynA(m_yahoo_id, dbv.pszVal, 255); } else @@ -456,7 +456,7 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus ) if (err) { lstrcpynA(errmsg, Translate("Please enter your yahoo id in Options/Network/Yahoo"), 80); } else { - if (!GetString(YAHOO_PASSWORD, &dbv)) { + if (!getString(YAHOO_PASSWORD, &dbv)) { CallService(MS_DB_CRYPT_DECODESTRING, lstrlenA(dbv.pszVal) + 1, (LPARAM) dbv.pszVal); if (lstrlenA(dbv.pszVal) > 0) { lstrcpynA(m_password, dbv.pszVal, 255); @@ -485,7 +485,7 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus ) FREE(m_pw_token); // No Token yet. - if (!GetString(YAHOO_PWTOKEN, &dbv)) { + if (!getString(YAHOO_PWTOKEN, &dbv)) { if (lstrlenA(dbv.pszVal) > 0) { m_pw_token = strdup(dbv.pszVal); } @@ -531,7 +531,7 @@ void __cdecl CYahooProto::get_status_thread(HANDLE hContact) Sleep( 150 ); /* Check Yahoo Games Message */ - if (!GetString(hContact, "YGMsg", &dbv)) { + if (!getString(hContact, "YGMsg", &dbv)) { gm = strdup(dbv.pszVal); db_free( &dbv ); @@ -543,7 +543,7 @@ void __cdecl CYahooProto::get_status_thread(HANDLE hContact) db_free( &dbv ); } else { - WORD status = GetWord(hContact, "YStatus", YAHOO_STATUS_OFFLINE); + WORD status = getWord(hContact, "YStatus", YAHOO_STATUS_OFFLINE); sm = yahoo_status_code( yahoo_status( status )); if (sm) sm = strdup(sm); /* we need this to go global FREE later */ } @@ -588,7 +588,7 @@ HANDLE __cdecl CYahooProto::GetAwayMsg( HANDLE hContact ) DebugLog("[YahooGetAwayMessage] "); if (hContact && m_bLoggedIn) { - if (GetWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) + if (getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) return 0; /* user offline, what Status message? */ ForkThread(&CYahooProto::get_status_thread, hContact); @@ -688,9 +688,9 @@ int __cdecl CYahooProto::UserIsTyping( HANDLE hContact, int type ) return 0; DBVARIANT dbv; - if (!GetString(hContact, YAHOO_LOGINID, &dbv)) { + if (!getString(hContact, YAHOO_LOGINID, &dbv)) { if (type == PROTOTYPE_SELFTYPING_OFF || type == PROTOTYPE_SELFTYPING_ON) { - sendtyping(dbv.pszVal, GetWord(hContact, "yprotoid", 0), type == PROTOTYPE_SELFTYPING_ON?1:0); + sendtyping(dbv.pszVal, getWord(hContact, "yprotoid", 0), type == PROTOTYPE_SELFTYPING_ON?1:0); } db_free(&dbv); } @@ -741,20 +741,20 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); DBVARIANT dbv; - if ( !ppro->GetString(YAHOO_LOGINID, &dbv)) + if ( !ppro->getString(YAHOO_LOGINID, &dbv)) { SetDlgItemTextA(hwndDlg, IDC_HANDLE, dbv.pszVal); db_free(&dbv); } - if ( !ppro->GetString(YAHOO_PASSWORD, &dbv)) + if ( !ppro->getString(YAHOO_PASSWORD, &dbv)) { CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal); SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal); db_free(&dbv); } - SetButtonCheck( hwndDlg, IDC_YAHOO_JAPAN, ppro->GetByte("YahooJapan", 0)); + SetButtonCheck( hwndDlg, IDC_YAHOO_JAPAN, ppro->getByte("YahooJapan", 0)); return TRUE; } @@ -792,17 +792,17 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM dbv.pszVal = NULL; - if ( ppro->GetString( YAHOO_LOGINID, &dbv ) || lstrcmpA( str, dbv.pszVal )) + if ( ppro->getString( YAHOO_LOGINID, &dbv ) || lstrcmpA( str, dbv.pszVal )) reconnectRequired = TRUE; if ( dbv.pszVal != NULL) db_free( &dbv ); - ppro->SetString(YAHOO_LOGINID, str); + ppro->setString(YAHOO_LOGINID, str); GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(str)); dbv.pszVal = NULL; - if ( ppro->GetString( YAHOO_PASSWORD, &dbv ) || lstrcmpA( str, dbv.pszVal )) + if ( ppro->getString( YAHOO_PASSWORD, &dbv ) || lstrcmpA( str, dbv.pszVal )) reconnectRequired = TRUE; if ( dbv.pszVal != NULL) db_free( &dbv ); @@ -812,8 +812,8 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(str), (LPARAM) str); - ppro->SetString(YAHOO_PASSWORD, str); - ppro->SetByte("YahooJapan", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_YAHOO_JAPAN )); + ppro->setString(YAHOO_PASSWORD, str); + ppro->setByte("YahooJapan", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_YAHOO_JAPAN )); if ( reconnectRequired && ppro->m_bLoggedIn ) MessageBoxA( hwndDlg, Translate("The changes you have made require you to reconnect to the Yahoo network before they take effect"), Translate("YAHOO Options"), MB_OK ); diff --git a/protocols/Yahoo/src/proto.h b/protocols/Yahoo/src/proto.h index c7f139743b..468165d1bd 100644 --- a/protocols/Yahoo/src/proto.h +++ b/protocols/Yahoo/src/proto.h @@ -224,28 +224,9 @@ struct CYahooProto : public PROTO int __cdecl OnUserInfoInit( WPARAM wParam, LPARAM lParam ); //====| util.cpp |==================================================================== - int GetByte( const char* valueName, int parDefltValue ); - int SetByte( const char* valueName, int parValue ); - int GetByte( HANDLE hContact, const char* valueName, int parDefltValue ); - int SetByte( HANDLE hContact, const char* valueName, int parValue ); - - int GetString( const char* name, DBVARIANT* ); - int GetString( HANDLE hContact, const char* name, DBVARIANT* ); int GetStringUtf( HANDLE hContact, const char* name, DBVARIANT* ); - - void SetString( const char* name, const char* value ); - void SetString( HANDLE hContact, const char* name, const char* value ); - void SetStringT( HANDLE hContact, const char* name, const TCHAR* value ); DWORD SetStringUtf( HANDLE hContact, const char* valueName, const char* parValue ); - DWORD GetDword( const char* valueName, DWORD parDefltValue ); - DWORD SetDword( const char* valueName, DWORD parValue ); - DWORD GetDword( HANDLE hContact, const char* valueName, DWORD parDefltValue ); - DWORD SetDword( HANDLE hContact, const char* valueName, DWORD parValue ); - - WORD GetWord( HANDLE hContact, const char* valueName, int parDefltValue ); - WORD SetWord( HANDLE hContact, const char* valueName, int parValue ); - DWORD Set_Protocol( HANDLE hContact, int protocol ); int ShowNotification(const TCHAR *title, const TCHAR *info, DWORD flags); diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index 5c6f90433c..b78d380f05 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -31,10 +31,10 @@ void CYahooProto::logoff_buddies() { //set all contacts to 'offline' for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { - SetWord( hContact, "Status", ID_STATUS_OFFLINE ); - SetDword(hContact, "IdleTS", 0); - SetDword(hContact, "PictLastCheck", 0); - SetDword(hContact, "PictLoading", 0); + setWord( hContact, "Status", ID_STATUS_OFFLINE ); + setDword(hContact, "IdleTS", 0); + setDword(hContact, "PictLastCheck", 0); + setDword(hContact, "PictLoading", 0); db_unset(hContact, "CList", "StatusMsg"); db_unset(hContact, m_szModuleName, "YMsg"); db_unset(hContact, m_szModuleName, "YGMsg"); @@ -97,9 +97,9 @@ int __cdecl CYahooProto::OnContactDeleted( WPARAM wParam, LPARAM lParam ) return 0; } - if (!GetString(hContact, YAHOO_LOGINID, &dbv)) { + if (!getString(hContact, YAHOO_LOGINID, &dbv)) { DebugLog("[YahooContactDeleted] Removing %s", dbv.pszVal); - remove_buddy(dbv.pszVal, GetWord(hContact, "yprotoid", 0)); + remove_buddy(dbv.pszVal, getWord(hContact, "yprotoid", 0)); db_free( &dbv ); } else { @@ -136,7 +136,7 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam EnableWindow( GetDlgItem( hwndDlg, IDOK ), FALSE ); } - CheckDlgButton( hwndDlg, IDC_CUSTSTATBUSY, ppro->GetByte("BusyCustStat", 0)); + CheckDlgButton( hwndDlg, IDC_CUSTSTATBUSY, ppro->getByte("BusyCustStat", 0)); } return TRUE; @@ -151,8 +151,8 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam GetDlgItemTextA( hwndDlg, IDC_CUSTSTAT, str, sizeof( str )); /* Save it for later use */ - ppro->SetString( YAHOO_CUSTSTATDB, str ); - ppro->SetByte("BusyCustStat", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_CUSTSTATBUSY )); + ppro->setString( YAHOO_CUSTSTATDB, str ); + ppro->setByte("BusyCustStat", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_CUSTSTATBUSY )); /* set for Idle/AA */ if (ppro->m_startMsg) mir_free(ppro->m_startMsg); @@ -220,7 +220,7 @@ void CYahooProto::OpenURL(const char *url, int autoLogin) DebugLog("[YahooOpenURL] url: %s Auto Login: %d", url, autoLogin); - if (autoLogin && GetByte("MailAutoLogin", 0) && m_bLoggedIn && m_id > 0) { + if (autoLogin && getByte("MailAutoLogin", 0) && m_bLoggedIn && m_id > 0) { char *y, *t, *u; y = yahoo_urlencode(yahoo_get_cookie(m_id, "y")); @@ -253,11 +253,11 @@ INT_PTR __cdecl CYahooProto::OnShowProfileCommand( WPARAM wParam, LPARAM lParam /** * We don't show profile for users using other IM clients through the IM server bridge */ - if (GetWord(( HANDLE )wParam, "yprotoid", 0) != 0) { + if (getWord(( HANDLE )wParam, "yprotoid", 0) != 0) { return 0; } - if (GetString((HANDLE)wParam, YAHOO_LOGINID, &dbv)) + if (getString((HANDLE)wParam, YAHOO_LOGINID, &dbv)) return 0; _snprintf( tUrl, sizeof( tUrl ), "http://profiles.yahoo.com/%s", dbv.pszVal ); @@ -280,7 +280,7 @@ INT_PTR __cdecl CYahooProto::OnShowMyProfileCommand( WPARAM wParam, LPARAM lPara { DBVARIANT dbv; - if ( GetString( YAHOO_LOGINID, &dbv ) != 0) { + if ( getString( YAHOO_LOGINID, &dbv ) != 0) { ShowError( TranslateT("Yahoo Error"), TranslateT("Please enter your yahoo id in Options/Network/Yahoo")); return 0; } @@ -298,7 +298,7 @@ INT_PTR __cdecl CYahooProto::OnShowMyProfileCommand( WPARAM wParam, LPARAM lPara //======================================================= INT_PTR __cdecl CYahooProto::OnGotoMailboxCommand( WPARAM wParam, LPARAM lParam ) { - if (GetByte("YahooJapan", 0)) + if (getByte("YahooJapan", 0)) OpenURL("http://mail.yahoo.co.jp/", 1); else OpenURL("http://mail.yahoo.com/", 1); @@ -502,7 +502,7 @@ int __cdecl CYahooProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) return 0; } - Menu_ShowItem(hShowProfileMenuItem, GetWord(hContact, "yprotoid", 0) == 0); + Menu_ShowItem(hShowProfileMenuItem, getWord(hContact, "yprotoid", 0) == 0); return 0; } diff --git a/protocols/Yahoo/src/user_info.cpp b/protocols/Yahoo/src/user_info.cpp index 05def506b0..4f3bc291b3 100644 --- a/protocols/Yahoo/src/user_info.cpp +++ b/protocols/Yahoo/src/user_info.cpp @@ -62,7 +62,7 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wPa DBVARIANT dbv; char z[128]; - if (ppro->GetString( hContact, YAHOO_LOGINID, &dbv ) == 0) { + if (ppro->getString( hContact, YAHOO_LOGINID, &dbv ) == 0) { strcpy(z, dbv.pszVal); db_free( &dbv ); } else { @@ -71,7 +71,7 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wPa SetDlgItemTextA(hwndDlg, IDC_SEARCH_ID, z); - if (ppro->GetString( hContact, "Transport", &dbv ) == 0) { + if (ppro->getString( hContact, "Transport", &dbv ) == 0) { strcpy(z, dbv.pszVal); db_free( &dbv ); } else { @@ -80,7 +80,7 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wPa SetDlgItemTextA(hwndDlg, IDC_SEARCH_PROTOCOL, z); - if (ppro->GetString( hContact, "MirVer", &dbv ) == 0) { + if (ppro->getString( hContact, "MirVer", &dbv ) == 0) { strcpy(z, dbv.pszVal); db_free( &dbv ); } else { diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp index 9813d2c825..f2e3ecda7a 100644 --- a/protocols/Yahoo/src/util.cpp +++ b/protocols/Yahoo/src/util.cpp @@ -54,63 +54,11 @@ int DebugLog( const char *fmt, ... ) return CallService(MS_NETLIB_LOG, (WPARAM)g_hNetlibUser, (LPARAM)str); } -int CYahooProto::GetByte( const char* valueName, int parDefltValue ) -{ - return db_get_b( NULL, m_szModuleName, valueName, parDefltValue ); -} - -int CYahooProto::SetByte( const char* valueName, int parValue ) -{ - return db_set_b( NULL, m_szModuleName, valueName, parValue ); -} - -int CYahooProto::GetByte( HANDLE hContact, const char* valueName, int parDefltValue ) -{ - return db_get_b( hContact, m_szModuleName, valueName, parDefltValue ); -} - -int CYahooProto::SetByte( HANDLE hContact, const char* valueName, int parValue ) -{ - return db_set_b( hContact, m_szModuleName, valueName, parValue ); -} - - -DWORD CYahooProto::GetDword( HANDLE hContact, const char* valueName, DWORD parDefltValue ) -{ - return db_get_dw( hContact, m_szModuleName, valueName, parDefltValue ); -} - -DWORD CYahooProto::SetDword( const char* valueName, DWORD parValue ) -{ - return db_set_dw( NULL, m_szModuleName, valueName, parValue); -} - -DWORD CYahooProto::GetDword( const char* valueName, DWORD parDefltValue ) -{ - return db_get_dw( NULL, m_szModuleName, valueName, parDefltValue ); -} - -DWORD CYahooProto::SetDword( HANDLE hContact, const char* valueName, DWORD parValue ) -{ - return db_set_dw( hContact, m_szModuleName, valueName, parValue); -} - - -WORD CYahooProto::SetWord( HANDLE hContact, const char* valueName, int parValue ) -{ - return db_set_w( hContact, m_szModuleName, valueName, parValue ); -} - -WORD CYahooProto::GetWord( HANDLE hContact, const char* valueName, int parDefltValue ) -{ - return db_get_w( hContact, m_szModuleName, valueName, parDefltValue ); -} - DWORD CYahooProto::Set_Protocol( HANDLE hContact, int protocol ) { char *s=NULL; - SetWord(hContact, "yprotoid", protocol); + setWord(hContact, "yprotoid", protocol); switch (protocol) { case YAHOO_IM_YAHOO: s = "Yahoo"; break; /* Yahoo, nothing special here */ @@ -120,36 +68,16 @@ DWORD CYahooProto::Set_Protocol( HANDLE hContact, int protocol ) } if (protocol != YAHOO_IM_YAHOO) - SetString(hContact, "MirVer", s); + setString(hContact, "MirVer", s); - SetString(hContact, "Transport", s); + setString(hContact, "Transport", s); return 0; } -int CYahooProto::GetString(const char* name, DBVARIANT* result) -{ return db_get_s(NULL, m_szModuleName, name, result); -} - -int CYahooProto::GetString(HANDLE hContact, const char* name, DBVARIANT* result) -{ return db_get_s(hContact, m_szModuleName, name, result); -} - int CYahooProto::GetStringUtf(HANDLE hContact, const char* name, DBVARIANT* result) { return db_get_utf(hContact, m_szModuleName, name, result); } -void CYahooProto::SetString(const char* name, const char* value) -{ db_set_s(NULL, m_szModuleName, name, value); -} - -void CYahooProto::SetString( HANDLE hContact, const char* name, const char* value) -{ db_set_s(hContact, m_szModuleName, name, value); -} - -void CYahooProto::SetStringT( HANDLE hContact, const char* name, const TCHAR* value) -{ db_set_ts(hContact, m_szModuleName, name, value); -} - DWORD CYahooProto::SetStringUtf(HANDLE hContact, const char* valueName, const char* parValue) { return db_set_utf(hContact, m_szModuleName, valueName, parValue); } @@ -234,7 +162,7 @@ int CYahooProto::ShowNotification(const TCHAR *title, const TCHAR *info, DWORD f void CYahooProto::ShowError(const TCHAR *title, const TCHAR *buff) { - if ( GetByte("ShowErrors", 1)) + if ( getByte("ShowErrors", 1)) if ( !ShowPopup(title, buff, NULL)) ShowNotification(title, buff, NIIF_ERROR); } @@ -249,8 +177,8 @@ int __cdecl CYahooProto::OnSettingChanged(WPARAM wParam, LPARAM lParam) DebugLog("DB Setting changed. YAHOO user's visible setting changed."); DBVARIANT dbv; - if (!GetString((HANDLE)wParam, YAHOO_LOGINID, &dbv)) { - int iAdd = (ID_STATUS_OFFLINE == GetWord((HANDLE) wParam, "ApparentMode", 0)); + if (!getString((HANDLE)wParam, YAHOO_LOGINID, &dbv)) { + int iAdd = (ID_STATUS_OFFLINE == getWord((HANDLE) wParam, "ApparentMode", 0)); stealth(dbv.pszVal, iAdd); db_free(&dbv); } diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index 1b6fafa066..e67eb052ef 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -181,7 +181,7 @@ void CYahooProto::stealth(const char *buddy, int add) /* Safety check, don't dereference Invalid pointers */ if (m_id > 0) - yahoo_set_stealth(m_id, buddy, GetWord(getbuddyH(buddy), "yprotoid", 0), add); + yahoo_set_stealth(m_id, buddy, getWord(getbuddyH(buddy), "yprotoid", 0), add); } void CYahooProto::remove_buddy(const char *who, int protocol) @@ -241,7 +241,7 @@ void CYahooProto::AddBuddy(HANDLE hContact, const char *group, const TCHAR *msg) No refresh needed. */ - if (!GetString(hContact, YAHOO_LOGINID, &dbv)) + if (!getString(hContact, YAHOO_LOGINID, &dbv)) { who = strdup(dbv.pszVal); db_free(&dbv); @@ -249,10 +249,10 @@ void CYahooProto::AddBuddy(HANDLE hContact, const char *group, const TCHAR *msg) else return; - protocol = GetWord(hContact, "yprotoid", 0); + protocol = getWord(hContact, "yprotoid", 0); u_msg = mir_utf8encodeT(msg); - if (!GetString(hContact, "MyIdentity", &dbv)) + if (!getString(hContact, "MyIdentity", &dbv)) { ident = strdup(dbv.pszVal); db_free(&dbv); @@ -286,7 +286,7 @@ HANDLE CYahooProto::getbuddyH(const char *yahoo_id) { for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { DBVARIANT dbv; - if (GetString(hContact, YAHOO_LOGINID, &dbv)) + if (getString(hContact, YAHOO_LOGINID, &dbv)) continue; int tCompareResult = lstrcmpiA( dbv.pszVal, yahoo_id ); @@ -321,7 +321,7 @@ HANDLE CYahooProto::add_buddy( const char *yahoo_id, const char *yahoo_name, int LOG(("[add_buddy] Adding buddy id: %s (Nick: %s), flags: %lu", yid, yahoo_name, flags)); hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact,(LPARAM)m_szModuleName); - SetString( hContact, YAHOO_LOGINID, yid ); + setString( hContact, YAHOO_LOGINID, yid ); Set_Protocol( hContact, protocol ); if (lstrlenA(yahoo_name) > 0) @@ -378,13 +378,13 @@ void CYahooProto::ext_status_changed(const char *who, int protocol, int stat, co } if (!mobile) - SetWord(hContact, "Status", yahoo_to_miranda_status(stat,away)); + setWord(hContact, "Status", yahoo_to_miranda_status(stat,away)); else - SetWord(hContact, "Status", ID_STATUS_ONTHEPHONE); + setWord(hContact, "Status", ID_STATUS_ONTHEPHONE); - SetWord(hContact, "YStatus", stat); - SetWord(hContact, "YAway", away); - SetWord(hContact, "Mobile", mobile); + setWord(hContact, "YStatus", stat); + setWord(hContact, "YAway", away); + setWord(hContact, "Mobile", mobile); if (msg) { YAHOO_DEBUGLOG("[ext_status_changed] %s custom message '%s'", who, msg); @@ -517,7 +517,7 @@ void CYahooProto::ext_status_logon(const char *who, int protocol, int stat, cons } if (s != NULL) - SetString( hContact, "MirVer", s); + setString( hContact, "MirVer", s); else db_unset( hContact, m_szModuleName, "MirVer"); @@ -604,7 +604,7 @@ void CYahooProto::ext_got_stealth(char *stealthlist) for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { DBVARIANT dbv; - if (GetString( hContact, YAHOO_LOGINID, &dbv)) + if (getString( hContact, YAHOO_LOGINID, &dbv)) continue; found = 0; @@ -622,13 +622,13 @@ void CYahooProto::ext_got_stealth(char *stealthlist) if (found) { /* we have him on our Stealth List */ YAHOO_DEBUGLOG("Setting STEALTH for id = %s", dbv.pszVal); /* need to set the ApparentMode thingy */ - if (ID_STATUS_OFFLINE != GetWord(hContact, "ApparentMode", 0)) - GetWord(hContact, "ApparentMode", ID_STATUS_OFFLINE); + if (ID_STATUS_OFFLINE != getWord(hContact, "ApparentMode", 0)) + getWord(hContact, "ApparentMode", ID_STATUS_OFFLINE); } else { /* he is not on the Stealth List */ //LOG(("Resetting STEALTH for id = %s", dbv.pszVal)); /* need to delete the ApparentMode thingy */ - if (GetWord(hContact, "ApparentMode", 0)) + if (getWord(hContact, "ApparentMode", 0)) db_unset(hContact, m_szModuleName, "ApparentMode"); } @@ -670,19 +670,19 @@ void CYahooProto::ext_got_buddies(YList * buds) if (bud->stealth) { /* we have him on our Stealth List */ YAHOO_DEBUGLOG("Setting STEALTH for id = %s", bud->id); /* need to set the ApparentMode thingy */ - if (ID_STATUS_OFFLINE != GetWord(hContact, "ApparentMode", 0)) - SetWord(hContact, "ApparentMode", (WORD) ID_STATUS_OFFLINE); + if (ID_STATUS_OFFLINE != getWord(hContact, "ApparentMode", 0)) + setWord(hContact, "ApparentMode", (WORD) ID_STATUS_OFFLINE); } else { /* he is not on the Stealth List */ //LOG(("Resetting STEALTH for id = %s", dbv.pszVal)); /* need to delete the ApparentMode thingy */ - if (GetWord(hContact, "ApparentMode", 0)) + if (getWord(hContact, "ApparentMode", 0)) db_unset(hContact, m_szModuleName, "ApparentMode"); } //if (bud->auth) // YAHOO_DEBUGLOG("Auth request waiting for: %s", bud->id ); - SetByte(hContact, "YAuth", bud->auth); + setByte(hContact, "YAuth", bud->auth); if (bud->real_name) { YAHOO_DEBUGLOG("id = %s name = %s", bud->id, bud->real_name); @@ -699,18 +699,18 @@ void CYahooProto::ext_got_buddies(YList * buds) SetStringUtf( hContact, "LastName", bud->yab_entry->lname); if (bud->yab_entry->email) - SetString( hContact, "e-mail", bud->yab_entry->email); + setString( hContact, "e-mail", bud->yab_entry->email); if (bud->yab_entry->mphone) - SetString( hContact, "Cellular", bud->yab_entry->mphone); + setString( hContact, "Cellular", bud->yab_entry->mphone); if (bud->yab_entry->hphone) - SetString( hContact, "Phone", bud->yab_entry->hphone); + setString( hContact, "Phone", bud->yab_entry->hphone); if (bud->yab_entry->wphone) - SetString( hContact, "CompanyPhone", bud->yab_entry->wphone); + setString( hContact, "CompanyPhone", bud->yab_entry->wphone); - SetWord( hContact, "YabID", bud->yab_entry->dbid); + setWord( hContact, "YabID", bud->yab_entry->dbid); } } @@ -812,11 +812,11 @@ void CYahooProto::ext_contact_added(const char *myid, const char *who, const cha SetStringUtf(hContact, "Nick", nick); if (strcmp(myid, m_yahoo_id)) - SetString(hContact, "MyIdentity", myid); + setString(hContact, "MyIdentity", myid); else db_unset(hContact, m_szModuleName, "MyIdentity"); - //SetWord(hContact, "yprotoid", protocol); + //setWord(hContact, "yprotoid", protocol); Set_Protocol(hContact, protocol); pre.flags = PREF_UTF; @@ -911,7 +911,7 @@ void CYahooProto::ext_game_notify(const char *me, const char *who, int stat, con return; if (stat == 2) - SetString(hContact, "YGMsg", ""); + setString(hContact, "YGMsg", ""); else if (msg) { const char *l = msg, *u = NULL; char *z, *c; @@ -970,7 +970,7 @@ void CYahooProto::ext_game_notify(const char *me, const char *who, int stat, con } else { /* ? no information / reset custom message */ - SetString(hContact, "YGMsg", ""); + setString(hContact, "YGMsg", ""); } } @@ -981,7 +981,7 @@ void CYahooProto::ext_mail_notify(const char *from, const char *subj, int cnt) if (cnt > 0) { SkinPlaySound("mail"); - if (!GetByte("DisableYahoomail", 0)) { + if (!getByte("DisableYahoomail", 0)) { TCHAR z[MAX_SECONDLINE], title[MAX_CONTACTNAME]; if (from == NULL) { @@ -1092,7 +1092,7 @@ void CYahooProto::ext_got_ping(const char *errormsg) /** * Now load the YAB. */ - if (GetByte("UseYAB", 1 )) { + if (getByte("UseYAB", 1 )) { LOG(("[ext_got_ping] GET YAB")); if (m_iStatus != ID_STATUS_OFFLINE) mir_forkthread(yahoo_get_yab_thread, (void *)m_id); @@ -1116,7 +1116,7 @@ void CYahooProto::ext_login_response(int succ, const char *url) c = yahoo_get_pw_token(m_id); - SetString(YAHOO_PWTOKEN, c); + setString(YAHOO_PWTOKEN, c); LOG(("PW Token-> %s", c)); return; @@ -1513,7 +1513,7 @@ void CYahooProto::ext_login(enum yahoo_status login_mode) NETLIBHTTPREQUEST nlhr={0},*nlhrReply; char z[4096]; - wsprintfA(z, "http://%s%s", GetByte("YahooJapan",0) != 0 ? "cs1.msg.vip.ogk.yahoo.co.jp" : "vcs.msg.yahoo.com", "/capacity"); + wsprintfA(z, "http://%s%s", getByte("YahooJapan",0) != 0 ? "cs1.msg.vip.ogk.yahoo.co.jp" : "vcs.msg.yahoo.com", "/capacity"); nlhr.cbSize = sizeof(nlhr); nlhr.requestType= REQUEST_GET; nlhr.flags = NLHRF_HTTP11; @@ -1545,21 +1545,21 @@ void CYahooProto::ext_login(enum yahoo_status login_mode) } if (host[0] == '\0') { - if (!GetString(YAHOO_LOGINSERVER, &dbv)) { + if (!getString(YAHOO_LOGINSERVER, &dbv)) { mir_snprintf(host, sizeof(host), "%s", dbv.pszVal); db_free(&dbv); } else { snprintf(host, sizeof(host), "%s", - GetByte("YahooJapan",0) != 0 ? YAHOO_DEFAULT_JAPAN_LOGIN_SERVER : + getByte("YahooJapan",0) != 0 ? YAHOO_DEFAULT_JAPAN_LOGIN_SERVER : YAHOO_DEFAULT_LOGIN_SERVER ); } } - lstrcpynA(fthost,GetByte("YahooJapan",0)?"filetransfer.msg.yahoo.co.jp":"filetransfer.msg.yahoo.com" , sizeof(fthost)); - lstrcpynA(login_host,GetByte("YahooJapan",0)?"login.yahoo.co.jp":"login.yahoo.com" , sizeof(login_host)); - port = GetWord(NULL, YAHOO_LOGINPORT, YAHOO_DEFAULT_PORT); + lstrcpynA(fthost,getByte("YahooJapan",0)?"filetransfer.msg.yahoo.co.jp":"filetransfer.msg.yahoo.com" , sizeof(fthost)); + lstrcpynA(login_host,getByte("YahooJapan",0)?"login.yahoo.co.jp":"login.yahoo.com" , sizeof(login_host)); + port = getWord(NULL, YAHOO_LOGINPORT, YAHOO_DEFAULT_PORT); #ifdef HTTP_GATEWAY nlus.cbSize = sizeof( nlus ); @@ -1575,7 +1575,7 @@ void CYahooProto::ext_login(enum yahoo_status login_mode) "pager_host", host, "pager_port", port, "filetransfer_host", fthost, - "picture_checksum", GetDword("AvatarHash", -1), + "picture_checksum", getDword("AvatarHash", -1), #ifdef HTTP_GATEWAY "web_messenger", iHTTPGateway, #endif -- cgit v1.2.3