diff options
Diffstat (limited to 'plugins')
91 files changed, 190 insertions, 430 deletions
diff --git a/plugins/Actman/iac_dbrw.pas b/plugins/Actman/iac_dbrw.pas index 416827c598..f03e5048a7 100644 --- a/plugins/Actman/iac_dbrw.pas +++ b/plugins/Actman/iac_dbrw.pas @@ -213,7 +213,7 @@ begin if (asbuf[0]='*') or (asbuf[StrLen(asbuf)-1]='*') then
DBDeleteGroup(hContact,ambuf,asbuf)
else if asbuf[0]=#0 then
- DbModule_Delete(hContact,ambuf)
+ db_delete_module(hContact,ambuf)
else
db_unset(hContact,ambuf,asbuf);
end
diff --git a/plugins/Actman/iac_inout.pas b/plugins/Actman/iac_inout.pas index 0626de08f2..e83e62ad8f 100644 --- a/plugins/Actman/iac_inout.pas +++ b/plugins/Actman/iac_inout.pas @@ -129,7 +129,7 @@ begin begin
if (flags and ACF_FILE_PATH)<>0 then
begin
- if CallService(MS_DB_CONTACT_IS,WorkData.Parameter,0)<>0 then
+ if db_is_contact(WorkData.Parameter)<>0 then
hContact:=WorkData.Parameter
else
hContact:=0;
@@ -263,7 +263,7 @@ begin if hContact=0 then
begin
- if CallService(MS_DB_CONTACT_IS,WorkData.Parameter,0)<>0 then
+ if db_is_contact(WorkData.Parameter)<>0 then
hContact:=WorkData.Parameter;
end;
diff --git a/plugins/Actman/iac_program.pas b/plugins/Actman/iac_program.pas index d16c356019..b62e774da2 100644 --- a/plugins/Actman/iac_program.pas +++ b/plugins/Actman/iac_program.pas @@ -136,7 +136,7 @@ begin if ((flags and ACF_PRG_PRG)<>0) or
((flags and ACF_PRG_ARG)<>0) then
begin
- if CallService(MS_DB_CONTACT_IS,WorkData.Parameter,0)<>0 then
+ if db_is_contact(WorkData.Parameter)<>0 then
pd:=WorkData.Parameter
else
pd:=WndToContact(WaitFocusedWndChild(GetForegroundwindow){GetFocus});
diff --git a/plugins/AssocMgr/src/test.cpp b/plugins/AssocMgr/src/test.cpp index 2722545302..1175e20807 100644 --- a/plugins/AssocMgr/src/test.cpp +++ b/plugins/AssocMgr/src/test.cpp @@ -759,7 +759,7 @@ static int ServiceParseXmppURI(WPARAM wParam, LPARAM lParam) MCONTACT hContact;
hContact = JabberHContactFromJID(jid);
if (hContact == NULL) /* not yet implemented: show standard miranda dialog here */
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
return 0;
}
/* add user subscription */
diff --git a/plugins/AssocMgr/src/utils.cpp b/plugins/AssocMgr/src/utils.cpp index 6028343440..6f2a90b8d1 100644 --- a/plugins/AssocMgr/src/utils.cpp +++ b/plugins/AssocMgr/src/utils.cpp @@ -110,16 +110,12 @@ static int EnumPrefixSettingsProc(const char *pszSetting,LPARAM lParam) // mir_free() the returned pSettings after use
BOOL EnumDbPrefixSettings(const char *pszModule,const char *pszSettingPrefix,char ***pSettings,int *pnSettingsCount)
{
- DBCONTACTENUMSETTINGS dbces;
struct EnumPrefixSettingsParams param;
- dbces.szModule = pszModule;
- dbces.pfnEnumProc = EnumPrefixSettingsProc;
- dbces.lParam = (LPARAM)¶m;
param.settings = NULL;
param.nSettingsCount = 0;
param.pszPrefix = pszSettingPrefix;
param.nPrefixLen = (int)mir_strlen(pszSettingPrefix);
- CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
+ db_enum_settings(NULL, EnumPrefixSettingsProc, pszModule, ¶m);
*pnSettingsCount = param.nSettingsCount;
*pSettings = param.settings;
return param.nSettingsCount != 0;
diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index a2a73665e4..457b5e57dc 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -504,7 +504,7 @@ void HistoryEventList::MargeMessages(const std::vector<IImport::ExternalMessage> DBEVENTINFO dbei = { sizeof(dbei) };
dbei.szModule = GetContactProto(m_hContact);
- CallService(MS_DB_SETSAFETYMODE, FALSE, 0);
+ db_set_safety_mode(FALSE);
for (std::list<EventTempIndex>::iterator it = tempList.begin(); it != tempList.end(); ++it) {
if (it->isExternal) {
IImport::ExternalMessage& msg = m_importedMessages[it->exIdx];
@@ -522,7 +522,7 @@ void HistoryEventList::MargeMessages(const std::vector<IImport::ExternalMessage> }
}
- CallService(MS_DB_SETSAFETYMODE, TRUE, 0);
+ db_set_safety_mode(TRUE);
std::vector<IImport::ExternalMessage> emessages;
ImportMessages(emessages);
}
diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index 6d5017ce14..8f8c856e9f 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -392,13 +392,13 @@ INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM hContact, LPARAM) if (MessageBox(hWnd, message, TranslateT("Are You sure?"), MB_OKCANCEL | MB_ICONERROR) != IDOK)
return FALSE;
- CallService(MS_DB_SETSAFETYMODE, FALSE, 0);
+ db_set_safety_mode(FALSE);
MEVENT hDbEvent = db_event_last(hContact);
while (hDbEvent != NULL) {
MEVENT hPrevEvent = db_event_prev(hContact, hDbEvent);
hDbEvent = (db_event_delete(hContact, hDbEvent) == 0) ? hPrevEvent : NULL;
}
- CallService(MS_DB_SETSAFETYMODE, TRUE, 0);
+ db_set_safety_mode(TRUE);
if (HistoryEventList::IsImportedHistory(hContact)) {
message = TranslateT("Do you want to delete all imported messages for this contact?\nNote that next scheduler task import this messages again.");
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index de682600e7..93d215e2ff 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -384,7 +384,7 @@ INT_PTR ContactStillAbsentAction(WPARAM hContact, LPARAM lParam) switch (options.action2) {
case GCA_DELETE:
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
break;
case GCA_UDETAILS:
CallService(MS_USERINFO_SHOWDIALOG, hContact, 0);
diff --git a/plugins/ClientChangeNotify/src/Options.cpp b/plugins/ClientChangeNotify/src/Options.cpp index 0a81d2f701..d5647554f3 100644 --- a/plugins/ClientChangeNotify/src/Options.cpp +++ b/plugins/ClientChangeNotify/src/Options.cpp @@ -300,12 +300,7 @@ void COptItem_TreeCtrl::DBToMem(const CString &sModule, CString *sDBSettingPrefi m_value.RemoveAll();
sTreeReadEnumData pData(this, sModule, *sDBSettingPrefix);
- DBCONTACTENUMSETTINGS dbEnum;
- dbEnum.lParam = (LPARAM)&pData;
- dbEnum.ofsSettings = 0;
- dbEnum.pfnEnumProc = TreeReadEnum;
- dbEnum.szModule = sModule;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM)&dbEnum);
+ db_enum_settings(NULL, TreeReadEnum, sModule, &pData);
if (!m_value.GetSize()) {
m_value = m_defValue;
}
@@ -481,12 +476,7 @@ void COptItem_TreeCtrl::CleanDBSettings(const CString &sModule, CString *sDBSett sTreeDeleteEnumData TreeDeleteEnumData;
TreeDeleteEnumData.TreeCtrl = this;
TreeDeleteEnumData.sDBSettingPrefix = sDBSettingPrefix;
- DBCONTACTENUMSETTINGS dbEnum;
- dbEnum.lParam = (LPARAM)&TreeDeleteEnumData;
- dbEnum.ofsSettings = 0;
- dbEnum.pfnEnumProc = TreeDeleteEnum;
- dbEnum.szModule = sModule;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM)&dbEnum);
+ db_enum_settings(NULL, TreeDeleteEnum, sModule, &TreeDeleteEnumData);
for (int i = 0; i < TreeDeleteEnumData.TreeSettings.GetSize(); i++)
db_unset(NULL, sModule, TreeDeleteEnumData.TreeSettings[i]);
@@ -672,12 +662,8 @@ void COptItem_ListCtrl::DBToMem(const CString &sModule, CString *sDBSettingPrefi m_value.RemoveAll();
sListReadEnumData pData(this, sModule, *sDBSettingPrefix);
- DBCONTACTENUMSETTINGS dbEnum;
- dbEnum.lParam = (LPARAM)&pData;
- dbEnum.ofsSettings = 0;
- dbEnum.pfnEnumProc = ListReadEnum;
- dbEnum.szModule = sModule;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM)&dbEnum);
+ db_enum_settings(NULL, ListReadEnum, sModule, &pData);
+
if (!m_value.GetSize())
m_value = m_defValue;
else {
@@ -752,12 +738,7 @@ void COptItem_ListCtrl::CleanDBSettings(const CString &sModule, CString *sDBSett sListDeleteEnumData ListDeleteEnumData;
ListDeleteEnumData.ListCtrl = this;
ListDeleteEnumData.sDBSettingPrefix = sDBSettingPrefix;
- DBCONTACTENUMSETTINGS dbEnum;
- dbEnum.lParam = (LPARAM)&ListDeleteEnumData;
- dbEnum.ofsSettings = 0;
- dbEnum.pfnEnumProc = ListDeleteEnum;
- dbEnum.szModule = sModule;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM)&dbEnum);
+ db_enum_settings(NULL, ListDeleteEnum, sModule, &ListDeleteEnumData);
for (int i = 0; i < ListDeleteEnumData.ListSettings.GetSize(); i++)
db_unset(NULL, sModule, ListDeleteEnumData.ListSettings[i]);
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 683f0bd7d4..6d5f29ad3f 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1345,7 +1345,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wParam ClcGroup *group = NULL;
ClcContact *contact = NULL;
if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, &group, NULL)) {
- if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) {
+ if (shouldShow && db_is_contact(wParam)) {
if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
hSelItem = Clist_ContactToHItem(selcontact);
pcli->pfnAddContactToTree(hwnd, dat, wParam, (style & CLS_CONTACTLIST) == 0, 0);
diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index 5131e493ca..efe7ff5ba1 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -1923,12 +1923,8 @@ static int ske_GetSkinFromDB(char *, SKINOBJECTSLIST *Skin) } // Load objects - DBCONTACTENUMSETTINGS dbces; pCurrentSkin = Skin; - dbces.pfnEnumProc = ske_enumdb_SkinObjectsProc; - dbces.szModule = SKIN; - dbces.ofsSettings = 0; - CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces); + db_enum_settings(NULL, ske_enumdb_SkinObjectsProc, SKIN); SortMaskList(pCurrentSkin->pMaskList); ske_LinkSkinObjects(pCurrentSkin); @@ -1948,7 +1944,7 @@ static int ske_LoadSkinFromResource(BOOL bOnlyObjects) { IniParser parser(g_hInst, MAKEINTRESOURCEA(IDR_MSF_DEFAULT_SKIN), "MSF", bOnlyObjects ? IniParser::FLAG_ONLY_OBJECTS : IniParser::FLAG_WITH_SETTINGS); if (parser.CheckOK()) { - DbModule_Delete(0, "ModernSkin"); + db_delete_module(0, "ModernSkin"); db_set_s(NULL, SKIN, "SkinFolder", "%Default%"); db_set_s(NULL, SKIN, "SkinFile", "%Default%"); parser.Parse(IniParser::WriteStrToDb, 0); @@ -1966,7 +1962,7 @@ int ske_LoadSkinFromIniFile(wchar_t *szFileName, BOOL bOnlyObjects) if (!parser.CheckOK()) return 0; - DbModule_Delete(0, "ModernSkin"); + db_delete_module(0, "ModernSkin"); wchar_t skinFolder[MAX_PATH], skinFile[MAX_PATH]; IniParser::GetSkinFolder(szFileName, skinFolder); diff --git a/plugins/Clist_modern/src/modern_toolbar.cpp b/plugins/Clist_modern/src/modern_toolbar.cpp index efced1370b..c4f96d36b8 100644 --- a/plugins/Clist_modern/src/modern_toolbar.cpp +++ b/plugins/Clist_modern/src/modern_toolbar.cpp @@ -338,7 +338,7 @@ static int Toolbar_ModulesLoaded(WPARAM, LPARAM) db_unset(NULL, "CLUI", "ShowButtonBar");
- DbModule_Delete(0, "ModernToolBar");
+ db_delete_module(0, "ModernToolBar");
}
db_set_b(NULL, "Compatibility", "TTB_Upgrade", 1);
}
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index 0858bcbe5f..c298d85e96 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -101,12 +101,7 @@ int CLVM_EnumProc(const char *szSetting, LPARAM lParam) void CLVM_EnumModes(pfnEnumCallback EnumCallback)
{
- DBCONTACTENUMSETTINGS dbces;
- dbces.pfnEnumProc = CLVM_EnumProc;
- dbces.szModule = CLVM_MODULE;
- dbces.ofsSettings = 0;
- dbces.lParam = (LPARAM)EnumCallback;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
+ db_enum_settings(NULL, CLVM_EnumProc, CLVM_MODULE, EnumCallback);
}
int FillModes(char *szsetting)
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 189717d6c6..c3adacca29 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -323,7 +323,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L pcli->pfnGetContactIcon(hContact) != lParam); // XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown
if (!pcli->pfnFindItem(hwnd, dat, hContact, &contact, &group, NULL)) {
- if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) {
+ if (shouldShow && db_is_contact(wParam)) {
if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
hSelItem = Clist_ContactToHItem(selcontact);
pcli->pfnAddContactToTree(hwnd, dat, hContact, 0, 0);
diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index 9abe3553d9..7a87c93264 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -130,7 +130,7 @@ extern "C" int __declspec(dllexport) CListInitialise() memset(&cfg::dat, 0, sizeof(cfg::dat));
- int iCount = CallService(MS_DB_CONTACT_GETCOUNT, 0, 0);
+ int iCount = db_get_contact_count();
iCount += 20;
if (iCount < 300)
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index 313c8065d2..39da94436f 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -67,12 +67,7 @@ int CLVM_EnumProc(const char *szSetting, LPARAM lParam) void CLVM_EnumModes(pfnEnumCallback EnumCallback)
{
- DBCONTACTENUMSETTINGS dbces;
- dbces.pfnEnumProc = CLVM_EnumProc;
- dbces.szModule = CLVM_MODULE;
- dbces.ofsSettings = 0;
- dbces.lParam = (LPARAM)EnumCallback;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
+ db_enum_settings(NULL, CLVM_EnumProc, CLVM_MODULE, EnumCallback);
}
int FillModes(char *szsetting)
diff --git a/plugins/CyrTranslit/src/MirandaContact.cpp b/plugins/CyrTranslit/src/MirandaContact.cpp index e9f8eda164..7eedca1ce1 100644 --- a/plugins/CyrTranslit/src/MirandaContact.cpp +++ b/plugins/CyrTranslit/src/MirandaContact.cpp @@ -76,7 +76,7 @@ void MirandaContact::addMenuItem() INT_PTR MirandaContact::onMenuCommandTransliterate(WPARAM wParam, LPARAM)
{
MCONTACT hContact = MCONTACT(wParam);
- if (!CallService(MS_DB_CONTACT_IS, wParam, 0))
+ if (!db_is_contact(wParam))
return 0;
save(hContact, !bIsActive(hContact));
@@ -89,7 +89,7 @@ int MirandaContact::onPreBuildContactMenu(WPARAM wParam, LPARAM) {
if (!hTransliterateCmdMenuItem) return 0;
MCONTACT hContact = MCONTACT(wParam);
- if (!CallService(MS_DB_CONTACT_IS, wParam, 0)) return 0;
+ if (!db_is_contact(wParam)) return 0;
Menu_ModifyItem(hTransliterateCmdMenuItem, NULL, INVALID_HANDLE_VALUE, bIsActive(hContact) ? CMIF_CHECKED : 0);
return 0;
diff --git a/plugins/Db3x_mmap/src/dbcontacts.cpp b/plugins/Db3x_mmap/src/dbcontacts.cpp index 710b5324c1..e672a7ce7b 100644 --- a/plugins/Db3x_mmap/src/dbcontacts.cpp +++ b/plugins/Db3x_mmap/src/dbcontacts.cpp @@ -207,7 +207,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::IsDbContact(MCONTACT contactID) BOOL CDb3Mmap::MetaDetouchSub(DBCachedContact *cc, int nSub)
{
- DbModule_Delete(cc->pSubs[nSub], META_PROTO);
+ db_delete_module(cc->pSubs[nSub], META_PROTO);
return 0;
}
diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp index 006821fc9a..755dcbf717 100644 --- a/plugins/Db3x_mmap/src/dbcrypt.cpp +++ b/plugins/Db3x_mmap/src/dbcrypt.cpp @@ -89,12 +89,7 @@ void sttContactEnum(MCONTACT contactID, const char *szModule, CDb3Mmap *db) {
OBJLIST<VarDescr> arSettings(1);
SettingUgraderParam param = { db, szModule, contactID, &arSettings };
-
- DBCONTACTENUMSETTINGS dbces = { 0 };
- dbces.pfnEnumProc = sttSettingUgrader;
- dbces.szModule = szModule;
- dbces.lParam = (LPARAM)¶m;
- db->EnumContactSettings(NULL, &dbces);
+ db->EnumContactSettings(NULL, sttSettingUgrader, szModule, ¶m);
for (int i = 0; i < arSettings.getCount(); i++) {
VarDescr &p = arSettings[i];
diff --git a/plugins/Db3x_mmap/src/dbintf.cpp b/plugins/Db3x_mmap/src/dbintf.cpp index 5a11c25259..e31d023454 100644 --- a/plugins/Db3x_mmap/src/dbintf.cpp +++ b/plugins/Db3x_mmap/src/dbintf.cpp @@ -141,17 +141,15 @@ int CDb3Mmap::Load(bool bSkipInit) if (m_dbHeader.version < DB_095_1_VERSION)
return EGROKPRF_CANTREAD;
- // we don't need events in the service mode
- if (ServiceExists(MS_DB_SETSAFETYMODE)) {
- hContactDeletedEvent = CreateHookableEvent(ME_DB_CONTACT_DELETED);
- hContactAddedEvent = CreateHookableEvent(ME_DB_CONTACT_ADDED);
- hSettingChangeEvent = CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED);
- hEventMarkedRead = CreateHookableEvent(ME_DB_EVENT_MARKED_READ);
-
- hEventAddedEvent = CreateHookableEvent(ME_DB_EVENT_ADDED);
- hEventDeletedEvent = CreateHookableEvent(ME_DB_EVENT_DELETED);
- hEventFilterAddedEvent = CreateHookableEvent(ME_DB_EVENT_FILTER_ADD);
- }
+ // retrieve the event handles
+ hContactDeletedEvent = CreateHookableEvent(ME_DB_CONTACT_DELETED);
+ hContactAddedEvent = CreateHookableEvent(ME_DB_CONTACT_ADDED);
+ hSettingChangeEvent = CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED);
+ hEventMarkedRead = CreateHookableEvent(ME_DB_EVENT_MARKED_READ);
+
+ hEventAddedEvent = CreateHookableEvent(ME_DB_EVENT_ADDED);
+ hEventDeletedEvent = CreateHookableEvent(ME_DB_EVENT_DELETED);
+ hEventFilterAddedEvent = CreateHookableEvent(ME_DB_EVENT_FILTER_ADD);
}
FillContacts();
diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h index dc21944426..6f9a173b39 100644 --- a/plugins/Db3x_mmap/src/dbintf.h +++ b/plugins/Db3x_mmap/src/dbintf.h @@ -232,7 +232,7 @@ public: STDMETHODIMP_(MEVENT) FindNextEvent(MCONTACT contactID, MEVENT hDbEvent);
STDMETHODIMP_(MEVENT) FindPrevEvent(MCONTACT contactID, MEVENT hDbEvent);
- STDMETHODIMP_(BOOL) EnumModuleNames(DBMODULEENUMPROC pFunc, void *pParam);
+ STDMETHODIMP_(BOOL) EnumModuleNames(DBMODULEENUMPROC pFunc, const void *pParam);
STDMETHODIMP_(BOOL) GetContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv);
STDMETHODIMP_(BOOL) GetContactSettingStr(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv);
@@ -240,9 +240,9 @@ public: STDMETHODIMP_(BOOL) FreeVariant(DBVARIANT *dbv);
STDMETHODIMP_(BOOL) WriteContactSetting(MCONTACT contactID, DBCONTACTWRITESETTING *dbcws);
STDMETHODIMP_(BOOL) DeleteContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting);
- STDMETHODIMP_(BOOL) EnumContactSettings(MCONTACT contactID, DBCONTACTENUMSETTINGS *dbces);
+ STDMETHODIMP_(BOOL) EnumContactSettings(MCONTACT hContact, DBSETTINGENUMPROC pfnEnumProc, const char *szModule, const void *param);
STDMETHODIMP_(BOOL) SetSettingResident(BOOL bIsResident, const char *pszSettingName);
- STDMETHODIMP_(BOOL) EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam);
+ STDMETHODIMP_(BOOL) EnumResidentSettings(DBMODULEENUMPROC pFunc, const void *pParam);
STDMETHODIMP_(BOOL) IsSettingEncrypted(LPCSTR szModule, LPCSTR szSetting);
STDMETHODIMP_(BOOL) MetaDetouchSub(DBCachedContact *cc, int nSub);
diff --git a/plugins/Db3x_mmap/src/dbmodulechain.cpp b/plugins/Db3x_mmap/src/dbmodulechain.cpp index 995d681a69..034a7a6a12 100644 --- a/plugins/Db3x_mmap/src/dbmodulechain.cpp +++ b/plugins/Db3x_mmap/src/dbmodulechain.cpp @@ -127,7 +127,7 @@ char* CDb3Mmap::GetModuleNameByOfs(DWORD ofs) return NULL;
}
-STDMETHODIMP_(BOOL) CDb3Mmap::EnumModuleNames(DBMODULEENUMPROC pFunc, void *pParam)
+STDMETHODIMP_(BOOL) CDb3Mmap::EnumModuleNames(DBMODULEENUMPROC pFunc, const void *pParam)
{
for (int i = 0; i < m_lMods.getCount(); i++) {
ModuleName *pmn = m_lMods[i];
diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp index c12a0e0d3e..a99d5b64ef 100644 --- a/plugins/Db3x_mmap/src/dbsettings.cpp +++ b/plugins/Db3x_mmap/src/dbsettings.cpp @@ -811,9 +811,9 @@ STDMETHODIMP_(BOOL) CDb3Mmap::DeleteContactSetting(MCONTACT contactID, LPCSTR sz return 0;
}
-STDMETHODIMP_(BOOL) CDb3Mmap::EnumContactSettings(MCONTACT contactID, DBCONTACTENUMSETTINGS* dbces)
+STDMETHODIMP_(BOOL) CDb3Mmap::EnumContactSettings(MCONTACT contactID, DBSETTINGENUMPROC pfnEnumProc, const char *szModule, const void *param)
{
- if (!dbces->szModule)
+ if (!szModule)
return -1;
mir_cslock lck(m_csDbAccess);
@@ -826,12 +826,12 @@ STDMETHODIMP_(BOOL) CDb3Mmap::EnumContactSettings(MCONTACT contactID, DBCONTACTE if (dbc->signature != DBCONTACT_SIGNATURE)
return -1;
- DWORD ofsModuleName = GetModuleNameOfs(dbces->szModule);
- dbces->ofsSettings = GetSettingsGroupOfsByModuleNameOfs(dbc, ofsModuleName);
- if (!dbces->ofsSettings)
+ DWORD ofsModuleName = GetModuleNameOfs(szModule);
+ DWORD ofsSettings = GetSettingsGroupOfsByModuleNameOfs(dbc, ofsModuleName);
+ if (!ofsSettings)
return -1;
- DWORD ofsBlobPtr = dbces->ofsSettings + offsetof(DBContactSettings, blob);
+ DWORD ofsBlobPtr = ofsSettings + offsetof(DBContactSettings, blob);
int bytesRemaining;
PBYTE pBlob = (PBYTE)DBRead(ofsBlobPtr, &bytesRemaining);
if (pBlob[0] == 0)
@@ -843,7 +843,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::EnumContactSettings(MCONTACT contactID, DBCONTACTE NeedBytes(1 + pBlob[0]);
char szSetting[256];
memcpy(szSetting, pBlob + 1, pBlob[0]); szSetting[pBlob[0]] = 0;
- result = (dbces->pfnEnumProc)(szSetting, dbces->lParam);
+ result = pfnEnumProc(szSetting, LPARAM(param));
MoveAlong(1 + pBlob[0]);
NeedBytes(3);
MoveAlong(1 + GetSettingValueLength(pBlob));
@@ -852,7 +852,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::EnumContactSettings(MCONTACT contactID, DBCONTACTE return result;
}
-STDMETHODIMP_(BOOL) CDb3Mmap::EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam)
+STDMETHODIMP_(BOOL) CDb3Mmap::EnumResidentSettings(DBMODULEENUMPROC pFunc, const void *pParam)
{
for (int i = 0; i < m_lResidentSettings.getCount(); i++) {
int ret = pFunc(m_lResidentSettings[i], 0, (LPARAM)pParam);
diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp index faa42d29ea..ae2430bb68 100644 --- a/plugins/DbEditorPP/src/copymodule.cpp +++ b/plugins/DbEditorPP/src/copymodule.cpp @@ -91,7 +91,7 @@ void copyModuleMenuItem(MCONTACT hContact, const char *module) int CloneContact(MCONTACT hContact)
{
- MCONTACT newContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ MCONTACT newContact = db_add_contact();
if (!newContact)
return 0;
diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index f87b9af57a..6f33002d52 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -330,7 +330,7 @@ void importSettings(MCONTACT hContact, char *utf8) }
if (hContact == INVALID_CONTACT_ID) {
- MCONTACT temp = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ MCONTACT temp = db_add_contact();
if (temp)
hContact = temp;
}
diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp index ba44c3fa20..da31dd2eb1 100644 --- a/plugins/DbEditorPP/src/main_window.cpp +++ b/plugins/DbEditorPP/src/main_window.cpp @@ -134,7 +134,7 @@ LRESULT CALLBACK ModuleTreeSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR if (dlg(str, MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
break;
}
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
freeTree(mtis->hContact);
TreeView_DeleteItem(hwnd, tvi.hItem);
}
diff --git a/plugins/DbEditorPP/src/modsettingenum.cpp b/plugins/DbEditorPP/src/modsettingenum.cpp index dc30d2f473..e1e7de6e33 100644 --- a/plugins/DbEditorPP/src/modsettingenum.cpp +++ b/plugins/DbEditorPP/src/modsettingenum.cpp @@ -51,7 +51,7 @@ int EnumModules(ModuleSettingLL *msll) // 1 = success, 0 = fail {
msll->first = 0;
msll->last = 0;
- if (CallService(MS_DB_MODULES_ENUM, (WPARAM)msll, (WPARAM)enumModulesSettingsProc)) {
+ if (db_enum_modules(enumModulesSettingsProc, msll)) {
msg(TranslateT("Error loading module list"));
return 0;
}
@@ -67,14 +67,10 @@ int enumSettingsProc(const char *setting, LPARAM lParam) int EnumSettings(MCONTACT hContact, const char *module, ModuleSettingLL *msll)
{
- DBCONTACTENUMSETTINGS dbces;
// enum all setting the contact has for the module
- dbces.pfnEnumProc = enumSettingsProc;
- dbces.szModule = module;
- dbces.lParam = (LPARAM)msll;
msll->first = 0;
msll->last = 0;
- if (CallService(MS_DB_CONTACT_ENUMSETTINGS, hContact, (LPARAM)&dbces)) {
+ if (db_enum_settings(hContact, enumSettingsProc, module, msll)) {
msg(TranslateT("Error loading setting list"));
return 0;
}
@@ -90,10 +86,7 @@ int CheckIfModuleIsEmptyProc(const char *, LPARAM) int IsModuleEmpty(MCONTACT hContact, const char *module)
{
- DBCONTACTENUMSETTINGS dbces;
- dbces.pfnEnumProc = CheckIfModuleIsEmptyProc;
- dbces.szModule = module;
- return 0 > CallService(MS_DB_CONTACT_ENUMSETTINGS, hContact, (LPARAM)&dbces);
+ return 0 > db_enum_settings(hContact, CheckIfModuleIsEmptyProc, module);
}
diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp index 2853c4a57c..34c43fb7e8 100644 --- a/plugins/DbEditorPP/src/moduletree.cpp +++ b/plugins/DbEditorPP/src/moduletree.cpp @@ -723,7 +723,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t if (dlg(str, MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
break;
}
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
freeTree(hContact);
TreeView_DeleteItem(hwnd2Tree, tvi.hItem);
break;
diff --git a/plugins/Dbx_mdb/src/dbcontacts.cpp b/plugins/Dbx_mdb/src/dbcontacts.cpp index 921d116c24..7014dfd6c7 100644 --- a/plugins/Dbx_mdb/src/dbcontacts.cpp +++ b/plugins/Dbx_mdb/src/dbcontacts.cpp @@ -165,7 +165,7 @@ STDMETHODIMP_(BOOL) CDbxMdb::IsDbContact(MCONTACT contactID) BOOL CDbxMdb::MetaDetouchSub(DBCachedContact *cc, int nSub)
{
- DbModule_Delete(cc->pSubs[nSub], META_PROTO);
+ db_delete_module(cc->pSubs[nSub], META_PROTO);
return 0;
}
diff --git a/plugins/Dbx_mdb/src/dbintf.cpp b/plugins/Dbx_mdb/src/dbintf.cpp index c1f7500ccf..13a3b78e62 100644 --- a/plugins/Dbx_mdb/src/dbintf.cpp +++ b/plugins/Dbx_mdb/src/dbintf.cpp @@ -142,17 +142,15 @@ int CDbxMdb::Load(bool bSkipInit) // everything is ok, go on
if (!m_bReadOnly) {
- // we don't need events in the service mode
- if (ServiceExists(MS_DB_SETSAFETYMODE)) {
- hContactDeletedEvent = CreateHookableEvent(ME_DB_CONTACT_DELETED);
- hContactAddedEvent = CreateHookableEvent(ME_DB_CONTACT_ADDED);
- hSettingChangeEvent = CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED);
- hEventMarkedRead = CreateHookableEvent(ME_DB_EVENT_MARKED_READ);
-
- hEventAddedEvent = CreateHookableEvent(ME_DB_EVENT_ADDED);
- hEventDeletedEvent = CreateHookableEvent(ME_DB_EVENT_DELETED);
- hEventFilterAddedEvent = CreateHookableEvent(ME_DB_EVENT_FILTER_ADD);
- }
+ // retrieve the event handles
+ hContactDeletedEvent = CreateHookableEvent(ME_DB_CONTACT_DELETED);
+ hContactAddedEvent = CreateHookableEvent(ME_DB_CONTACT_ADDED);
+ hSettingChangeEvent = CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED);
+ hEventMarkedRead = CreateHookableEvent(ME_DB_EVENT_MARKED_READ);
+
+ hEventAddedEvent = CreateHookableEvent(ME_DB_EVENT_ADDED);
+ hEventDeletedEvent = CreateHookableEvent(ME_DB_EVENT_DELETED);
+ hEventFilterAddedEvent = CreateHookableEvent(ME_DB_EVENT_FILTER_ADD);
}
FillContacts();
diff --git a/plugins/Dbx_mdb/src/dbintf.h b/plugins/Dbx_mdb/src/dbintf.h index 496a315589..05d80d71cb 100644 --- a/plugins/Dbx_mdb/src/dbintf.h +++ b/plugins/Dbx_mdb/src/dbintf.h @@ -174,7 +174,7 @@ public: STDMETHODIMP_(MEVENT) FindNextEvent(MCONTACT contactID, MEVENT hDbEvent);
STDMETHODIMP_(MEVENT) FindPrevEvent(MCONTACT contactID, MEVENT hDbEvent);
- STDMETHODIMP_(BOOL) EnumModuleNames(DBMODULEENUMPROC pFunc, void *pParam);
+ STDMETHODIMP_(BOOL) EnumModuleNames(DBMODULEENUMPROC pFunc, const void *pParam);
STDMETHODIMP_(BOOL) GetContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv);
STDMETHODIMP_(BOOL) GetContactSettingStr(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv);
@@ -182,9 +182,9 @@ public: STDMETHODIMP_(BOOL) FreeVariant(DBVARIANT *dbv);
STDMETHODIMP_(BOOL) WriteContactSetting(MCONTACT contactID, DBCONTACTWRITESETTING *dbcws);
STDMETHODIMP_(BOOL) DeleteContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting);
- STDMETHODIMP_(BOOL) EnumContactSettings(MCONTACT contactID, DBCONTACTENUMSETTINGS *dbces);
+ STDMETHODIMP_(BOOL) EnumContactSettings(MCONTACT hContact, DBSETTINGENUMPROC pfnEnumProc, const char *szModule, const void *param);
STDMETHODIMP_(BOOL) SetSettingResident(BOOL bIsResident, const char *pszSettingName);
- STDMETHODIMP_(BOOL) EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam);
+ STDMETHODIMP_(BOOL) EnumResidentSettings(DBMODULEENUMPROC pFunc, const void *pParam);
STDMETHODIMP_(BOOL) IsSettingEncrypted(LPCSTR szModule, LPCSTR szSetting);
STDMETHODIMP_(BOOL) MetaDetouchSub(DBCachedContact *cc, int nSub);
diff --git a/plugins/Dbx_mdb/src/dbmodulechain.cpp b/plugins/Dbx_mdb/src/dbmodulechain.cpp index 2b821023d6..e45c2e2f69 100644 --- a/plugins/Dbx_mdb/src/dbmodulechain.cpp +++ b/plugins/Dbx_mdb/src/dbmodulechain.cpp @@ -64,7 +64,7 @@ char* CDbxMdb::GetModuleName(uint32_t dwId) return it != m_Modules.end() ? const_cast<char*>(it->second.c_str()) : nullptr;
}
-STDMETHODIMP_(BOOL) CDbxMdb::EnumModuleNames(DBMODULEENUMPROC pFunc, void *pParam)
+STDMETHODIMP_(BOOL) CDbxMdb::EnumModuleNames(DBMODULEENUMPROC pFunc, const void *pParam)
{
for (auto it = m_Modules.begin(); it != m_Modules.end(); ++it)
if (int ret = pFunc(it->second.c_str(), it->first, (LPARAM)pParam))
diff --git a/plugins/Dbx_mdb/src/dbsettings.cpp b/plugins/Dbx_mdb/src/dbsettings.cpp index 9c48880618..2887675cec 100644 --- a/plugins/Dbx_mdb/src/dbsettings.cpp +++ b/plugins/Dbx_mdb/src/dbsettings.cpp @@ -549,11 +549,11 @@ STDMETHODIMP_(BOOL) CDbxMdb::DeleteContactSetting(MCONTACT contactID, LPCSTR szM return 0;
}
-STDMETHODIMP_(BOOL) CDbxMdb::EnumContactSettings(MCONTACT contactID, DBCONTACTENUMSETTINGS* dbces)
+STDMETHODIMP_(BOOL) CDbxMdb::EnumContactSettings(MCONTACT hContact, DBSETTINGENUMPROC pfnEnumProc, const char *szModule, const void *param)
{
int result = -1;
- DBSettingKey keyVal = { contactID, GetModuleID(dbces->szModule) };
+ DBSettingKey keyVal = { hContact, GetModuleID(szModule) };
txn_ptr_ro txn(m_txn);
cursor_ptr_ro cursor(m_curSettings);
@@ -562,15 +562,15 @@ STDMETHODIMP_(BOOL) CDbxMdb::EnumContactSettings(MCONTACT contactID, DBCONTACTEN for (int res = mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE); res == MDB_SUCCESS; res = mdb_cursor_get(cursor, &key, &data, MDB_NEXT))
{
const DBSettingKey *pKey = (const DBSettingKey*)key.mv_data;
- if (pKey->hContact != contactID || pKey->dwModuleId != keyVal.dwModuleId)
+ if (pKey->hContact != hContact || pKey->dwModuleId != keyVal.dwModuleId)
break;
- result = (dbces->pfnEnumProc)(pKey->szSettingName, dbces->lParam);
+ result = pfnEnumProc(pKey->szSettingName, LPARAM(param));
}
return result;
}
-STDMETHODIMP_(BOOL) CDbxMdb::EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam)
+STDMETHODIMP_(BOOL) CDbxMdb::EnumResidentSettings(DBMODULEENUMPROC pFunc, const void *pParam)
{
for (int i = 0; i < m_lResidentSettings.getCount(); i++)
if (int ret = pFunc(m_lResidentSettings[i], 0, (LPARAM)pParam))
diff --git a/plugins/Dropbox/src/dropbox.cpp b/plugins/Dropbox/src/dropbox.cpp index 6ec01a5354..de21e2613c 100644 --- a/plugins/Dropbox/src/dropbox.cpp +++ b/plugins/Dropbox/src/dropbox.cpp @@ -48,7 +48,7 @@ MCONTACT CDropbox::GetDefaultContact() hDefaultContact = db_find_first(MODULE);
if (!hDefaultContact) {
- hDefaultContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hDefaultContact = db_add_contact();
if (!Proto_AddToContact(hDefaultContact, MODULE)) {
db_set_s(NULL, MODULE, "Nick", MODULE);
db_set_s(hDefaultContact, MODULE, "Nick", MODULE);
diff --git a/plugins/FavContacts/src/http_api.cpp b/plugins/FavContacts/src/http_api.cpp index cc84b08adc..d71e1c536d 100644 --- a/plugins/FavContacts/src/http_api.cpp +++ b/plugins/FavContacts/src/http_api.cpp @@ -52,7 +52,7 @@ public: int hContact;
sscanf(s, "/fav/open/%d", &hContact);
- if (CallService(MS_DB_CONTACT_IS, hContact, 0))
+ if (db_is_contact(hContact))
CallServiceSync(MS_FAVCONTACTS_OPEN_CONTACT, hContact, 0);
}
diff --git a/plugins/FavContacts/src/menu.cpp b/plugins/FavContacts/src/menu.cpp index 92775dee70..176f645120 100644 --- a/plugins/FavContacts/src/menu.cpp +++ b/plugins/FavContacts/src/menu.cpp @@ -128,7 +128,7 @@ BOOL MenuMeasureItem(LPMEASUREITEMSTRUCT lpmis, Options *options) BOOL res = FALSE;
if (INT_PTR(lpmis->itemData) < 0)
res = sttMeasureItem_Group(lpmis, options);
- else if (CallService(MS_DB_CONTACT_IS, lpmis->itemData, 0))
+ else if (db_is_contact(lpmis->itemData))
res = sttMeasureItem_Contact(lpmis, options);
if (res && (lpmis->itemWidth > g_maxItemWidth)) lpmis->itemWidth = g_maxItemWidth;
@@ -350,7 +350,7 @@ BOOL MenuDrawItem(LPDRAWITEMSTRUCT lpdis, Options *options) if (INT_PTR(lpdis->itemData) < 0)
return sttDrawItem_Group(lpdis, options);
- if (CallService(MS_DB_CONTACT_IS, lpdis->itemData, 0))
+ if (db_is_contact(lpdis->itemData))
return sttDrawItem_Contact(lpdis, options);
return FALSE;
@@ -419,7 +419,7 @@ static LRESULT CALLBACK MenuHostWndProc(HWND hwnd, UINT message, WPARAM wParam, GetMenuItemInfo((HMENU)lParam, wParam, TRUE, &mii);
MCONTACT cc = (MCONTACT)mii.dwItemData;
- if (!CallService(MS_DB_CONTACT_IS, cc, 0))
+ if (!db_is_contact(cc))
return FALSE;
HMENU hMenu = Menu_BuildContactMenu(cc);
diff --git a/plugins/GmailNotifier/src/options.cpp b/plugins/GmailNotifier/src/options.cpp index 7be689df09..02be23fd17 100644 --- a/plugins/GmailNotifier/src/options.cpp +++ b/plugins/GmailNotifier/src/options.cpp @@ -149,7 +149,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SendMessage(hwndCombo, CB_SETCURSEL, curIndex, 0);
SetDlgItemTextA(hwndDlg, IDC_PASS, "");
SetFocus(hwndCombo);
- acc[curIndex].hContact = CallService(MS_DB_CONTACT_ADD, 0, 0);
+ acc[curIndex].hContact = db_add_contact();
Proto_AddToContact(acc[curIndex].hContact, MODULE_NAME);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -164,7 +164,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SendMessage(hwndCombo, CB_DELETESTRING, curIndex, 0);
DeleteResults(acc[curIndex].results.next);
acc[curIndex].results.next = NULL;
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)acc[curIndex].hContact, 0);
+ db_delete_contact(acc[curIndex].hContact);
for (int i = curIndex; i < acc_num; i++)
acc[i] = acc[i + 1];
curIndex = 0;
diff --git a/plugins/HistoryPlusPlus/hpp_database.pas b/plugins/HistoryPlusPlus/hpp_database.pas index ead338fb9c..dc7d36b13c 100644 --- a/plugins/HistoryPlusPlus/hpp_database.pas +++ b/plugins/HistoryPlusPlus/hpp_database.pas @@ -104,7 +104,7 @@ uses procedure SetSafetyMode(Safe: Boolean);
begin
- CallService(MS_DB_SETSAFETYMODE,WPARAM(Safe),0);
+ db_set_safety_mode(int(Safe));
end;
function DBExists(const Module, Param: AnsiString): Boolean;
diff --git a/plugins/HistoryPlusPlus/hpp_searchthread.pas b/plugins/HistoryPlusPlus/hpp_searchthread.pas index 6d850ddf5e..daceee6684 100644 --- a/plugins/HistoryPlusPlus/hpp_searchthread.pas +++ b/plugins/HistoryPlusPlus/hpp_searchthread.pas @@ -401,7 +401,7 @@ end; function TSearchThread.GetContactsCount: Integer;
begin
- Result := CallService(MS_DB_CONTACT_GETCOUNT, 0, 0);
+ Result := db_get_contact_count();
end;
function TSearchThread.GetItemsCount(hContact: THandle): Integer;
diff --git a/plugins/HistoryStats/src/mirandasettings.cpp b/plugins/HistoryStats/src/mirandasettings.cpp index 9840e1ae0a..a05b843a65 100644 --- a/plugins/HistoryStats/src/mirandasettings.cpp +++ b/plugins/HistoryStats/src/mirandasettings.cpp @@ -139,5 +139,5 @@ int MirandaSettings::enumSettingsProc(const char* szSetting, LPARAM lParam) void MirandaSettings::enumSettings(const SetInserter& insertIterator)
{
- mu::db_contact::enumSettings(m_hContact, m_strModule.c_str(), enumSettingsProc, LPARAM(&insertIterator));
+ db_enum_settings(m_hContact, enumSettingsProc, m_strModule.c_str(), &insertIterator);
}
diff --git a/plugins/HistoryStats/src/mu_common.cpp b/plugins/HistoryStats/src/mu_common.cpp index d941c7c1c1..598537b135 100644 --- a/plugins/HistoryStats/src/mu_common.cpp +++ b/plugins/HistoryStats/src/mu_common.cpp @@ -44,25 +44,6 @@ namespace mu }
/*
- * db_time
- */
-
- namespace db_contact
- {
- int enumSettings(MCONTACT hContact, const char* szModule, DBSETTINGENUMPROC pEnumProc, LPARAM lProcParam)
- {
- DBCONTACTENUMSETTINGS dbces;
-
- dbces.pfnEnumProc = pEnumProc;
- dbces.lParam = lProcParam;
- dbces.szModule = szModule;
- dbces.ofsSettings = 0;
-
- return CallService(MS_DB_CONTACT_ENUMSETTINGS, hContact, reinterpret_cast<LPARAM>(&dbces));
- }
- }
-
- /*
* icolib
*/
diff --git a/plugins/HistoryStats/src/mu_common.h b/plugins/HistoryStats/src/mu_common.h index e8d407e928..f2afb7c9df 100644 --- a/plugins/HistoryStats/src/mu_common.h +++ b/plugins/HistoryStats/src/mu_common.h @@ -18,15 +18,6 @@ namespace mu }
/*
- * db_contact
- */
-
- namespace db_contact
- {
- int enumSettings(MCONTACT hContact, const char* szModule, DBSETTINGENUMPROC pEnumProc, LPARAM lProcParam);
- }
-
- /*
* icolib
*/
diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp index 57e54e5f89..48a0f50b23 100644 --- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp +++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp @@ -147,7 +147,7 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke // switch off SAFETYMODE if necessary
if (unsafe)
- CallService(MS_DB_SETSAFETYMODE, 0, 0);
+ db_set_safety_mode(FALSE);
GetBookmarks(hContact, &books, &bookcnt);
@@ -187,7 +187,7 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke // switch ON safety mode as fast as we can to avoid DB corruption
if (unsafe)
- CallService(MS_DB_SETSAFETYMODE, 1, 0);
+ db_set_safety_mode(TRUE);
SetCursor(LoadCursor(0, IDC_ARROW));
}
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index b163428edb..62b4260e8a 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -163,12 +163,7 @@ static int CopySettingsEnum(const char *szSetting, LPARAM lParam) void CopySettings(MCONTACT srcID, const char *szSrcModule, MCONTACT dstID, const char *szDstModule)
{
LIST<char> arSettings(50);
-
- DBCONTACTENUMSETTINGS dbces = { 0 };
- dbces.szModule = szSrcModule;
- dbces.pfnEnumProc = CopySettingsEnum;
- dbces.lParam = (LPARAM)&arSettings;
- srcDb->EnumContactSettings(srcID, &dbces);
+ srcDb->EnumContactSettings(srcID, CopySettingsEnum, szSrcModule, &arSettings);
for (int i = arSettings.getCount() - 1; i >= 0; i--) {
DBVARIANT dbv = { 0 };
@@ -527,9 +522,9 @@ static MCONTACT MapContact(MCONTACT hSrc) static MCONTACT AddContact(char *szProto, char *pszUniqueSetting, DBVARIANT *id, const wchar_t *pszUserID, wchar_t *nick, wchar_t *group)
{
- MCONTACT hContact = CallService(MS_DB_CONTACT_ADD, 0, 0);
+ MCONTACT hContact = db_add_contact();
if (Proto_AddToContact(hContact, szProto) != 0) {
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
AddMessage(LPGENW("Failed to add %S contact %s"), szProto, pszUserID);
return INVALID_CONTACT_ID;
}
@@ -572,8 +567,7 @@ void ImportContactSettings(AccountMap *pda, MCONTACT hSrc, MCONTACT hDst) return;
ImportContactData icd = { hSrc, hDst, pda->szSrcAcc, pda->pa->szModuleName };
-
- CallService(MS_DB_MODULES_ENUM, (WPARAM)&icd, (LPARAM)ModulesEnumProc);
+ db_enum_modules(ModulesEnumProc, &icd);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -594,12 +588,7 @@ static int ImportGroup(const char* szSettingName, LPARAM lParam) static int ImportGroups()
{
int nGroups = 0;
-
- DBCONTACTENUMSETTINGS param = { 0 };
- param.szModule = "CListGroups";
- param.pfnEnumProc = ImportGroup;
- param.lParam = (LPARAM)&nGroups;
- srcDb->EnumContactSettings(NULL, ¶m);
+ db_enum_settings(NULL, ImportGroup, "CListGroups", &nGroups);
return nGroups;
}
@@ -669,7 +658,7 @@ void ImportMeta(DBCachedContact *ccSrc) // do we need to add a new metacontact?
if (hDest == INVALID_CONTACT_ID) {
- hDest = CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hDest = db_add_contact();
Proto_AddToContact(hDest, META_PROTO);
CopySettings(ccSrc->contactID, META_PROTO, hDest, META_PROTO);
diff --git a/plugins/ImportTXT/ImportThrd.pas b/plugins/ImportTXT/ImportThrd.pas index 24a92156a8..4c4468d5e7 100644 --- a/plugins/ImportTXT/ImportThrd.pas +++ b/plugins/ImportTXT/ImportThrd.pas @@ -624,14 +624,14 @@ begin // [preMultiLine] ìîäèôèêàòîð äëÿ âîñïðèÿòèÿ ìíîãîñòðî÷íîãî òåêñòà
if DoMapFile then // Çàãðóæàåì ôàéë
begin
- CallService(MS_DB_SETSAFETYMODE, wParam(FALSE), 0);
+ db_set_safety_mode(0);
case WorkPattern.IType of
1: TextImportProcedure;
2: BinImportProcedure;
end; // case
end; // DoMapFile
finally
- CallService(MS_DB_SETSAFETYMODE, wParam(true), 0);
+ db_set_safety_mode(1);
DoMessage(ITXT_THREAD_FINISH, AddedMessages, Duplicates);
DoUnMapFile;
RegExpr.Free;
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 7f40aa30fb..522b590739 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -159,17 +159,11 @@ void FreeModuleSettingLL(ModuleSettingLL* msll) void RenameDbProto(MCONTACT hContact, MCONTACT hContactNew, char* oldName, char* newName, int delOld)
{
DBVARIANT dbv;
- ModuleSettingLL settinglist;
struct ModSetLinkLinkItem *setting;
- DBCONTACTENUMSETTINGS dbces;
// enum all setting the contact has for the module
- dbces.pfnEnumProc = enumModulesSettingsProc;
- dbces.szModule = oldName;
- dbces.lParam = (LPARAM)&settinglist;
- settinglist.first = 0;
- settinglist.last = 0;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, hContact, (LPARAM)&dbces);
+ ModuleSettingLL settinglist = { NULL, NULL };
+ db_enum_settings(hContact, enumModulesSettingsProc, oldName, &settinglist);
setting = settinglist.first;
while (setting) {
@@ -694,7 +688,7 @@ INT_PTR onChangeProto(WPARAM wparam, LPARAM lparam) Proto_AddToContact(hContactNew, (char*)lparam);
}
else {
- hContactNew = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContactNew = db_add_contact();
if (hContactNew) {
Proto_AddToContact(hContactNew, (char*)lparam);
RenameDbProto(hContact, hContactNew, GetContactProto(hContact), (char*)lparam, 0);
diff --git a/plugins/MirFox/src/MirfoxMiranda.cpp b/plugins/MirFox/src/MirfoxMiranda.cpp index c19a436e84..f5d64b0450 100644 --- a/plugins/MirFox/src/MirfoxMiranda.cpp +++ b/plugins/MirFox/src/MirfoxMiranda.cpp @@ -125,7 +125,7 @@ void CMirfoxMiranda::onContactAdded_async(void* threadArg) canAdd = false;
// check if hContact still exist
- if (canAdd && !CallService(MS_DB_CONTACT_IS, onContactAsyncThreadArgStruct->hContact, 0))
+ if (canAdd && !db_is_contact(onContactAsyncThreadArgStruct->hContact))
canAdd = false;
// execute
@@ -186,7 +186,7 @@ void CMirfoxMiranda::onContactSettingChanged_async(void* threadArg){ canAdd = false;
// check if hContact still exist
- if (canAdd && !CallService(MS_DB_CONTACT_IS, onContactAsyncThreadArgStruct->hContact, 0))
+ if (canAdd && !db_is_contact(onContactAsyncThreadArgStruct->hContact))
canAdd = false;
// edit
diff --git a/plugins/MirLua/src/m_database.cpp b/plugins/MirLua/src/m_database.cpp index 3a747f45aa..64715f01cf 100644 --- a/plugins/MirLua/src/m_database.cpp +++ b/plugins/MirLua/src/m_database.cpp @@ -331,7 +331,7 @@ static int db_Modules(lua_State *L) {
LIST<char> *param = new LIST<char>(5, PtrKeySortT);
- CallService(MS_DB_MODULES_ENUM, (WPARAM)param, (LPARAM)ModulesEnumProc);
+ db_enum_modules(ModulesEnumProc, param);
lua_pushinteger(L, 0);
lua_pushlightuserdata(L, param);
@@ -388,13 +388,7 @@ static int db_Settings(lua_State *L) const char* szModule = luaL_checkstring(L, 2);
LIST<char> *param = new LIST<char>(5, PtrKeySortT);
-
- DBCONTACTENUMSETTINGS dbces = { 0 };
- dbces.pfnEnumProc = SettingsEnumProc;
- dbces.szModule = szModule;
- dbces.ofsSettings = 0;
- dbces.lParam = (LPARAM)param;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, hContact, (LPARAM)&dbces);
+ db_enum_settings(hContact, SettingsEnumProc, szModule, param);
lua_pushinteger(L, 0);
lua_pushlightuserdata(L, param);
diff --git a/plugins/NewAwaySysMod/src/Options.cpp b/plugins/NewAwaySysMod/src/Options.cpp index 0a81d2f701..dd33eb8d02 100644 --- a/plugins/NewAwaySysMod/src/Options.cpp +++ b/plugins/NewAwaySysMod/src/Options.cpp @@ -299,13 +299,8 @@ void COptItem_TreeCtrl::DBToMem(const CString &sModule, CString *sDBSettingPrefi m_value.RemoveAll();
sTreeReadEnumData pData(this, sModule, *sDBSettingPrefix);
+ db_enum_settings(NULL, TreeReadEnum, sModule, &pData);
- DBCONTACTENUMSETTINGS dbEnum;
- dbEnum.lParam = (LPARAM)&pData;
- dbEnum.ofsSettings = 0;
- dbEnum.pfnEnumProc = TreeReadEnum;
- dbEnum.szModule = sModule;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM)&dbEnum);
if (!m_value.GetSize()) {
m_value = m_defValue;
}
@@ -481,12 +476,7 @@ void COptItem_TreeCtrl::CleanDBSettings(const CString &sModule, CString *sDBSett sTreeDeleteEnumData TreeDeleteEnumData;
TreeDeleteEnumData.TreeCtrl = this;
TreeDeleteEnumData.sDBSettingPrefix = sDBSettingPrefix;
- DBCONTACTENUMSETTINGS dbEnum;
- dbEnum.lParam = (LPARAM)&TreeDeleteEnumData;
- dbEnum.ofsSettings = 0;
- dbEnum.pfnEnumProc = TreeDeleteEnum;
- dbEnum.szModule = sModule;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM)&dbEnum);
+ db_enum_settings(NULL, TreeDeleteEnum, sModule, &TreeDeleteEnumData);
for (int i = 0; i < TreeDeleteEnumData.TreeSettings.GetSize(); i++)
db_unset(NULL, sModule, TreeDeleteEnumData.TreeSettings[i]);
@@ -672,12 +662,8 @@ void COptItem_ListCtrl::DBToMem(const CString &sModule, CString *sDBSettingPrefi m_value.RemoveAll();
sListReadEnumData pData(this, sModule, *sDBSettingPrefix);
- DBCONTACTENUMSETTINGS dbEnum;
- dbEnum.lParam = (LPARAM)&pData;
- dbEnum.ofsSettings = 0;
- dbEnum.pfnEnumProc = ListReadEnum;
- dbEnum.szModule = sModule;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM)&dbEnum);
+ db_enum_settings(NULL, ListReadEnum, sModule, &pData);
+
if (!m_value.GetSize())
m_value = m_defValue;
else {
@@ -752,12 +738,7 @@ void COptItem_ListCtrl::CleanDBSettings(const CString &sModule, CString *sDBSett sListDeleteEnumData ListDeleteEnumData;
ListDeleteEnumData.ListCtrl = this;
ListDeleteEnumData.sDBSettingPrefix = sDBSettingPrefix;
- DBCONTACTENUMSETTINGS dbEnum;
- dbEnum.lParam = (LPARAM)&ListDeleteEnumData;
- dbEnum.ofsSettings = 0;
- dbEnum.pfnEnumProc = ListDeleteEnum;
- dbEnum.szModule = sModule;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM)&dbEnum);
+ db_enum_settings(NULL, ListDeleteEnum, sModule, &ListDeleteEnumData);
for (int i = 0; i < ListDeleteEnumData.ListSettings.GetSize(); i++)
db_unset(NULL, sModule, ListDeleteEnumData.ListSettings[i]);
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index 466c7f6a14..afa1d8a579 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -1235,12 +1235,8 @@ int handleEnum(const char *szSetting, LPARAM lParam) bool isTabsrmmUsed() { - DBCONTACTENUMSETTINGS enm = { 0 }; bool found = false; - enm.lParam = (LPARAM)&found; - enm.pfnEnumProc = handleEnum; - enm.szModule = "PluginDisable"; - if (CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&enm) == -1) + if (db_enum_settings(NULL, handleEnum, "PluginDisable", &found) == -1) return false; return found; diff --git a/plugins/NewsAggregator/Src/ExportImport.cpp b/plugins/NewsAggregator/Src/ExportImport.cpp index 03a553b9d9..e959797d1b 100644 --- a/plugins/NewsAggregator/Src/ExportImport.cpp +++ b/plugins/NewsAggregator/Src/ExportImport.cpp @@ -149,7 +149,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM isGroupUTF = 1;
}
- MCONTACT hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ MCONTACT hContact = db_add_contact();
Proto_AddToContact(hContact, MODULE);
db_set_ws(hContact, MODULE, "Nick", text);
db_set_ws(hContact, MODULE, "URL", url);
diff --git a/plugins/NewsAggregator/Src/Options.cpp b/plugins/NewsAggregator/Src/Options.cpp index 5079444792..9c0b9e3a28 100644 --- a/plugins/NewsAggregator/Src/Options.cpp +++ b/plugins/NewsAggregator/Src/Options.cpp @@ -53,7 +53,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
}
- MCONTACT hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ MCONTACT hContact = db_add_contact();
Proto_AddToContact(hContact, MODULE);
GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str));
db_set_ws(hContact, MODULE, "Nick", str);
@@ -510,7 +510,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA if (mir_wstrcmp(dbURL, url))
continue;
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
+ db_delete_contact(hContact);
ListView_DeleteItem(hwndList, sel);
break;
}
diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp index 0dc717daef..11ac955a3a 100644 --- a/plugins/Non-IM Contact/src/contactinfo.cpp +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -338,7 +338,7 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) i++;
}
free(replace);
- MCONTACT hContact2 = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ MCONTACT hContact2 = db_add_contact();
Proto_AddToContact(hContact2, MODNAME);
CallService(MS_IGNORE_IGNORE, (WPARAM)hContact2, IGNOREEVENT_USERONLINE);
db_set_s(hContact2, MODNAME, "Nick", Translate("New Non-IM Contact"));
@@ -394,7 +394,7 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) char dbVar1[2000];
MCONTACT hContact1 = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (!db_get_static(hContact1, MODNAME, "Name", dbVar1, _countof(dbVar1))) {
- MCONTACT hContact2 = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ MCONTACT hContact2 = db_add_contact();
if (!hContact2) {
msg("contact did not get created", "");
return 0;
@@ -632,7 +632,7 @@ INT_PTR ImportContacts(WPARAM, LPARAM) }
if (MessageBoxA(0, msg, modFullname, MB_YESNO) == IDYES) {
- if (!(hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0))) {
+ if (!(hContact = db_add_contact())) {
msg("contact did get created", "");
continue;
}
diff --git a/plugins/Non-IM Contact/src/dialog.cpp b/plugins/Non-IM Contact/src/dialog.cpp index 8ead40caf2..482bd9674f 100644 --- a/plugins/Non-IM Contact/src/dialog.cpp +++ b/plugins/Non-IM Contact/src/dialog.cpp @@ -303,13 +303,13 @@ void DoPropertySheet(MCONTACT hContact) INT_PTR addContact(WPARAM, LPARAM)
{
char tmp[256];
- MCONTACT hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ MCONTACT hContact = db_add_contact();
Proto_AddToContact(hContact, MODNAME);
CallService(MS_IGNORE_IGNORE, hContact, IGNOREEVENT_USERONLINE);
db_set_ws(hContact, MODNAME, "Nick", TranslateT("New Non-IM Contact"));
DoPropertySheet(hContact);
if (db_get_static(hContact, MODNAME, "Name", tmp, _countof(tmp)))
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
replaceAllStrings(hContact);
return 0;
}
@@ -319,14 +319,14 @@ INT_PTR editContact(WPARAM wParam, LPARAM) MCONTACT hContact = wParam;
char tmp[256];
if (!hContact) {
- hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = db_add_contact();
Proto_AddToContact(hContact, MODNAME);
CallService(MS_IGNORE_IGNORE, hContact, IGNOREEVENT_USERONLINE);
db_set_s(hContact, MODNAME, "Nick", Translate("New Non-IM Contact"));
}
DoPropertySheet(hContact);
if (db_get_static(hContact, MODNAME, "Name", tmp, _countof(tmp)))
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
replaceAllStrings(hContact);
return 0;
}
diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp index 05e81a89b7..f375336afe 100644 --- a/plugins/Popup/src/config.cpp +++ b/plugins/Popup/src/config.cpp @@ -151,14 +151,9 @@ static int EnumProc(const char *szSetting, LPARAM lParam) static void CopyModule(const char *szModule, const char *szNewModule)
{
EnumProcParam param = { szModule, szNewModule };
+ db_enum_settings(NULL, EnumProc, szModule, ¶m);
- DBCONTACTENUMSETTINGS dbces = { 0 };
- dbces.pfnEnumProc = EnumProc;
- dbces.szModule = szModule;
- dbces.lParam = (LPARAM)¶m;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
-
- DbModule_Delete(0, szModule);
+ db_delete_module(0, szModule);
}
void UpgradeDb()
diff --git a/plugins/QuickSearch/i_ok.inc b/plugins/QuickSearch/i_ok.inc index fb2c41e137..a464d30e7b 100644 --- a/plugins/QuickSearch/i_ok.inc +++ b/plugins/QuickSearch/i_ok.inc @@ -455,7 +455,7 @@ begin if qsopt.numcolumns=0 then
exit;
// calculating contacts
- cnt:=CallService(MS_DB_CONTACT_GETCOUNT,0,0);
+ cnt:=db_get_contact_count();
if cnt=0 then
exit;
diff --git a/plugins/QuickSearch/sr_global.pas b/plugins/QuickSearch/sr_global.pas index d6b60ebed8..1412e8142a 100644 --- a/plugins/QuickSearch/sr_global.pas +++ b/plugins/QuickSearch/sr_global.pas @@ -696,7 +696,7 @@ var begin
if DBGetSettingType(0,qs_module,so_flags)=DBVT_DELETED then
begin
- DbModule_Delete(0,qs_module);
+ db_delete_module(0,qs_module);
qsopt.flags:=
QSO_SORTBYSTATUS or QSO_DRAWGRID or
QSO_CLIENTICONS or QSO_COLORIZE or
diff --git a/plugins/QuickSearch/sr_window.pas b/plugins/QuickSearch/sr_window.pas index de7b108950..bdefa5f51b 100644 --- a/plugins/QuickSearch/sr_window.pas +++ b/plugins/QuickSearch/sr_window.pas @@ -362,7 +362,7 @@ begin if ServiceExists(strCListDel)>0 then
CallService(strCListDel,hContact,0)
else
- CallService(MS_DB_CONTACT_DELETE,hContact,0);
+ db_delete_contact(hContact);
end;
procedure DeleteByList;
@@ -380,7 +380,7 @@ begin for i:=j downto 0 do
begin
if ListView_GetItemState(grid,i,LVIS_SELECTED)<>0 then
- CallService(MS_DB_CONTACT_DELETE,FlagBuf[LV_GetLParam(grid,i)].contact,0);
+ db_delete_contact(FlagBuf[LV_GetLParam(grid,i)].contact);
end;
SendMessage(grid,WM_SETREDRAW,1,0);
end;
diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp index 6818c5c879..468558b7be 100644 --- a/plugins/Quotes/src/ImportExport.cpp +++ b/plugins/Quotes/src/ImportExport.cpp @@ -106,13 +106,8 @@ int EnumDbModules(const char *szModuleName, DWORD, LPARAM lp) if (pModule) {
ctx->m_pszModule = szModuleName;
ctx->m_pNode = pModule;
+ db_enum_settings(ctx->m_hContact, &enum_contact_settings, szModuleName, ctx);
- DBCONTACTENUMSETTINGS dbces;
- dbces.pfnEnumProc = &enum_contact_settings;
- dbces.szModule = szModuleName;
- dbces.lParam = reinterpret_cast<LPARAM>(ctx);
-
- CallService(MS_DB_CONTACT_ENUMSETTINGS, WPARAM(ctx->m_hContact), reinterpret_cast<LPARAM>(&dbces));
if (pModule->GetChildCount() > 0)
pXml->AddChild(pModule);
@@ -131,7 +126,7 @@ IXMLNode::TXMLNodePtr export_contact(MCONTACT hContact, const CModuleInfo::TXMLE ctx.m_pNode = pNode;
ctx.m_hContact = hContact;
- CallService(MS_DB_MODULES_ENUM, (WPARAM)&ctx, (LPARAM)EnumDbModules);
+ db_enum_modules(EnumDbModules, &ctx);
}
return pNode;
}
@@ -557,7 +552,7 @@ bool import_contact(const IXMLNode::TXMLNodePtr& pXmlContact, CImportContext& im bool bResult = get_contact_state(pXmlContact, cst);
if (bResult) {
if (NULL == cst.m_hContact) {
- cst.m_hContact = MCONTACT(CallService(MS_DB_CONTACT_ADD, 0, 0));
+ cst.m_hContact = db_add_contact();
cst.m_bNewContact = true;
}
else if (impctx.m_nFlags & QUOTES_IMPORT_SKIP_EXISTING_CONTACTS)
diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp index 73937e2cf5..7697ba6d6a 100644 --- a/plugins/Quotes/src/QuotesProviderBase.cpp +++ b/plugins/Quotes/src/QuotesProviderBase.cpp @@ -662,7 +662,7 @@ void CQuotesProviderBase::WriteContactRate(MCONTACT hContact, double dRate, cons MCONTACT CQuotesProviderBase::CreateNewContact(const tstring& rsName)
{
- MCONTACT hContact = MCONTACT(CallService(MS_DB_CONTACT_ADD, 0, 0));
+ MCONTACT hContact = db_add_contact();
if (hContact) {
if (0 == Proto_AddToContact(hContact, QUOTES_PROTOCOL_NAME)) {
tstring sProvName = GetInfo().m_sName;
@@ -674,7 +674,7 @@ MCONTACT CQuotesProviderBase::CreateNewContact(const tstring& rsName) m_aContacts.push_back(hContact);
}
else {
- CallService(MS_DB_CONTACT_DELETE, WPARAM(hContact), 0);
+ db_delete_contact(hContact);
hContact = NULL;
}
}
diff --git a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp index 8119521bd1..c86049c521 100644 --- a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp +++ b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp @@ -38,7 +38,7 @@ bool CQuotesProviderDukasCopy::WatchForQuote(const CQuote& rQuote, bool bWatch) m_aContacts.erase(i);
}
- CallService(MS_DB_CONTACT_DELETE, WPARAM(hContact), 0);
+ db_delete_contact(hContact);
return true;
}
else if ((true == bWatch) && (i == m_aContacts.end())) {
diff --git a/plugins/Quotes/src/QuotesProviderFinance.cpp b/plugins/Quotes/src/QuotesProviderFinance.cpp index ada9936e77..d17a1c39ea 100644 --- a/plugins/Quotes/src/QuotesProviderFinance.cpp +++ b/plugins/Quotes/src/QuotesProviderFinance.cpp @@ -37,7 +37,7 @@ bool CQuotesProviderFinance::WatchForQuote(const CQuote& rQuote, bool bWatch) m_aContacts.erase(i);
}
- CallService(MS_DB_CONTACT_DELETE, WPARAM(hContact), 0);
+ db_delete_contact(hContact);
return true;
}
diff --git a/plugins/Quotes/src/QuotesProviderGoogle.cpp b/plugins/Quotes/src/QuotesProviderGoogle.cpp index 555081c72c..fb530adb06 100644 --- a/plugins/Quotes/src/QuotesProviderGoogle.cpp +++ b/plugins/Quotes/src/QuotesProviderGoogle.cpp @@ -53,7 +53,7 @@ bool CQuotesProviderGoogle::WatchForRate(const CRateInfo& ri, m_aContacts.erase(i);
}
- CallService(MS_DB_CONTACT_DELETE, WPARAM(hContact), 0);
+ db_delete_contact(hContact);
return true;
}
diff --git a/plugins/RemovePersonalSettings/src/rps.cpp b/plugins/RemovePersonalSettings/src/rps.cpp index 5df0d124b5..7da24ba134 100644 --- a/plugins/RemovePersonalSettings/src/rps.cpp +++ b/plugins/RemovePersonalSettings/src/rps.cpp @@ -195,14 +195,14 @@ void RemoveUsers() MCONTACT hContactOld = hContact;
hContact = db_find_next(hContact);
- if (isMetaContact(hContactOld) )
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContactOld, 0);
+ if (isMetaContact(hContactOld))
+ db_delete_contact(hContactOld);
}
// Now delete all left-overs
hContact = db_find_first();
while(hContact != NULL) {
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
hContact = db_find_first();
}
@@ -632,7 +632,7 @@ void DeleteSettingEx(const char *szModule, const char *szSetting) dms.filter = szModule;
dms.lenFilterMinusOne = lenModule-1;
- CallService(MS_DB_MODULES_ENUM, (WPARAM) &dms, (LPARAM) &ModuleEnumProc);
+ db_enum_modules(ModuleEnumProc, &dms);
// Delete then
szModule = dms.buffer;
@@ -647,19 +647,10 @@ void DeleteSettingEx(const char *szModule, const char *szSetting) size_t lenSetting = szSetting == NULL ? 0 : mir_strlen(szSetting);
if (szSetting == NULL || szSetting[0] == '*' || szSetting[lenSetting-1] == '*') {
DeleteModuleStruct dms;
- DBCONTACTENUMSETTINGS dbces;
-
memset(&dms, 0, sizeof(dms));
-
dms.filter = szSetting;
dms.lenFilterMinusOne = lenSetting-1;
-
- dbces.pfnEnumProc = EnumProc;
- dbces.lParam = (LPARAM) &dms;
- dbces.szModule = szModule;
- dbces.ofsSettings = 0;
-
- CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM) &dbces);
+ db_enum_settings(NULL, EnumProc, szModule, &dms);
// Delete then
szSetting = dms.buffer;
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 8962d354fe..70156a8b2b 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -1835,7 +1835,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP db_set_b(dat->hContact, SRMMMOD, "UseRTL", (BYTE)((dat->flags & SMF_RTL) ? 1 : 0));
if (dat->hContact && (g_dat.flags & SMF_DELTEMP))
if (db_get_b(dat->hContact, "CList", "NotOnList", 0))
- CallService(MS_DB_CONTACT_DELETE, dat->hContact, 0);
+ db_delete_contact(dat->hContact);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
SendMessage(dat->hwndParent, CM_REMOVECHILD, 0, (LPARAM)hwndDlg);
diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp index 6f9475c6e8..1cd20ad1ba 100644 --- a/plugins/ShellExt/src/shlcom.cpp +++ b/plugins/ShellExt/src/shlcom.cpp @@ -243,7 +243,7 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) bHideOffline = true;
// get the number of contacts
- int dwContacts = (int)CallService(MS_DB_CONTACT_GETCOUNT, 0, 0);
+ int dwContacts = db_get_contact_count();
if (dwContacts == 0)
return false;
diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index c53573bbf4..212e04ff37 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -911,21 +911,15 @@ int OptionsInit(WPARAM wparam,LPARAM lparam) static int ClearDatabase(char* filter)
{
- DBCONTACTENUMSETTINGS dbces;
- char** settings;
- int i, settingCount = 0;
-
settingIndex = 0;
- dbces.szModule = MODULENAME;
- dbces.lParam = (LPARAM)&settingCount;
- dbces.pfnEnumProc = CountSettings;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
-
- settings = (char**)malloc(settingCount*sizeof(char*));
- dbces.lParam = (LPARAM)&settings;
- dbces.pfnEnumProc = DeleteSetting;
- CallService(MS_DB_CONTACT_ENUMSETTINGS,0,(LPARAM)&dbces);
- for (i=0; i < settingCount; i++) {
+
+ int settingCount = 0;
+ db_enum_settings(NULL, CountSettings, MODULENAME, &settingCount);
+
+ char **settings = (char**)malloc(settingCount*sizeof(char*));
+ db_enum_settings(NULL, DeleteSetting, MODULENAME, &settings);
+
+ for (int i=0; i < settingCount; i++) {
if ((filter == NULL) || (!strncmp(filter, settings[i], mir_strlen(filter))))
db_unset(NULL, MODULENAME, settings[i]);
free(settings[i]);
diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index 5f3a810b60..4a42cb136c 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -261,7 +261,7 @@ void CleanProtocolTmpThread(std::string proto) for (std::list<MCONTACT>::iterator i = contacts.begin(); i != end; ++i) {
LogSpamToFile(*i, L"Deleted");
HistoryLogFunc(*i, "Deleted");
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)*i, 0);
+ db_delete_contact(*i);
}
clean_mutex.unlock();
}
@@ -286,7 +286,7 @@ void CleanProtocolExclThread(std::string proto) for (std::list<MCONTACT>::iterator i = contacts.begin(); i != end; ++i) {
LogSpamToFile(*i, L"Deleted");
HistoryLogFunc(*i, "Deleted");
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)*i, 0);
+ db_delete_contact(*i);
}
clean_mutex.unlock();
}
diff --git a/plugins/StopSpamPlus/src/services.cpp b/plugins/StopSpamPlus/src/services.cpp index 54c0019486..d0d4021ea4 100644 --- a/plugins/StopSpamPlus/src/services.cpp +++ b/plugins/StopSpamPlus/src/services.cpp @@ -38,7 +38,7 @@ INT_PTR RemoveTempContacts(WPARAM, LPARAM lParam) // Set a flag so we remember to delete the contact when the protocol goes online the next time
db_set_b(hContact, "CList", "Delete", 1);
else
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
}
}
}
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 36124651a1..18b2aa5846 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -611,7 +611,7 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l switch (LOWORD(wParam)) { case IDC_BBRESET: - DbModule_Delete(NULL, "TabSRMM_Toolbar"); + db_delete_module(NULL, "TabSRMM_Toolbar"); CB_HardReInit(); BuildMenuObjectsTree(hToolBarTree); break; diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp index aa1d32a4fd..d1f8cb16e0 100644 --- a/plugins/TabSRMM/src/chat/main.cpp +++ b/plugins/TabSRMM/src/chat/main.cpp @@ -226,12 +226,7 @@ static void CheckUpdate() if (compat == 0) {
LIST<char> szSettings(120);
-
- DBCONTACTENUMSETTINGS dbces = { 0 };
- dbces.szModule = CHAT_OLDFONTMODULE;
- dbces.pfnEnumProc = CopyChatSetting;
- dbces.lParam = (LPARAM)&szSettings;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
+ db_enum_settings(NULL, CopyChatSetting, CHAT_OLDFONTMODULE, &szSettings);
DBVARIANT dbv;
for (int i = szSettings.getCount() - 1; i >= 0; i--) {
@@ -242,7 +237,7 @@ static void CheckUpdate() mir_free(p);
}
- DbModule_Delete(NULL, CHAT_OLDFONTMODULE);
+ db_delete_module(NULL, CHAT_OLDFONTMODULE);
compat++;
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 87e0e8c979..afc2c235f6 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -3295,7 +3295,7 @@ quote_from_last: dat->cache->setWindowData();
if (dat->cache->isValid() && !dat->fIsReattach && dat->hContact && M.GetByte("deletetemp", 0))
if (db_get_b(dat->hContact, "CList", "NotOnList", 0))
- CallService(MS_DB_CONTACT_DELETE, dat->hContact, 0);
+ db_delete_contact(dat->hContact);
delete dat->Panel;
mir_free(dat);
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 97c12d1764..7415e54513 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -244,15 +244,8 @@ int _cdecl CSendLater::addStub(const char *szSetting, LPARAM lParam) void CSendLater::processSingleContact(const MCONTACT hContact)
{
int iCount = db_get_dw(hContact, "SendLater", "count", 0);
-
- if (iCount) {
- DBCONTACTENUMSETTINGS ces = { 0 };
- ces.pfnEnumProc = CSendLater::addStub;
- ces.szModule = "SendLater";
- ces.lParam = hContact;
-
- CallService(MS_DB_CONTACT_ENUMSETTINGS, hContact, (LPARAM)&ces);
- }
+ if (iCount)
+ db_enum_settings(hContact, CSendLater::addStub, "SendLater", (void*)hContact);
}
// called periodically from a timer, check if new contacts were added
diff --git a/plugins/TooltipNotify/src/DbHelpers.cpp b/plugins/TooltipNotify/src/DbHelpers.cpp index 4393e44b5a..8fe93249a6 100644 --- a/plugins/TooltipNotify/src/DbHelpers.cpp +++ b/plugins/TooltipNotify/src/DbHelpers.cpp @@ -13,12 +13,7 @@ static int EnumSettingsProc1(const char*, LPARAM) bool ModuleSettingsExists(MCONTACT hContact, const char* pszModuleName)
{
- DBCONTACTENUMSETTINGS dbces = {0};
- dbces.szModule = pszModuleName;
- dbces.pfnEnumProc = EnumSettingsProc1;
-
- int nResult = ::CallService(MS_DB_CONTACT_ENUMSETTINGS, hContact, (LPARAM)&dbces);
- return (nResult != -1);
+ return db_enum_settings(hContact, EnumSettingsProc1, pszModuleName) != -1;
}
static int EnumSettingsProc2(const char *pszSetting, LPARAM lParam)
@@ -31,12 +26,7 @@ static int EnumSettingsProc2(const char *pszSetting, LPARAM lParam) void DeleteModuleSettings(MCONTACT hContact, const char* pszModuleName)
{
SettingsList settingsList;
- DBCONTACTENUMSETTINGS dbces = {0};
- dbces.szModule = pszModuleName;
- dbces.lParam = (LPARAM)&settingsList;
- dbces.pfnEnumProc = EnumSettingsProc2;
-
- int nResult = ::CallService(MS_DB_CONTACT_ENUMSETTINGS, hContact, (LPARAM)&dbces);
+ int nResult = db_enum_settings(hContact, EnumSettingsProc2, pszModuleName, &settingsList);
if (nResult != -1)
{
for(unsigned i=0; i<settingsList.size(); i++)
@@ -60,12 +50,7 @@ static int GetSetting(MCONTACT hContact, const char *szModule, const char *szSet void RenameModule(MCONTACT hContact, const char* pszOldName, const char* pszNewName)
{
SettingsList settingsList;
- DBCONTACTENUMSETTINGS dbces = {0};
- dbces.szModule = pszOldName;
- dbces.lParam = (LPARAM)&settingsList;
- dbces.pfnEnumProc = EnumSettingsProc2;
-
- int nResult = ::CallService(MS_DB_CONTACT_ENUMSETTINGS, hContact, (LPARAM)&dbces);
+ int nResult = db_enum_settings(hContact, EnumSettingsProc2, pszOldName, &settingsList);
if (nResult != -1)
{
DBVARIANT dbv;
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index b8d878b188..34eb007d36 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -236,18 +236,18 @@ MCONTACT CExImContactBase::toDB() } // create new contact - _hContact = DB::Contact::Add(); + _hContact = db_add_contact(); if (!_hContact) { return _hContact = INVALID_CONTACT_ID; } // Add the protocol to the new contact if (Proto_AddToContact(_hContact, _pszProto)) { - DB::Contact::Delete(_hContact); + db_delete_contact(_hContact); return _hContact = INVALID_CONTACT_ID; } // write uid to protocol module if (db_set(_hContact, _pszProto, _pszUIDKey, &_dbvUID)) { - DB::Contact::Delete(_hContact); + db_delete_contact(_hContact); return _hContact = INVALID_CONTACT_ID; } // write nick and display name diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index 4a9b06f82e..c3b8f48f8e 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -607,7 +607,7 @@ int CExImContactXML::ImportContact() LPGENW("Importing a new contact was aborted!"),
LPGENW("You aborted import of a new contact.\nSome information may be missing for this contact.\n\nDo you want to delete the incomplete contact?"));
if (result == IDYES) {
- DB::Contact::Delete(_hContact);
+ db_delete_contact(_hContact);
_hContact = INVALID_CONTACT_ID;
}
}
@@ -749,7 +749,7 @@ int CExImContactXML::ImportMetaSubContact(CExImContactXML * pMetaContact) MIR_FREE(ptszNick);
MIR_FREE(ptszMetaNick);
if (result == IDYES) {
- DB::Contact::Delete(_hContact);
+ db_delete_contact(_hContact);
_hContact = INVALID_CONTACT_ID;
}
}
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp index 2ac2aaa37d..aee6a83b5f 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp @@ -366,11 +366,11 @@ int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName) int ret;
// disable database safty mode to speed up the operation
- CallService(MS_DB_SETSAFETYMODE, 0, 0);
+ db_set_safety_mode(0);
// import owner contact
ret = ImportOwner(xmlCard->FirstChildElement(XKEY_OWNER));
// as soon as possible enable safty mode again!
- CallService(MS_DB_SETSAFETYMODE, 1, 0);
+ db_set_safety_mode(1);
if (!ret) {
MsgBox(NULL, MB_ICONINFORMATION,
@@ -395,11 +395,11 @@ int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName) if (_numContactsTodo > 0) {
_progress.SetContactCount(_numContactsTodo);
// disable database safty mode to speed up the operation
- CallService(MS_DB_SETSAFETYMODE, 0, 0);
+ db_set_safety_mode(0);
// import the contacts
ImportContacts(xmlCard);
// as soon as possible enable safty mode again!
- CallService(MS_DB_SETSAFETYMODE, 1, 0);
+ db_set_safety_mode(1);
}
// finally hide the progress dialog
_progress.Hide();
diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index 6bf79fc8e7..f1b8feaf83 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -28,36 +28,6 @@ namespace DB { **/
namespace Contact {
-
-/**
- * Gets the number of contacts in the database, which does not count the user
- * @param hContact - handle to the contact
- * @return Returns the number of contacts. They can be retrieved using
- * contact/findfirst and contact/findnext
- **/
-INT_PTR GetCount()
-{
- return CallService(MS_DB_CONTACT_GETCOUNT, 0, 0);
-}
-
-/**
- * Simply adds a new contact without setting up any protocol or something else
- * @return HANDLE The function returns the HANDLE of the new contact
- **/
-MCONTACT Add()
-{
- return (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
-}
-
-/**
- * This function deletes a contact from the database.
- * @param hContact - handle to the contact
- **/
-BYTE Delete(MCONTACT hContact)
-{
- return CallService(MS_DB_CONTACT_DELETE, hContact, 0) != 0;
-}
-
/**
* This function trys to guess, when an ICQ contact was added to database.
**/
@@ -121,10 +91,7 @@ static int IsEmptyEnumProc(LPCSTR, LPARAM) bool IsEmpty(MCONTACT hContact, LPCSTR pszModule)
{
- DBCONTACTENUMSETTINGS dbces = { 0 };
- dbces.pfnEnumProc = IsEmptyEnumProc;
- dbces.szModule = pszModule;
- return (0 > CallService(MS_DB_CONTACT_ENUMSETTINGS, hContact, (LPARAM)&dbces));
+ return 0 > db_enum_settings(hContact, IsEmptyEnumProc, pszModule);
}
/**
@@ -755,7 +722,7 @@ LPSTR CEnumList::Insert(LPCSTR str) INT_PTR CEnumList::EnumModules()
{
- return CallService(MS_DB_MODULES_ENUM, (WPARAM)this, (LPARAM)CEnumList::EnumProc);
+ return db_enum_modules(CEnumList::EnumProc, this);
}
/**
@@ -765,11 +732,7 @@ INT_PTR CEnumList::EnumModules() INT_PTR CEnumList::EnumSettings(MCONTACT hContact, LPCSTR pszModule)
{
- DBCONTACTENUMSETTINGS dbces = { 0 };
- dbces.pfnEnumProc = (DBSETTINGENUMPROC)CEnumList::EnumSettingsProc;
- dbces.szModule = pszModule;
- dbces.lParam = (LPARAM)this;
- return CallService(MS_DB_CONTACT_ENUMSETTINGS, hContact, (LPARAM)&dbces);
+ return db_enum_settings(hContact, &CEnumList::EnumSettingsProc, pszModule, this);
}
} /* namespace DB */
\ No newline at end of file diff --git a/plugins/UserInfoEx/src/mir_db.h b/plugins/UserInfoEx/src/mir_db.h index 6b83a4e3a5..a9897306b5 100644 --- a/plugins/UserInfoEx/src/mir_db.h +++ b/plugins/UserInfoEx/src/mir_db.h @@ -32,13 +32,7 @@ namespace Contact { { return pcli->pfnGetContactDisplayName(hContact, 0);
}
- INT_PTR GetCount();
-
- MCONTACT Add();
- BYTE Delete(MCONTACT hContact);
-
DWORD WhenAdded(DWORD dwUIN, LPCSTR szBaseProto);
-
} /* namespace Contact */
namespace Module {
diff --git a/plugins/Utils.pas/dbsettings.pas b/plugins/Utils.pas/dbsettings.pas index c60220e3a2..32ba169808 100644 --- a/plugins/Utils.pas/dbsettings.pas +++ b/plugins/Utils.pas/dbsettings.pas @@ -217,7 +217,6 @@ end; function DBDeleteGroup(hContact:TMCONTACT;szModule:PAnsiChar;prefix:PAnsiChar=nil):int_ptr;
var
- ces:TDBCONTACTENUMSETTINGS;
p:PAnsiChar;
code,num:integer;
ptr:PAnsiChar;
@@ -227,26 +226,19 @@ var begin
if (prefix=nil) or (prefix^=#0) then
begin
- DbModule_Delete(hContact,szModule);
+ db_delete_module(hContact,szModule);
result:=0;
exit;
end;
- ces.szModule:=szModule;
- num:=0;
//calculate size for setting names buffer
- ces.pfnEnumProc:=@EnumSettingsProcCalc;
- ces.lParam :=lParam(@num);
- ces.ofsSettings:=0;
- CallService(MS_DB_CONTACT_ENUMSETTINGS,hContact,lparam(@ces));
+ num:=0;
+ db_enum_settings(hContact,@EnumSettingsProcCalc,szModule,@num);
//get setting names list
GetMem(p,num+1);
ptr:=p;
- ces.pfnEnumProc:=@EnumSettingsProc;
- ces.lParam :=lparam(@ptr);
- ces.ofsSettings:=0;
- result:=CallService(MS_DB_CONTACT_ENUMSETTINGS,hContact,lparam(@ces));
+ result:=db_enum_settings(hContact,@EnumSettingsProc,szModule,@ptr);
ptr^:=#0;
ptr:=p;
diff --git a/plugins/Utils.pas/mircontacts.pas b/plugins/Utils.pas/mircontacts.pas index cb87d93b5a..d9e2e2bf7e 100644 --- a/plugins/Utils.pas/mircontacts.pas +++ b/plugins/Utils.pas/mircontacts.pas @@ -459,7 +459,7 @@ begin {
CallService(MS_CLIST_CONTACTDOUBLECLICKED,hContact,0);
}
- if (hContact<>0) and (CallService(MS_DB_CONTACT_IS,hContact,0)<>0) then
+ if (hContact<>0) and (db_is_contact(hContact)<>0) then
begin
if StrCopy(pc,GetContactProto(hContact))<>nil then
if DblClk or (DBReadByte(hContact,pc,'ChatRoom',0)=1) then // chat room
diff --git a/plugins/Utils.pas/srvblock.pas b/plugins/Utils.pas/srvblock.pas index cf7b4125eb..6a0e0adfe0 100644 --- a/plugins/Utils.pas/srvblock.pas +++ b/plugins/Utils.pas/srvblock.pas @@ -561,7 +561,7 @@ begin mFreeMem(lservice);
if StrPos(buf,protostr)<>nil then
- if CallService(MS_DB_CONTACT_IS,data.Parameter,0)<>0 then
+ if db_is_contact(data.Parameter)<>0 then
StrReplace(buf,protostr,Proto_GetBaseAccountName(data.Parameter))
else
Exit;
diff --git a/plugins/Watrack/status/i_opt_tmpl.inc b/plugins/Watrack/status/i_opt_tmpl.inc index 9d717198da..285e61a9e8 100644 --- a/plugins/Watrack/status/i_opt_tmpl.inc +++ b/plugins/Watrack/status/i_opt_tmpl.inc @@ -134,17 +134,12 @@ end; function EnumTemplates:PAnsiChar;
var
- ces:TDBCONTACTENUMSETTINGS;
p:PAnsiChar;
begin
mGetMem(result,16384);
result^:=#0;
p:=result;
- ces.pfnEnumProc:=@EnumSettingsProc;
- ces.lParam :=lparam(@p);
- ces.szModule :=PluginShort;
- ces.ofsSettings:=0;
- CallService(MS_DB_CONTACT_ENUMSETTINGS,0,lparam(@ces));
+ db_enum_settings(0, @EnumSettingsProc, PluginShort, @p);
end;
procedure LoadTemplates;
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp index 8cdd7c98ed..58379ec9c4 100644 --- a/plugins/Weather/src/weather_addstn.cpp +++ b/plugins/Weather/src/weather_addstn.cpp @@ -63,7 +63,7 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam) // if contact with the same ID was not found, add it
if (psr->cbSize < sizeof(PROTOSEARCHRESULT)) return 0;
- MCONTACT hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ MCONTACT hContact = db_add_contact();
Proto_AddToContact(hContact, WEATHERPROTONAME);
// suppress online notification for the new contact
CallService(MS_IGNORE_IGNORE, hContact, IGNOREEVENT_USERONLINE);
diff --git a/plugins/Weather/src/weather_data.cpp b/plugins/Weather/src/weather_data.cpp index eea3edf81b..498d9db482 100644 --- a/plugins/Weather/src/weather_data.cpp +++ b/plugins/Weather/src/weather_data.cpp @@ -403,14 +403,9 @@ int GetWeatherDataFromDB(const char *szSetting, LPARAM lparam) //
void DBDataManage(MCONTACT hContact, WORD Mode, WPARAM wParam, LPARAM)
{
+ // get all the settings and store them in a temporary list
LIST<char> arSettings(10);
-
- // get all the settings and stored them in a temporary list
- DBCONTACTENUMSETTINGS dbces;
- dbces.lParam = (LPARAM)&arSettings;
- dbces.pfnEnumProc = GetWeatherDataFromDB;
- dbces.szModule = WEATHERCONDITION;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, hContact, (LPARAM)&dbces);
+ db_enum_settings(hContact, GetWeatherDataFromDB, WEATHERCONDITION, &arSettings);
// begin deleting settings
for (int i = arSettings.getCount() - 1; i >= 0; i--) {
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp index 9958e98629..fc3fccb510 100644 --- a/plugins/WebView/src/webview_services.cpp +++ b/plugins/WebView/src/webview_services.cpp @@ -368,7 +368,7 @@ INT_PTR AddToList(WPARAM, LPARAM lParam) db_free(&dbv); } - hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact = db_add_contact(); Proto_AddToContact(hContact, MODULENAME); /////////write to db diff --git a/plugins/YAMN/src/proto/pop3/pop3comm.cpp b/plugins/YAMN/src/proto/pop3/pop3comm.cpp index edf298d3e6..8984a4dfbb 100644 --- a/plugins/YAMN/src/proto/pop3/pop3comm.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3comm.cpp @@ -302,7 +302,7 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) if (!Finder->hContact && (Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) {
//No account contact found, have to create one
- Finder->hContact = CallService(MS_DB_CONTACT_ADD, 0, 0);
+ Finder->hContact = db_add_contact();
Proto_AddToContact(Finder->hContact, YAMN_DBMODULE);
db_set_s(Finder->hContact, YAMN_DBMODULE, "Id", Finder->Name);
db_set_s(Finder->hContact, YAMN_DBMODULE, "Nick", Finder->Name);
diff --git a/plugins/YAMN/src/proto/pop3/pop3opt.cpp b/plugins/YAMN/src/proto/pop3/pop3opt.cpp index 3148158989..14d242106f 100644 --- a/plugins/YAMN/src/proto/pop3/pop3opt.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3opt.cpp @@ -869,7 +869,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP DlgSetItemTextT(hDlg, IDC_STTIMELEFT, TranslateT("Please wait while no account is in use."));
if (ActualAccount->hContact != NULL)
- CallService(MS_DB_CONTACT_DELETE, ActualAccount->hContact, 0);
+ db_delete_contact(ActualAccount->hContact);
CallService(MS_YAMN_DELETEACCOUNT, (WPARAM)POP3Plugin, (LPARAM)ActualAccount);
diff --git a/plugins/YAMN/src/services.cpp b/plugins/YAMN/src/services.cpp index 6bb3c1c21f..ba0f805c4e 100644 --- a/plugins/YAMN/src/services.cpp +++ b/plugins/YAMN/src/services.cpp @@ -443,7 +443,7 @@ void RefreshContact(void) db_set_b(Finder->hContact, "CList", "Hidden", 1);
}
else if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) {
- Finder->hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ Finder->hContact = db_add_contact();
Proto_AddToContact(Finder->hContact, YAMN_DBMODULE);
db_set_s(Finder->hContact, YAMN_DBMODULE, "Id", Finder->Name);
db_set_s(Finder->hContact, YAMN_DBMODULE, "Nick", Finder->Name);
diff --git a/plugins/mRadio/i_myservice.inc b/plugins/mRadio/i_myservice.inc index d55ab469e9..303aef72c1 100644 --- a/plugins/mRadio/i_myservice.inc +++ b/plugins/mRadio/i_myservice.inc @@ -149,7 +149,7 @@ begin pc:=GetParamSectionStr(section,'URL');
if pc<>nil then
begin
- result:=CallService(MS_DB_CONTACT_ADD,0,0);
+ result:=db_add_contact();
if result<>0 then
begin
Proto_AddToContact(result,PluginName);
@@ -259,7 +259,7 @@ begin StrCopy(dst,PAnsiChar(lParam));
if (lParam<>0) or ShowDlg(dst,'radio.ini',nil,false) then
begin
- if (wParam<>0) and (CallService(MS_DB_CONTACT_IS,wParam,0)<>0) then
+ if (wParam<>0) and (db_is_contact(wParam)<>0) then
begin
result:=1;
ExportRadioContact(result,dst,wParam)
@@ -285,7 +285,7 @@ begin filter:=ConstructFilter;
if ShowDlgW(@buf,nil,filter) then
begin
- result:=CallService(MS_DB_CONTACT_ADD,0,0);
+ result:=db_add_contact();
if result<>0 then
begin
Proto_AddToContact(result,PluginName);
diff --git a/plugins/mRadio/i_search.inc b/plugins/mRadio/i_search.inc index 355d91f833..4073d82d97 100644 --- a/plugins/mRadio/i_search.inc +++ b/plugins/mRadio/i_search.inc @@ -397,7 +397,7 @@ begin end;
// if not found
}
- hContact:=CallService(MS_DB_CONTACT_ADD,0,0);
+ hContact:=db_add_contact();
if hContact<>0 then
begin
Proto_AddToContact(hContact,PluginName);
|