From 8788bb35e10ef5403a08388d33ed4ab2ff7d67df Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 23 Jun 2013 12:32:12 +0000 Subject: new helper applied instead of MS_DB_SETSETTINGRESIDENT git-svn-id: http://svn.miranda-ng.org/main/trunk@5094 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_database.inc | 7 ------- include/m_database.h | 7 ------- plugins/MetaContacts/src/meta_main.cpp | 10 +++++----- plugins/MirOTR/MirOTR/src/dllmain.cpp | 2 +- plugins/NewXstatusNotify/src/main.cpp | 4 ++-- plugins/StopSpamPlus/src/settings.h | 2 +- plugins/UserInfoEx/src/mir_db.cpp | 13 ------------ plugins/UserInfoEx/src/mir_db.h | 1 - protocols/IRCG/src/ircproto.cpp | 4 +--- protocols/IcqOscarJ/src/icq_db.cpp | 10 ---------- protocols/IcqOscarJ/src/icq_proto.cpp | 20 +++++++++---------- protocols/IcqOscarJ/src/icq_proto.h | 1 - protocols/JabberG/src/jabber_proto.cpp | 21 +++++++------------- protocols/JabberG/src/jabber_xstatus.cpp | 13 +++++------- protocols/MRA/src/MraProto.cpp | 28 +++++++++++++------------- protocols/MRA/src/MraProto.h | 2 -- protocols/MRA/src/Mra_functions.cpp | 7 ------- protocols/MSN/src/msn_proto.cpp | 22 ++++++-------------- protocols/Yahoo/src/services.cpp | 32 +++++++++--------------------- src/mir_core/db.cpp | 3 +-- src/modules/database/dbintf.cpp | 6 ------ src/modules/extraicons/ExtraIconGroup.cpp | 4 +--- src/modules/extraicons/IcolibExtraIcon.cpp | 4 +--- 23 files changed, 64 insertions(+), 159 deletions(-) diff --git a/include/delphi/m_database.inc b/include/delphi/m_database.inc index eda633e728..4876451e3a 100644 --- a/include/delphi/m_database.inc +++ b/include/delphi/m_database.inc @@ -669,11 +669,4 @@ const } ME_DB_CONTACT_SETTINGCHANGED:PAnsiChar = 'DB/Contact/SettingChanged'; - { DB/Contact/SetSettingResident service (0.6+) - Disables a setting saving to the database. - wParam=(WPARAM)(BOOL)bIsResident - lParam=(LPARAM)(AnsiChar*)pszSettingName - } - MS_DB_SETSETTINGRESIDENT:PAnsiChar = 'DB/SetSettingResident'; - {$ENDIF} diff --git a/include/m_database.h b/include/m_database.h index 12a1c92ad3..a050bb2fb2 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -819,13 +819,6 @@ don't change any of the members. */ #define ME_DB_CONTACT_SETTINGCHANGED "DB/Contact/SettingChanged" -/* DB/Contact/SetSettingResident service (0.6+) -Disables a setting saving to the database. - wParam = (WPARAM)(BOOL)bIsResident - lParam = (LPARAM)(char*)pszSettingName -*/ -#define MS_DB_SETSETTINGRESIDENT "DB/SetSettingResident" - /******************************************************************/ /********************* SETTINGS HELPER FUNCTIONS ******************/ /******************************************************************/ diff --git a/plugins/MetaContacts/src/meta_main.cpp b/plugins/MetaContacts/src/meta_main.cpp index 023bca8a82..b712144bae 100644 --- a/plugins/MetaContacts/src/meta_main.cpp +++ b/plugins/MetaContacts/src/meta_main.cpp @@ -144,11 +144,11 @@ extern "C" __declspec(dllexport) int Load(void) mir_getLP(&pluginInfo); mir_getCLI(); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/Status")); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/IdleTS")); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/ContactCountCheck")); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/Handle")); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/WindowOpen")); + db_set_resident(META_PROTO, "Status"); + db_set_resident(META_PROTO, "IdleTS"); + db_set_resident(META_PROTO, "ContactCountCheck"); + db_set_resident(META_PROTO, "Handle"); + db_set_resident(META_PROTO, "WindowOpen"); //set all contacts to 'offline', and initialize subcontact counter for db consistency check for (HANDLE hContact = db_find_first(META_PROTO); hContact; hContact = db_find_next(hContact, META_PROTO)) { diff --git a/plugins/MirOTR/MirOTR/src/dllmain.cpp b/plugins/MirOTR/MirOTR/src/dllmain.cpp index c17b1b6b76..e38f2ff076 100644 --- a/plugins/MirOTR/MirOTR/src/dllmain.cpp +++ b/plugins/MirOTR/MirOTR/src/dllmain.cpp @@ -77,7 +77,7 @@ extern "C" __declspec(dllexport) int Load(void) icce.dwICC = ICC_LISTVIEW_CLASSES|ICC_PROGRESS_CLASS; InitCommonControlsEx(&icce); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(MODULENAME "/TrustLevel")); + db_set_resident(MODULENAME, "TrustLevel"); ///////////// ////// init plugin diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index bff802174e..2c59b6c9c2 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -1179,8 +1179,8 @@ extern "C" int __declspec(dllexport) Load(void) InitIcolib(); InitSound(); - CallService(MS_DB_SETSETTINGRESIDENT, (WPARAM)TRUE, (LPARAM)"MetaContacts/LastOnline"); - CallService(MS_DB_SETSETTINGRESIDENT, (WPARAM)TRUE, (LPARAM)"NewStatusNotify/LastPopupText"); + db_set_resident("MetaContacts", "LastOnline"); + db_set_resident("NewStatusNotify", "LastPopupText"); return 0; } diff --git a/plugins/StopSpamPlus/src/settings.h b/plugins/StopSpamPlus/src/settings.h index 9544fcadd4..404be7d75d 100644 --- a/plugins/StopSpamPlus/src/settings.h +++ b/plugins/StopSpamPlus/src/settings.h @@ -40,7 +40,7 @@ public: } operator T(){return m_value;} void SetResident(BOOL bResident){ - CallService(MS_DB_SETSETTINGRESIDENT, bResident, (LPARAM)(pluginName m_name.c_str())); + db_set_resident( bResident, (LPARAM)(pluginName m_name.c_str())); } }; diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index c41df9076b..4dd9298a0b 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -809,19 +809,6 @@ void DeleteArray(HANDLE hContact, LPCSTR pszModule, LPCSTR pszFormat, int iStart while (!DB::Setting::Delete(hContact, pszModule, pszSetting)); } -/** - * This function can prevent a setting from being stored to database permanently. - * @param pszSetting - the setting to read - * @param enabled - if set to 'true' the setting will not be stored in database - * - * @retval 0 - success - * @retval 1 - failure - **/ -BYTE Resident(LPCSTR pszSetting, const bool enabled) -{ - return CallService(MS_DB_SETSETTINGRESIDENT, (WPARAM) enabled, (LPARAM) pszSetting) != 0; -} - } /* namespace Setting */ namespace Variant { diff --git a/plugins/UserInfoEx/src/mir_db.h b/plugins/UserInfoEx/src/mir_db.h index 5bc5504374..0eaa774687 100644 --- a/plugins/UserInfoEx/src/mir_db.h +++ b/plugins/UserInfoEx/src/mir_db.h @@ -171,7 +171,6 @@ namespace Setting { BYTE Exists (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting); BYTE Delete (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting); void DeleteArray (HANDLE hContact, LPCSTR pszModule, LPCSTR pszFormat, int iStart); - BYTE Resident (LPCSTR pszSetting, const bool enabled); } /* namespace Setting */ diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 8c9981234e..de23f16b83 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -73,9 +73,7 @@ CIrcProto::CIrcProto(const char* szModuleName, const TCHAR* tszUserName) : InitPrefs(); - char text[ MAX_PATH ]; - mir_snprintf( text, sizeof( text ), "%s/Status", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)text); + db_set_resident(m_szModuleName, "Status"); CList_SetAllOffline(true); diff --git a/protocols/IcqOscarJ/src/icq_db.cpp b/protocols/IcqOscarJ/src/icq_db.cpp index ed45b307db..65899ae703 100644 --- a/protocols/IcqOscarJ/src/icq_db.cpp +++ b/protocols/IcqOscarJ/src/icq_db.cpp @@ -29,16 +29,6 @@ // ----------------------------------------------------------------------------- #include "icqoscar.h" -void CIcqProto::CreateResidentSetting(const char *szSetting) -{ - char pszSetting[2*MAX_PATH]; - - strcpy(pszSetting, m_szModuleName); - strcat(pszSetting, "/"); - strcat(pszSetting, szSetting); - CallService(MS_DB_SETSETTINGRESIDENT, 1, (WPARAM)pszSetting); -} - int CIcqProto::getSetting(HANDLE hContact, const char *szSetting, DBVARIANT *dbv) { return db_get_s(hContact, m_szModuleName, szSetting, dbv, 0); diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index 9d388548ba..95ba89e838 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -111,16 +111,16 @@ CIcqProto::CIcqProto( const char* aProtoName, const TCHAR* aUserName ) : m_avatarsMutex = new icq_critical_section(); // Initialize temporary DB settings - CreateResidentSetting("Status"); // NOTE: XStatus cannot be temporary - CreateResidentSetting("TemporaryVisible"); - CreateResidentSetting("TickTS"); - CreateResidentSetting("IdleTS"); - CreateResidentSetting("AwayTS"); - CreateResidentSetting("LogonTS"); - CreateResidentSetting("DCStatus"); - CreateResidentSetting("CapBuf"); //capabilities bufer - CreateResidentSetting(DBSETTING_STATUS_NOTE_TIME); - CreateResidentSetting(DBSETTING_STATUS_MOOD); + db_set_resident(m_szModuleName, "Status"); // NOTE: XStatus cannot be temporary + db_set_resident(m_szModuleName, "TemporaryVisible"); + db_set_resident(m_szModuleName, "TickTS"); + db_set_resident(m_szModuleName, "IdleTS"); + db_set_resident(m_szModuleName, "AwayTS"); + db_set_resident(m_szModuleName, "LogonTS"); + db_set_resident(m_szModuleName, "DCStatus"); + db_set_resident(m_szModuleName, "CapBuf"); //capabilities bufer + db_set_resident(m_szModuleName, DBSETTING_STATUS_NOTE_TIME); + db_set_resident(m_szModuleName, DBSETTING_STATUS_MOOD); // Setup services CreateProtoService(PS_CREATEACCMGRUI, &CIcqProto::OnCreateAccMgrUI ); diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h index a7f7ce8994..024a2eb1ab 100644 --- a/protocols/IcqOscarJ/src/icq_proto.h +++ b/protocols/IcqOscarJ/src/icq_proto.h @@ -430,7 +430,6 @@ struct CIcqProto : public PROTO_INTERFACE //----| icq_db.cpp |------------------------------------------------------------------ HANDLE AddEvent(HANDLE hContact, WORD wType, DWORD dwTime, DWORD flags, DWORD cbBlob, PBYTE pBlob); - void CreateResidentSetting(const char* szSetting); HANDLE FindFirstContact(); HANDLE FindNextContact(HANDLE hContact); int IsICQContact(HANDLE hContact); diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 4de089e843..e03cf896ae 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -171,20 +171,13 @@ CJabberProto::CJabberProto(const char* aProtoName, const TCHAR *aUserName) : *m_savedPassword = 0; - char text[ MAX_PATH ]; - mir_snprintf(text, sizeof(text), "%s/Status", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)text); - mir_snprintf(text, sizeof(text), "%s/%s", m_szModuleName, DBSETTING_DISPLAY_UID); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)text); - - mir_snprintf(text, sizeof(text), "%s/SubscriptionText", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)text); - mir_snprintf(text, sizeof(text), "%s/Subscription", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)text); - mir_snprintf(text, sizeof(text), "%s/Auth", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)text); - mir_snprintf(text, sizeof(text), "%s/Grant", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)text); + db_set_resident(m_szModuleName, "Status"); + db_set_resident(m_szModuleName, DBSETTING_DISPLAY_UID); + + db_set_resident(m_szModuleName, "SubscriptionText"); + db_set_resident(m_szModuleName, "Subscription"); + db_set_resident(m_szModuleName, "Auth"); + db_set_resident(m_szModuleName, "Grant"); DBVARIANT dbv; if ( !JGetStringT(NULL, "XmlLang", &dbv)) { diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 0a97bba749..6cbedb9267 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -1458,14 +1458,11 @@ INT_PTR __cdecl CJabberProto::OnSetXStatusEx(WPARAM wParam, LPARAM lParam) void CJabberProto::RegisterAdvStatusSlot(const char *pszSlot) { char szSetting[256]; - mir_snprintf(szSetting, SIZEOF(szSetting), "AdvStatus/%s/%s/id", m_szModuleName, pszSlot); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)szSetting); - mir_snprintf(szSetting, SIZEOF(szSetting), "AdvStatus/%s/%s/icon", m_szModuleName, pszSlot); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)szSetting); - mir_snprintf(szSetting, SIZEOF(szSetting), "AdvStatus/%s/%s/title", m_szModuleName, pszSlot); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)szSetting); - mir_snprintf(szSetting, SIZEOF(szSetting), "AdvStatus/%s/%s/text", m_szModuleName, pszSlot); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)szSetting); + mir_snprintf(szSetting, SIZEOF(szSetting), "AdvStatus/%s/%s", m_szModuleName, pszSlot); + db_set_resident(szSetting, "id"); + db_set_resident(szSetting, "icon"); + db_set_resident(szSetting, "title"); + db_set_resident(szSetting, "text"); } void CJabberProto::ResetAdvStatus(HANDLE hContact, const char *pszSlot) diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 51ce197008..5aa836733f 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -106,20 +106,20 @@ int CMraProto::OnModulesLoaded(WPARAM, LPARAM) SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID|SCBIF_GROUP_ID|SCBIF_SERVER_FLAG|SCBIF_STATUS), -1, -1, 0, 0, ID_STATUS_OFFLINE, NULL, 0, NULL, 0, NULL, 0); // unsaved values - DB_MraCreateResidentSetting("Status");// NOTE: XStatus cannot be temporary - DB_MraCreateResidentSetting("LogonTS"); - DB_MraCreateResidentSetting("ContactID"); - DB_MraCreateResidentSetting("GroupID"); - DB_MraCreateResidentSetting("ContactFlags"); - DB_MraCreateResidentSetting("ContactSeverFlags"); - DB_MraCreateResidentSetting("HooksLocked"); - DB_MraCreateResidentSetting(DBSETTING_CAPABILITIES); - DB_MraCreateResidentSetting(DBSETTING_XSTATUSNAME); - DB_MraCreateResidentSetting(DBSETTING_XSTATUSMSG); - DB_MraCreateResidentSetting(DBSETTING_BLOGSTATUSTIME); - DB_MraCreateResidentSetting(DBSETTING_BLOGSTATUSID); - DB_MraCreateResidentSetting(DBSETTING_BLOGSTATUS); - DB_MraCreateResidentSetting(DBSETTING_BLOGSTATUSMUSIC); + db_set_resident(m_szModuleName, "Status");// NOTE: XStatus cannot be temporary + db_set_resident(m_szModuleName, "LogonTS"); + db_set_resident(m_szModuleName, "ContactID"); + db_set_resident(m_szModuleName, "GroupID"); + db_set_resident(m_szModuleName, "ContactFlags"); + db_set_resident(m_szModuleName, "ContactSeverFlags"); + db_set_resident(m_szModuleName, "HooksLocked"); + db_set_resident(m_szModuleName, DBSETTING_CAPABILITIES); + db_set_resident(m_szModuleName, DBSETTING_XSTATUSNAME); + db_set_resident(m_szModuleName, DBSETTING_XSTATUSMSG); + db_set_resident(m_szModuleName, DBSETTING_BLOGSTATUSTIME); + db_set_resident(m_szModuleName, DBSETTING_BLOGSTATUSID); + db_set_resident(m_szModuleName, DBSETTING_BLOGSTATUS); + db_set_resident(m_szModuleName, DBSETTING_BLOGSTATUSMUSIC); // destroy all chat sessions if (bChatExists) diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index f1205fbbd4..2ba636de92 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -255,8 +255,6 @@ struct CMraProto : public PROTO_INTERFACE void MraAddrListStoreToContact(HANDLE hContact, MRA_ADDR_LIST *pmalAddrList); - void DB_MraCreateResidentSetting(LPSTR lpszValueName); - DWORD GetContactFlags(HANDLE hContact); DWORD SetContactFlags(HANDLE hContact, DWORD dwContactFlag); DWORD GetContactBasicInfoW(HANDLE hContact, DWORD *pdwID, DWORD *pdwGroupID, DWORD *pdwContactFlag, DWORD *pdwContactSeverFlags, DWORD *pdwStatus, LPSTR lpszEMail, size_t dwEMailSize, size_t *pdwEMailSize, LPWSTR lpwszNick, size_t dwNickSize, size_t *pdwNickSize, LPSTR lpszPhones, size_t dwPhonesSize, size_t *pdwPhonesSize); diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 4ecd258377..d4a5f657ac 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -202,13 +202,6 @@ void MraAddrListFree(MRA_ADDR_LIST *pmalAddrList) } } -void CMraProto::DB_MraCreateResidentSetting(LPSTR lpszValueName) -{ - char szSetting[2*MAX_PATH]; - mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s", m_szModuleName, lpszValueName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (WPARAM)szSetting); -} - BOOL DB_GetStaticStringA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPSTR lpszRetBuff, size_t dwRetBuffSize, size_t *pdwRetBuffSize) { BOOL bRet = FALSE; diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index e37531d34c..3834980ec7 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -43,24 +43,13 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) : lsAvatarQueue(1), msgCache(5, CompareId) { - char path[MAX_PATH]; - ProtoConstructor(this, aProtoName, aUserName); - mir_snprintf(path, sizeof(path), "%s/Status", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); - - mir_snprintf(path, sizeof(path), "%s/IdleTS", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); - - mir_snprintf(path, sizeof(path), "%s/p2pMsgId", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); - - mir_snprintf(path, sizeof(path), "%s/MobileEnabled", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); - - mir_snprintf(path, sizeof(path), "%s/MobileAllowed", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); + db_set_resident(m_szModuleName, "Status"); + db_set_resident(m_szModuleName, "IdleTS"); + db_set_resident(m_szModuleName, "p2pMsgId"); + db_set_resident(m_szModuleName, "MobileEnabled"); + db_set_resident(m_szModuleName, "MobileAllowed"); // Protocol services and events... hMSNNudge = CreateProtoEvent("/Nudge"); @@ -101,6 +90,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) : deleteSetting(NULL, "MobileEnabled"); deleteSetting(NULL, "MobileAllowed"); + char path[MAX_PATH]; if (getStaticString(NULL, "LoginServer", path, sizeof(path)) == 0 && (strcmp(path, MSN_DEFAULT_LOGIN_SERVER) == 0 || strcmp(path, MSN_DEFAULT_GATEWAY) == 0)) diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index 64756331db..af4f300282 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -536,27 +536,13 @@ void CYahooProto::LoadYahooServices( void ) //----| Set resident variables |------------------------------------------------------ - mir_snprintf(path, SIZEOF(path), "%s/Status", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); - - mir_snprintf(path, SIZEOF(path), "%s/YStatus", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); - - mir_snprintf(path, SIZEOF(path), "%s/YAway", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); - - mir_snprintf(path, SIZEOF(path), "%s/Mobile", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); - - mir_snprintf(path, SIZEOF(path), "%s/YGMsg", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); - - mir_snprintf(path, SIZEOF(path), "%s/IdleTS", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); - - mir_snprintf(path, SIZEOF(path), "%s/PictLastCheck", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); - - mir_snprintf(path, SIZEOF(path), "%s/PictLoading", m_szModuleName); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); + db_set_resident(m_szModuleName, "Mobile"); + db_set_resident(m_szModuleName, "IdleTS"); + db_set_resident(m_szModuleName, "PictLastCheck"); + db_set_resident(m_szModuleName, "PictLoading"); + db_set_resident(m_szModuleName, "Status"); + + db_set_resident(m_szModuleName, "YAway"); + db_set_resident(m_szModuleName, "YGMsg"); + db_set_resident(m_szModuleName, "YStatus"); } diff --git a/src/mir_core/db.cpp b/src/mir_core/db.cpp index 7b04b6eab4..08703f6581 100644 --- a/src/mir_core/db.cpp +++ b/src/mir_core/db.cpp @@ -318,7 +318,6 @@ MIR_CORE_DLL(BOOL) db_set_resident(const char *szModule, const char *szService, return FALSE; char str[MAXMODULELABELLENGTH * 2]; - strncpy_s(str,szModule,strlen(szModule)); - strncat_s(str,szService,strlen(szService)); + mir_snprintf(str, SIZEOF(str), "%s/%s", szModule, szService); return currDb->SetSettingResident(bEnable, str); } diff --git a/src/modules/database/dbintf.cpp b/src/modules/database/dbintf.cpp index e95caff6c4..c1c69cece8 100644 --- a/src/modules/database/dbintf.cpp +++ b/src/modules/database/dbintf.cpp @@ -179,11 +179,6 @@ static INT_PTR srvEnumContactSettings(WPARAM wParam,LPARAM lParam) return (currDb) ? (INT_PTR)currDb->EnumContactSettings((HANDLE)wParam, (DBCONTACTENUMSETTINGS*)lParam) : 0; } -static INT_PTR srvSetSettingResident(WPARAM wParam,LPARAM lParam) -{ - return (currDb) ? (INT_PTR)currDb->SetSettingResident(wParam, (char*)lParam) : 0; -} - static INT_PTR srvEnumResidentSettings(WPARAM wParam,LPARAM lParam) { return (currDb) ? (INT_PTR)currDb->EnumResidentSettings((DBMODULEENUMPROC)wParam, (void*)lParam) : 0; @@ -274,7 +269,6 @@ int LoadDbintfModule() CreateServiceFunction(MS_DB_CONTACT_WRITESETTING, srvWriteContactSetting); CreateServiceFunction(MS_DB_CONTACT_DELETESETTING, srvDeleteContactSetting); CreateServiceFunction(MS_DB_CONTACT_ENUMSETTINGS, srvEnumContactSettings); - CreateServiceFunction(MS_DB_SETSETTINGRESIDENT, srvSetSettingResident); CreateServiceFunction("DB/ResidentSettings/Enum", srvEnumResidentSettings); CreateServiceFunction(MS_DB_REGISTER_PLUGIN, srvRegisterPlugin); diff --git a/src/modules/extraicons/ExtraIconGroup.cpp b/src/modules/extraicons/ExtraIconGroup.cpp index 5da0f4f9b3..696728e4e2 100644 --- a/src/modules/extraicons/ExtraIconGroup.cpp +++ b/src/modules/extraicons/ExtraIconGroup.cpp @@ -26,9 +26,7 @@ Boston, MA 02111-1307, USA. ExtraIconGroup::ExtraIconGroup(const char *_name) : ExtraIcon(_name), setValidExtraIcon(false), insideApply(false) { - char setting[512]; - mir_snprintf(setting, SIZEOF(setting), "%s/%s", MODULE_NAME, _name); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (WPARAM) setting); + db_set_resident(MODULE_NAME, _name); } ExtraIconGroup::~ExtraIconGroup() diff --git a/src/modules/extraicons/IcolibExtraIcon.cpp b/src/modules/extraicons/IcolibExtraIcon.cpp index dc20e94572..0b67630d17 100644 --- a/src/modules/extraicons/IcolibExtraIcon.cpp +++ b/src/modules/extraicons/IcolibExtraIcon.cpp @@ -30,9 +30,7 @@ IcolibExtraIcon::IcolibExtraIcon(int _id, const char *_name, const TCHAR *_descr MIRANDAHOOKPARAM _OnClick, LPARAM _param) : BaseExtraIcon(_id, _name, _description, _descIcon, _OnClick, _param) { - char setting[512]; - mir_snprintf(setting, SIZEOF(setting), "%s/%s", MODULE_NAME, _name); - CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (WPARAM) setting); + db_set_resident(MODULE_NAME, _name); } IcolibExtraIcon::~IcolibExtraIcon() -- cgit v1.2.3