diff options
author | George Hazan <george.hazan@gmail.com> | 2016-09-13 17:11:58 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-09-13 17:11:58 +0000 |
commit | f51995e13679a37851baef8e7f52f2d993cbc7c1 (patch) | |
tree | 25ccd03cf2dc4b897cc0dc6fcbe4cc78ddb122c7 /plugins | |
parent | fe1e8456d2488095f409a4f2d38b7251abdedccf (diff) |
mode old database junk to die
git-svn-id: http://svn.miranda-ng.org/main/trunk@17291 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
61 files changed, 130 insertions, 189 deletions
diff --git a/plugins/Actman/iac_contact.pas b/plugins/Actman/iac_contact.pas index 561c8840fa..02931f7ae9 100644 --- a/plugins/Actman/iac_contact.pas +++ b/plugins/Actman/iac_contact.pas @@ -138,7 +138,7 @@ begin end;
end;
end;
- DBFreeVariant(@cws);
+ db_free(@cws);
end;
if result<>0 then
begin
diff --git a/plugins/AssocMgr/src/reg.cpp b/plugins/AssocMgr/src/reg.cpp index 2c7789bb60..7a717a0766 100644 --- a/plugins/AssocMgr/src/reg.cpp +++ b/plugins/AssocMgr/src/reg.cpp @@ -127,7 +127,7 @@ wchar_t* MakeRunCommand(BOOL fMirExe, BOOL fFixedDbProfile) {
wchar_t szDbFile[MAX_PATH], szExe[MAX_PATH], *pszFmt;
if (fFixedDbProfile) {
- if (CallService(MS_DB_GETPROFILENAMEW, _countof(szDbFile), (LPARAM)szDbFile))
+ if (Profile_GetNameW(_countof(szDbFile), szDbFile))
return NULL;
wchar_t *p = wcsrchr(szDbFile, '.');
if (p)
diff --git a/plugins/AutoRun/src/main.cpp b/plugins/AutoRun/src/main.cpp index 0ec952d756..dbd17855b0 100644 --- a/plugins/AutoRun/src/main.cpp +++ b/plugins/AutoRun/src/main.cpp @@ -27,7 +27,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) void GetProfilePath(wchar_t *res, size_t resLen)
{
wchar_t dbname[MAX_PATH], exename[MAX_PATH];
- CallService(MS_DB_GETPROFILENAMEW, _countof(dbname), (LPARAM)dbname);
+ Profile_GetNameW(_countof(dbname), dbname);
GetModuleFileName(NULL, exename, _countof(exename));
wchar_t *p = wcsrchr(dbname, '.');
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index 8ff71a8b5d..fd70eff119 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -343,8 +343,7 @@ extern "C" __declspec(dllexport) int Load(void) CreateServiceFunction(MS_AVATARHISTORY_ENABLED, IsEnabled);
CreateServiceFunction(MS_AVATARHISTORY_GET_CACHED_AVATAR, GetCachedAvatar);
- if (CallService(MS_DB_GETPROFILEPATHW, MAX_PATH, (LPARAM)profilePath) != 0)
- mir_wstrcpy(profilePath, L"."); // Failed, use current dir
+ Profile_GetPathW(MAX_PATH, profilePath);
SkinAddNewSoundExW("avatar_changed",LPGENW("Avatar History"),LPGENW("Contact changed avatar"));
SkinAddNewSoundExW("avatar_removed",LPGENW("Avatar History"),LPGENW("Contact removed avatar"));
diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index bc459bfd95..a2a73665e4 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -86,7 +86,7 @@ bool HistoryEventList::CanShowHistory(DBEVENTINFO* dbei) return true;
default:
- DBEVENTTYPEDESCR *et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
+ DBEVENTTYPEDESCR *et = DbEvent_GetType(dbei->szModule, dbei->eventType);
if (et && (et->flags & DETF_HISTORY))
return true;
}
@@ -448,7 +448,7 @@ std::wstring HistoryEventList::GetContactId() static void GetMessageDescription(DBEVENTINFO *dbei, wchar_t* buf, int cbBuf)
{
- wchar_t *msg = DbGetEventTextW(dbei, CP_ACP);
+ wchar_t *msg = DbEvent_GetTextW(dbei, CP_ACP);
wcsncpy_s(buf, cbBuf, msg ? msg : TranslateT("Invalid Message"), _TRUNCATE);
buf[cbBuf - 1] = 0;
mir_free(msg);
@@ -568,7 +568,7 @@ HICON HistoryEventList::GetEventCoreIcon(const EventIndex& ev) if (ev.isExternal)
return NULL;
- HICON ico = (HICON)CallService(MS_DB_EVENT_GETICON, LR_SHARED, (LPARAM)&m_dbei);
+ HICON ico = DbEvent_GetIcon(&m_dbei, LR_SHARED);
HICON icoMsg = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
if (icoMsg == ico)
return NULL;
diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp index 42278611c0..ca63fc71c5 100644 --- a/plugins/Boltun/src/boltun.cpp +++ b/plugins/Boltun/src/boltun.cpp @@ -216,11 +216,8 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) db_event_get(hDbEvent, &dbei);
if (dbei.flags & DBEF_SENT || dbei.flags & DBEF_READ || dbei.eventType != EVENTTYPE_MESSAGE)
return 0;
- DBEVENTGETTEXT egt;
- egt.codepage = CP_ACP;
- egt.datatype = DBVT_WCHAR;
- egt.dbei = &dbei;
- wchar_t* s = (wchar_t*)(void*)CallService(MS_DB_EVENT_GETTEXT, 0, (LPARAM)&egt);
+
+ wchar_t *s = DbEvent_GetTextW(&dbei, CP_ACP);
free(dbei.pBlob);
if (Config.MarkAsRead)
db_event_markRead(hContact, hDbEvent);
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 58903af561..6c0e1af226 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -1560,8 +1560,8 @@ LRESULT CLUI::PreProcessWndProc(UINT msg, WPARAM wParam, LPARAM lParam, BOOL& bH hView = MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, MAX_PATH);
if (hView) {
char szFilePath[MAX_PATH], szProfile[MAX_PATH];
- CallService(MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)&szFilePath);
- CallService(MS_DB_GETPROFILENAME, MAX_PATH, (LPARAM)&szProfile);
+ Profile_GetPathA(MAX_PATH, szFilePath);
+ Profile_GetNameA(MAX_PATH, szProfile);
mir_snprintf((char*)hView, MAX_PATH, "%s\\%s", szFilePath, szProfile);
UnmapViewOfFile(hView);
rc = 1;
diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index 167a0a8d07..5131e493ca 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -1948,7 +1948,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()) { - CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)"ModernSkin"); + DbModule_Delete(0, "ModernSkin"); db_set_s(NULL, SKIN, "SkinFolder", "%Default%"); db_set_s(NULL, SKIN, "SkinFile", "%Default%"); parser.Parse(IniParser::WriteStrToDb, 0); @@ -1966,7 +1966,7 @@ int ske_LoadSkinFromIniFile(wchar_t *szFileName, BOOL bOnlyObjects) if (!parser.CheckOK()) return 0; - CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)"ModernSkin"); + DbModule_Delete(0, "ModernSkin"); wchar_t skinFolder[MAX_PATH], skinFile[MAX_PATH]; IniParser::GetSkinFolder(szFileName, skinFolder); @@ -3314,7 +3314,7 @@ wchar_t* ske_ReplaceVar(wchar_t *var) if (!var) return mir_wstrdup(L""); if (!mir_wstrcmpi(var, L"Profile")) { char buf[MAX_PATH] = { 0 }; - CallService(MS_DB_GETPROFILENAME, (WPARAM)MAX_PATH, (LPARAM)buf); + Profile_GetNameA(MAX_PATH, buf); char *p = strrchr(buf, '.'); if (p) *p = 0; diff --git a/plugins/Clist_modern/src/modern_toolbar.cpp b/plugins/Clist_modern/src/modern_toolbar.cpp index b31609f534..efced1370b 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");
- CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)"ModernToolBar");
+ DbModule_Delete(0, "ModernToolBar");
}
db_set_b(NULL, "Compatibility", "TTB_Upgrade", 1);
}
diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index adb599e45c..9abe3553d9 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -182,7 +182,7 @@ extern "C" int __declspec(dllexport) CListInitialise() cfg::dat.dwFlags |= (db_get_b(NULL, "CLUI", "ShowSBar", 1) ? CLUI_FRAME_SBARSHOW : 0);
cfg::dat.soundsOff = db_get_b(NULL, "Skin", "UseSound", 1) ? 0 : 1;
- CallService(MS_DB_GETPROFILEPATHW, MAX_PATH, (LPARAM)cfg::dat.tszProfilePath);
+ Profile_GetPathW(MAX_PATH, cfg::dat.tszProfilePath);
wcslwr(cfg::dat.tszProfilePath);
// get the clist interface
diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index 1d18f4bc8b..6d4323338e 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -1373,7 +1373,7 @@ void AddHistoryEvent(DBEVENTINFO *dbEvent, char *contact, PReply reply) TimeZone_ToString(dbEvent->timestamp, "D, s", timestamp, sizeof(timestamp));
char *sender = (dbEvent->flags & DBEF_SENT) ? Translate("[me]") : contact;
- char *message = DbGetEventTextA(dbEvent, CP_ACP);
+ char *message = DbEvent_GetTextA(dbEvent, CP_ACP);
static char buffer[8192];
mir_snprintf(buffer, "[%s] %15s: %s", timestamp, sender, message);
diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index c3bc12a83c..3a2c58b4e8 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -617,9 +617,8 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg, UINT message, WPARAM wParam // restore position
Utils_RestoreWindowPosition(hwndDlg, NULL, "Console", "Console", RWPF_HIDDEN);
- CallService(MS_DB_GETPROFILENAMEW, (WPARAM)_countof(name), (LPARAM)name);
-
- CallService(MS_DB_GETPROFILEPATHW, (WPARAM)_countof(path), (LPARAM)path);
+ Profile_GetNameW(_countof(name), name);
+ Profile_GetPathW(_countof(path), path);
mir_snwprintf(title, L"%s - %s\\%s", TranslateT("Miranda Console"), path, name);
diff --git a/plugins/Db3x_mmap/src/dbcontacts.cpp b/plugins/Db3x_mmap/src/dbcontacts.cpp index 5935ac0685..710b5324c1 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)
{
- CallService(MS_DB_MODULE_DELETE, cc->pSubs[nSub], (LPARAM)META_PROTO);
+ DbModule_Delete(cc->pSubs[nSub], META_PROTO);
return 0;
}
diff --git a/plugins/DbChecker/src/finished.cpp b/plugins/DbChecker/src/finished.cpp index 8984215d03..2609a763bd 100644 --- a/plugins/DbChecker/src/finished.cpp +++ b/plugins/DbChecker/src/finished.cpp @@ -43,7 +43,7 @@ INT_PTR CALLBACK FinishedDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM case WZN_CANCELCLICKED:
bLaunchMiranda = IsDlgButtonChecked(hdlg, IDC_LAUNCHMIRANDA) == BST_CHECKED;
- CallService(MS_DB_SETDEFAULTPROFILE, (WPARAM)opts.filename, 0);
+ Profile_SetDefault(opts.filename);
wizardResult = 1;
return TRUE;
}
diff --git a/plugins/DbChecker/src/progress.cpp b/plugins/DbChecker/src/progress.cpp index 5c123b86e0..ffac34c610 100644 --- a/plugins/DbChecker/src/progress.cpp +++ b/plugins/DbChecker/src/progress.cpp @@ -185,7 +185,7 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM if (bShortModeDone) {
if (!errorCount) {
if (bLaunchMiranda)
- CallService(MS_DB_SETDEFAULTPROFILE, (WPARAM)opts.filename, 0);
+ Profile_SetDefault(opts.filename);
wizardResult = 1;
}
return TRUE;
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp index d95b9e59f1..ee9383fdff 100644 --- a/plugins/Db_autobackups/src/backup.cpp +++ b/plugins/Db_autobackups/src/backup.cpp @@ -186,7 +186,7 @@ int Backup(wchar_t *backup_filename) HWND progress_dialog = NULL;
SYSTEMTIME st;
- CallService(MS_DB_GETPROFILENAMEW, _countof(dbname), (LPARAM)dbname);
+ Profile_GetNameW(_countof(dbname), dbname);
if (backup_filename == NULL) {
int err;
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index 448e15fab4..13bf958c21 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -35,14 +35,14 @@ static INT_PTR ABService(WPARAM, LPARAM) static INT_PTR DBSaveAs(WPARAM, LPARAM)
{
wchar_t fname_buff[MAX_PATH], tszFilter[200];
- OPENFILENAME ofn = { 0 };
- CallService(MS_DB_GETPROFILENAMEW, _countof(fname_buff), (LPARAM)fname_buff);
+ Profile_GetNameW(_countof(fname_buff), fname_buff);
mir_snwprintf(tszFilter, L"%s (*.dat)%c*.dat%c%s (*.zip)%c*.zip%c%s (*.*)%c*%c",
TranslateT("Miranda NG databases"), 0, 0,
TranslateT("Compressed Miranda NG databases"), 0, 0,
TranslateT("All files"), 0, 0);
+ OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
ofn.lpstrFile = fname_buff;
ofn.nMaxFile = _countof(fname_buff);
diff --git a/plugins/Dbx_mdb/src/dbcontacts.cpp b/plugins/Dbx_mdb/src/dbcontacts.cpp index 48a911c459..921d116c24 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)
{
- CallService(MS_DB_MODULE_DELETE, cc->pSubs[nSub], (LPARAM)META_PROTO);
+ DbModule_Delete(cc->pSubs[nSub], META_PROTO);
return 0;
}
diff --git a/plugins/Folders/src/services.cpp b/plugins/Folders/src/services.cpp index 619723ec1b..59f91d0829 100644 --- a/plugins/Folders/src/services.cpp +++ b/plugins/Folders/src/services.cpp @@ -79,8 +79,8 @@ INT_PTR GetPathService(WPARAM wParam, LPARAM lParam) int InitServices()
{
- CallService(MS_DB_GETPROFILEPATHW, _countof(szCurrentProfilePath), (LPARAM)szCurrentProfilePath);
- CallService(MS_DB_GETPROFILENAMEW, _countof(szCurrentProfile), (LPARAM)szCurrentProfile);
+ Profile_GetPathW(_countof(szCurrentProfilePath), szCurrentProfilePath);
+ Profile_GetNameW(_countof(szCurrentProfile), szCurrentProfile);
wchar_t *pos = wcsrchr(szCurrentProfile, '.'); if (pos) *pos = 0;
GetModuleFileName(GetModuleHandleA("mir_app.mir"), szMirandaPath, _countof(szMirandaPath));
diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index 3fb5527318..3f52469e90 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -896,7 +896,7 @@ extern "C" __declspec(dllexport) int Load() return 1;
}
- if (CallService(MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)szPluginPath)) {
+ if (Profile_GetPathA(MAX_PATH, szPluginPath)) {
MessageBox(NULL, "Failed to retrieve plugin path.", MSG_BOX_TITEL, MB_OK);
return 1;
}
diff --git a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp index cd8fffbe8f..b634534e39 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp @@ -58,7 +58,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) date[0] = 0;
time[0] = 0;
- msg = DbGetEventTextW(dbei, CP_ACP);
+ msg = DbEvent_GetTextW(dbei, CP_ACP);
if (msg == NULL)
return 0;
@@ -383,7 +383,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc dbe.pBlob = (PBYTE)mir_alloc(dbe.cbBlob+1);
db_event_get(actualElement->hEvent, &dbe);
dbe.pBlob[dbe.cbBlob] = 0;
- LPTSTR msg = DbGetEventTextW(&dbe, CP_ACP);
+ LPTSTR msg = DbEvent_GetTextW(&dbe, CP_ACP);
if ( wcsstr(msg, searchString))
filter3 = 1;
@@ -617,7 +617,7 @@ void WriteMessage(HWND hDlg, LISTELEMENT *listStart, int actLinePos) dbe.pBlob = (PBYTE)mir_alloc(dbe.cbBlob+1);
db_event_get(hEvent, &dbe);
dbe.pBlob[dbe.cbBlob] = 0;
- LPCTSTR msg = DbGetEventTextW(&dbe, CP_ACP);
+ LPCTSTR msg = DbEvent_GetTextW(&dbe, CP_ACP);
SetDlgItemText(hDlg, IDC_MESSAGE, NULL);
SendDlgItemMessage(hDlg, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)msg);
mir_free((void*)msg);
diff --git a/plugins/HistoryPlusPlus/CustomizeToolbar.pas b/plugins/HistoryPlusPlus/CustomizeToolbar.pas index 3294a99d32..24bea5ae1e 100644 --- a/plugins/HistoryPlusPlus/CustomizeToolbar.pas +++ b/plugins/HistoryPlusPlus/CustomizeToolbar.pas @@ -335,7 +335,7 @@ begin if ToolbarStr = '' then
ToolbarStr := DEF_HISTORY_TOOLBAR;
if ToolbarStr = DEF_HISTORY_TOOLBAR then
- DBDeleteContactSetting(0, hppDBName, 'HistoryToolbar')
+ db_unset(0, hppDBName, 'HistoryToolbar')
else
WriteDBStr(hppDBName, 'HistoryToolbar', ToolbarStr);
end;
@@ -557,7 +557,7 @@ end; procedure TfmCustomizeToolbar.bnResetClick(Sender: TObject);
begin
- DBDeleteContactSetting(0, hppDBName, 'HistoryToolbar');
+ db_unset(0, hppDBName, 'HistoryToolbar');
NotifyAllForms(HM_NOTF_TOOLBARCHANGED, 0, 0);
FillButtons;
UpdateControlButtons;
diff --git a/plugins/HistoryPlusPlus/HistoryForm.pas b/plugins/HistoryPlusPlus/HistoryForm.pas index 2eed1dd124..ba0337d818 100644 --- a/plugins/HistoryPlusPlus/HistoryForm.pas +++ b/plugins/HistoryPlusPlus/HistoryForm.pas @@ -860,7 +860,7 @@ begin end
else
begin
- DBDeleteContactSetting(0, hppDBName, 'HistoryToolbar');
+ db_unset(0, hppDBName, 'HistoryToolbar');
LoadToolbar;
Exit;
end;
diff --git a/plugins/HistoryPlusPlus/hpp_contacts.pas b/plugins/HistoryPlusPlus/hpp_contacts.pas index e898d003f3..331efce404 100644 --- a/plugins/HistoryPlusPlus/hpp_contacts.pas +++ b/plugins/HistoryPlusPlus/hpp_contacts.pas @@ -152,7 +152,7 @@ begin Result := WideToAnsiString(dbv.szVal.w, hppCodepage);
end;
// free variant
- DBFreeVariant(@dbv);
+ db_free(@dbv);
end;
end;
end;
@@ -230,7 +230,7 @@ begin if Proto = '' then
exit;
case RTLMode of
- hppRTLDefault: DBDeleteContactSetting(hContact, PAnsiChar(Proto), 'RTL');
+ hppRTLDefault: db_unset(hContact, PAnsiChar(Proto), 'RTL');
hppRTLEnable: WriteDBByte(hContact, Proto, 'RTL', Byte(True));
hppRTLDisable: WriteDBByte(hContact, Proto, 'RTL', Byte(false));
end;
diff --git a/plugins/HistoryPlusPlus/hpp_database.pas b/plugins/HistoryPlusPlus/hpp_database.pas index 38f307c6ed..ead338fb9c 100644 --- a/plugins/HistoryPlusPlus/hpp_database.pas +++ b/plugins/HistoryPlusPlus/hpp_database.pas @@ -118,7 +118,7 @@ var begin
Result := (db_get(hContact, PAnsiChar(Module), PAnsiChar(Param), @dbv) = 0);
if Result then
- DBFreeVariant(@dbv);
+ db_free(@dbv);
end;
function DBDelete(const Module, Param: AnsiString): Boolean;
@@ -128,7 +128,7 @@ end; function DBDelete(const hContact: THandle; const Module, Param: AnsiString): Boolean;
begin
- Result := (DBDeleteContactSetting(hContact,PAnsiChar(Module),PAnsiChar(Param)) = 0);
+ Result := (db_unset(hContact,PAnsiChar(Module),PAnsiChar(Param)) = 0);
end;
function WriteDBBool(const Module,Param: AnsiString; Value: Boolean): Integer;
@@ -148,7 +148,7 @@ end; function WriteDBByte(const hContact: THandle; const Module,Param: AnsiString; Value: Byte): Integer;
begin
- Result := DBWriteContactSettingByte(hContact,PAnsiChar(Module), PAnsiChar(Param), Value);
+ Result := db_set_b(hContact,PAnsiChar(Module), PAnsiChar(Param), Value);
end;
function WriteDBWord(const Module,Param: AnsiString; Value: Word): Integer;
@@ -158,7 +158,7 @@ end; function WriteDBWord(const hContact: THandle; const Module,Param: AnsiString; Value: Word): Integer;
begin
- Result := DBWriteContactSettingWord(hContact,PAnsiChar(Module),PAnsiChar(Param),Value);
+ Result := db_set_w(hContact,PAnsiChar(Module),PAnsiChar(Param),Value);
end;
function WriteDBDWord(const Module,Param: AnsiString; Value: DWord): Integer;
@@ -168,7 +168,7 @@ end; function WriteDBDWord(const hContact: THandle; const Module,Param: AnsiString; Value: DWord): Integer;
begin
- Result := DBWriteContactSettingDWord(hContact,PAnsiChar(Module),PAnsiChar(Param),Value);
+ Result := db_set_dw(hContact,PAnsiChar(Module),PAnsiChar(Param),Value);
end;
function WriteDBInt(const Module,Param: AnsiString; Value: Integer): Integer;
@@ -188,7 +188,7 @@ end; function WriteDBStr(const hContact: THandle; const Module,Param: AnsiString; const Value: AnsiString): Integer;
begin
- Result := DBWriteContactSettingString(hContact,PAnsiChar(Module),PAnsiChar(Param),PAnsiChar(Value));
+ Result := db_set_s(hContact,PAnsiChar(Module),PAnsiChar(Param),PAnsiChar(Value));
end;
function WriteDBWideStr(const Module,Param: AnsiString; const Value: WideString): Integer;
@@ -247,7 +247,7 @@ begin if dbv.cpbVal = 0 then exit;
GetMem(Value,dbv.cpbVal);
Move(dbv.pbVal^,PByte(Value)^,dbv.cpbVal);
- DBFreeVariant(@dbv);
+ db_free(@dbv);
Result := True;
end;
@@ -268,7 +268,7 @@ end; function GetDBByte(const hContact: THandle; const Module,Param: AnsiString; Default: Byte): Byte;
begin
- Result := DBGetContactSettingByte(hContact,PAnsiChar(Module),PAnsiChar(Param),Default);
+ Result := db_get_b(hContact,PAnsiChar(Module),PAnsiChar(Param),Default);
end;
function GetDBWord(const Module,Param: AnsiString; Default: Word): Word;
@@ -278,7 +278,7 @@ end; function GetDBWord(const hContact: THandle; const Module,Param: AnsiString; Default: Word): Word;
begin
- Result := DBGetContactSettingWord(hContact,PAnsiChar(Module),PAnsiChar(Param),Default);
+ Result := db_get_w(hContact,PAnsiChar(Module),PAnsiChar(Param),Default);
end;
function GetDBDWord(const Module,Param: AnsiString; Default: DWord): DWord;
@@ -288,7 +288,7 @@ end; function GetDBDWord(const hContact: THandle; const Module,Param: AnsiString; Default: DWord): DWord;
begin
- Result := DBGetContactSettingDWord(hContact,PAnsiChar(Module),PAnsiChar(Param),Default);
+ Result := db_get_dw(hContact,PAnsiChar(Module),PAnsiChar(Param),Default);
end;
function GetDBInt(const Module,Param: AnsiString; Default: Integer): Integer;
@@ -337,7 +337,7 @@ begin Result := WideToAnsiString(dbv.szVal.w,hppCodepage);
end;
// free variant
- DBFreeVariant(@dbv);
+ db_free(@dbv);
end;
end;
@@ -367,7 +367,7 @@ begin Result := WideString(dbv.szVal.w);
end;
// free variant
- DBFreeVariant(@dbv);
+ db_free(@dbv);
end;
end;
diff --git a/plugins/HistoryPlusPlus/hpp_itemprocess.pas b/plugins/HistoryPlusPlus/hpp_itemprocess.pas index 858bd2daa5..55518c0f41 100644 --- a/plugins/HistoryPlusPlus/hpp_itemprocess.pas +++ b/plugins/HistoryPlusPlus/hpp_itemprocess.pas @@ -479,7 +479,7 @@ begin begin
// Get profile dir
SetLength(hppProfileDir, MAX_PATH);
- CallService(MS_DB_GETPROFILEPATH, MAX_PATH, lParam(@hppProfileDir[1]));
+ Profile_GetPathA(MAX_PATH, @hppProfileDir[1]);
SetLength(hppProfileDir, StrLen(pAnsiChar(@hppProfileDir[1])));
Link := AnsiString(hppProfileDir) + '\' + ird.pExtended; //!!
end;
diff --git a/plugins/HistoryStats/src/mu_common.cpp b/plugins/HistoryStats/src/mu_common.cpp index ef5bfc66e2..d941c7c1c1 100644 --- a/plugins/HistoryStats/src/mu_common.cpp +++ b/plugins/HistoryStats/src/mu_common.cpp @@ -44,28 +44,6 @@ namespace mu }
/*
- * db
- */
-
- namespace db
- {
- int getProfilePath(int cbName, wchar_t* pszName)
- {
- return CallService(MS_DB_GETPROFILEPATHW, cbName, reinterpret_cast<LPARAM>(pszName));
- }
-
- int getProfileName(int cbName, wchar_t* pszName)
- {
- return CallService(MS_DB_GETPROFILENAMEW, cbName, reinterpret_cast<LPARAM>(pszName));
- }
-
- void setSafetyMode(bool safetyMode)
- {
- CallService(MS_DB_SETSAFETYMODE, BOOL_(safetyMode), 0);
- }
- }
-
- /*
* db_time
*/
diff --git a/plugins/HistoryStats/src/mu_common.h b/plugins/HistoryStats/src/mu_common.h index cc82ea61da..e8d407e928 100644 --- a/plugins/HistoryStats/src/mu_common.h +++ b/plugins/HistoryStats/src/mu_common.h @@ -18,24 +18,12 @@ namespace mu }
/*
- * db
- */
-
- namespace db
- {
- int getProfilePath(int cbName, wchar_t* pszName);
- int getProfileName(int cbName, wchar_t* pszName);
- void setSafetyMode(bool safetyMode);
- }
-
- /*
* db_contact
*/
namespace db_contact
{
int enumSettings(MCONTACT hContact, const char* szModule, DBSETTINGENUMPROC pEnumProc, LPARAM lProcParam);
- int getCount();
}
/*
diff --git a/plugins/HistoryStats/src/utils.cpp b/plugins/HistoryStats/src/utils.cpp index bc1c1f272b..7c2d0f3a93 100644 --- a/plugins/HistoryStats/src/utils.cpp +++ b/plugins/HistoryStats/src/utils.cpp @@ -909,7 +909,7 @@ namespace utils if (strProfilePath.empty()) {
wchar_t szPath[MAX_PATH] = { 0 };
- mu::db::getProfilePath(MAX_PATH, szPath);
+ Profile_GetPathW(MAX_PATH, szPath);
strProfilePath = szPath;
if (strProfilePath.empty() || strProfilePath[strProfilePath.length() - 1] != '\\')
@@ -928,7 +928,7 @@ namespace utils if (strProfileName.empty()) {
wchar_t szName[MAX_PATH] = { 0 };
- mu::db::getProfileName(MAX_PATH, szName);
+ Profile_GetNameW(MAX_PATH, szName);
strProfileName = szName;
ext::string::size_type posDot = strProfileName.rfind('.');
diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp index 8dd3337a13..6e6b4bf3c9 100644 --- a/plugins/IEView/src/HTMLBuilder.cpp +++ b/plugins/IEView/src/HTMLBuilder.cpp @@ -283,7 +283,7 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) eventData->bIsMe = FALSE;
}
if (dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_URL || Utils::DbEventIsForMsgWindow(&dbei)) {
- eventData->pszTextW = DbGetEventTextW(&dbei, newEvent.codepage);
+ eventData->pszTextW = DbEvent_GetTextW(&dbei, newEvent.codepage);
if (dbei.eventType == EVENTTYPE_MESSAGE)
eventData->iType = IEED_EVENT_MESSAGE;
else if (dbei.eventType == EVENTTYPE_URL)
@@ -295,25 +295,25 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) //blob is: sequenceid(DWORD),filename(ASCIIZ),description(ASCIIZ)
char* filename = ((char *)dbei.pBlob) + sizeof(DWORD);
char* descr = filename + mir_strlen(filename) + 1;
- eventData->ptszText = DbGetEventStringT(&dbei, filename);
+ eventData->ptszText = DbEvent_GetString(&dbei, filename);
if (*descr != '\0')
- eventData->ptszText2 = DbGetEventStringT(&dbei, descr);
+ eventData->ptszText2 = DbEvent_GetString(&dbei, descr);
eventData->iType = IEED_EVENT_FILE;
}
else if (dbei.eventType == EVENTTYPE_AUTHREQUEST) {
//blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ)
eventData->ptszText = mir_wstrdup(TranslateT(" requested authorization"));
- eventData->ptszNick = DbGetEventStringT(&dbei, (char *)dbei.pBlob + 8);
+ eventData->ptszNick = DbEvent_GetString(&dbei, (char *)dbei.pBlob + 8);
eventData->iType = IEED_EVENT_SYSTEM;
}
else if (dbei.eventType == EVENTTYPE_ADDED) {
//blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ)
eventData->ptszText = mir_wstrdup(TranslateT(" was added."));
- eventData->ptszNick = DbGetEventStringT(&dbei, (char *)dbei.pBlob + 8);
+ eventData->ptszNick = DbEvent_GetString(&dbei, (char *)dbei.pBlob + 8);
eventData->iType = IEED_EVENT_SYSTEM;
}
else { // custom event
- eventData->pszTextW = DbGetEventTextW(&dbei, newEvent.codepage);
+ eventData->pszTextW = DbEvent_GetTextW(&dbei, newEvent.codepage);
eventData->iType = IEED_EVENT_MESSAGE;
}
free(dbei.pBlob);
diff --git a/plugins/IEView/src/Utils.cpp b/plugins/IEView/src/Utils.cpp index 009c01a19e..2a7e48a0e3 100644 --- a/plugins/IEView/src/Utils.cpp +++ b/plugins/IEView/src/Utils.cpp @@ -118,12 +118,12 @@ void Utils::appendIcon(CMStringA &str, const char *iconFile) bool Utils::DbEventIsForMsgWindow(DBEVENTINFO *dbei)
{
- DBEVENTTYPEDESCR *et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
+ DBEVENTTYPEDESCR *et = DbEvent_GetType(dbei->szModule, dbei->eventType);
return et && (et->flags & DETF_MSGWINDOW);
}
bool Utils::DbEventIsForHistory(DBEVENTINFO *dbei)
{
- DBEVENTTYPEDESCR *et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
+ DBEVENTTYPEDESCR *et = DbEvent_GetType(dbei->szModule, dbei->eventType);
return et && (et->flags & DETF_HISTORY);
}
\ No newline at end of file diff --git a/plugins/ImportTXT/General.pas b/plugins/ImportTXT/General.pas index f68486afac..0a53d03ffc 100644 --- a/plugins/ImportTXT/General.pas +++ b/plugins/ImportTXT/General.pas @@ -342,11 +342,6 @@ begin result := Proto_GetProtoName(hContact);
end;
-function DBFreeVariant(dbv: PDBVARIANT): integer;
-begin
- result := db_free(dbv);
-end;
-
function GetContactID(hContact: THandle; proto: AnsiString = '';
Contact: boolean = false): WideString;
var
@@ -387,7 +382,7 @@ begin result := dbv.szVal.w;
end;
// free variant
- DBFreeVariant(@dbv);
+ db_free(@dbv);
end;
end;
end;
@@ -429,7 +424,7 @@ begin result := dbv.szVal.w;
end;
// free variant
- DBFreeVariant(@dbv);
+ db_free(@dbv);
end;
end;
end;
diff --git a/plugins/KeyboardNotify/src/utils.cpp b/plugins/KeyboardNotify/src/utils.cpp index 1c4920c876..399ecafe31 100644 --- a/plugins/KeyboardNotify/src/utils.cpp +++ b/plugins/KeyboardNotify/src/utils.cpp @@ -34,11 +34,9 @@ char *fmtDBSettingName(const char *fmt, ...) wchar_t *getAbsoluteProfileName(wchar_t *absoluteProfileName, size_t maxLen)
{
wchar_t profilePath[MAX_PATH+1], profileName[MAX_PATH+1];
+ Profile_GetPathW(MAX_PATH, profilePath);
+ Profile_GetNameW(MAX_PATH, profileName);
- profilePath[0] = profileName[0] = '\0';
- CallService(MS_DB_GETPROFILEPATHW, MAX_PATH, (LPARAM)profilePath);
- CallService(MS_DB_GETPROFILENAMEW, MAX_PATH, (LPARAM)profileName);
mir_snwprintf(absoluteProfileName, maxLen, L"%s\\%s", profilePath, profileName);
-
return absoluteProfileName;
}
diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp index 7a9a5e54b1..93587d2d66 100644 --- a/plugins/MirFox/src/MirandaUtils.cpp +++ b/plugins/MirFox/src/MirandaUtils.cpp @@ -52,7 +52,7 @@ std::wstring& MirandaUtils::getProfileName() }
wchar_t mirandaProfileNameW[128] = {0};
- CallService(MS_DB_GETPROFILENAMEW, _countof(mirandaProfileNameW), (WPARAM)mirandaProfileNameW);
+ Profile_GetNameW(_countof(mirandaProfileNameW), mirandaProfileNameW);
profileName.append(mirandaProfileNameW);
return profileName;
@@ -527,6 +527,6 @@ void MirandaUtils::translateOldDBNames() { }
//delete db module
- CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)OLD_PLUGIN_DB_ID);
+ DbModule_Delete(0, OLD_PLUGIN_DB_ID);
}
diff --git a/plugins/MirLua/src/m_database.cpp b/plugins/MirLua/src/m_database.cpp index 5f5ea774d0..3a747f45aa 100644 --- a/plugins/MirLua/src/m_database.cpp +++ b/plugins/MirLua/src/m_database.cpp @@ -376,7 +376,7 @@ static int db_DeleteModule(lua_State *L) MCONTACT hContact = lua_tointeger(L, 1);
LPCSTR szModule = luaL_checkstring(L, 2);
- INT_PTR res = CallService(MS_DB_MODULE_DELETE, hContact, (LPARAM)szModule);
+ INT_PTR res = DbModule_Delete(hContact, szModule);
lua_pushboolean(L, !res);
return 1;
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index 74bc251e71..6deb7aaccb 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -468,9 +468,9 @@ bool bReadMirandaDirAndPath() PathToAbsoluteW(L"miranda32.exe", tmp);
sMirandaPath = tmp;
sMirandaPath.erase(sMirandaPath.find_last_of(L"\\"));
- CallService(MS_DB_GETPROFILEPATHW, (WPARAM)MAX_PATH - 1, (LPARAM)szDBPath);
+ Profile_GetPathW(MAX_PATH, szDBPath);
sDBPath = szDBPath;
- CallService(MS_DB_GETPROFILENAMEW, (WPARAM)MAX_PATH - 1, (LPARAM)szDBPath);
+ Profile_GetNameW(MAX_PATH, szDBPath);
sDBPath.append(L"\\").append(szDBPath);
sDBPath.erase(sDBPath.size() - 4);
return true;
@@ -1013,7 +1013,7 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) switch (dbei.eventType) {
case EVENTTYPE_MESSAGE:
{
- wchar_t *msg = DbGetEventTextW(&dbei, CP_ACP);
+ wchar_t *msg = DbEvent_GetTextW(&dbei, CP_ACP);
if (!bWriteIndentedToFile(hFile, nIndent, msg, bWriteUTF8Format)) {
DisplayErrorDialog(LPGENW("Failed to write message to the file :\n"), sFilePath, &dbei);
}
diff --git a/plugins/NewEventNotify/src/main.cpp b/plugins/NewEventNotify/src/main.cpp index 85fa3f1e9a..275372ef71 100644 --- a/plugins/NewEventNotify/src/main.cpp +++ b/plugins/NewEventNotify/src/main.cpp @@ -70,12 +70,10 @@ int HookedNewEvent(WPARAM hContact, LPARAM hDbEvent) return 0;
//custom database event types
- if (ServiceExists(MS_DB_EVENT_GETTYPE)) {
- DBEVENTTYPEDESCR *pei = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbe.szModule, (LPARAM)dbe.eventType);
- // ignore events according to flags
- if (pei && pei->flags & DETF_NONOTIFY)
- return 0;
- }
+ DBEVENTTYPEDESCR *pei = DbEvent_GetType(dbe.szModule, dbe.eventType);
+ // ignore events according to flags
+ if (pei && pei->flags & DETF_NONOTIFY)
+ return 0;
//if event was allready read don't show it
if (pluginOptions.bReadCheck && (dbe.flags & DBEF_READ))
diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index 219a65bee2..466cbf0661 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -369,29 +369,20 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) break;
default:
- if (ServiceExists(MS_DB_EVENT_GETTYPE)) {
- DBEVENTTYPEDESCR *pei = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
- // support for custom database event types
- if (pei && dbei->pBlob) {
- DBEVENTGETTEXT svc = {dbei, DBVT_WCHAR, CP_ACP};
- wchar_t *pet = (wchar_t*)CallService(MS_DB_EVENT_GETTEXT, 0, (LPARAM)&svc);
- if (pet) {
- // we've got event text, move to our memory space
- comment1 = mir_wstrdup(pet);
- mir_free(pet);
- }
- commentFix = pei->descr;
- }
- else commentFix = POPUP_COMMENT_OTHER;
+ DBEVENTTYPEDESCR *pei = DbEvent_GetType(dbei->szModule, dbei->eventType);
+ // support for custom database event types
+ if (pei && dbei->pBlob) {
+ comment1 = DbEvent_GetTextW(dbei, CP_ACP);
+ commentFix = pei->descr;
}
else commentFix = POPUP_COMMENT_OTHER;
}
- if ( mir_wstrlen(comment1) > 0) {
+ if (mir_wstrlen(comment1) > 0) {
mir_free(comment2);
return comment1;
}
- if ( mir_wstrlen(comment2) > 0) {
+ if (mir_wstrlen(comment2) > 0) {
mir_free(comment1);
return comment2;
}
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 98b5a307e4..8b559d2098 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -1183,7 +1183,7 @@ extern "C" int __declspec(dllexport) Load(void) evtype.descr = LPGEN("Status change");
evtype.eventIcon = iconList[0].hIcolib;
evtype.flags = DETF_HISTORY | DETF_MSGWINDOW;
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&evtype);
+ DbEvent_RegisterType(&evtype);
hServiceMenu = CreateServiceFunction(MS_STATUSCHANGE_MENUCOMMAND, EnableDisableMenuCommand);
diff --git a/plugins/NotifyAnything/src/options.cpp b/plugins/NotifyAnything/src/options.cpp index 377be8ac3a..8b26054f6f 100644 --- a/plugins/NotifyAnything/src/options.cpp +++ b/plugins/NotifyAnything/src/options.cpp @@ -66,7 +66,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara ofn.lpstrFilter = TranslateT("Log (*.log)\0*.log\0Text (*.txt)\0*.txt\0All Files (*.*)\0*.*\0");
ofn.nFilterIndex = 1;
// Use profile directory as default, if path is not specified
- CallService(MS_DB_GETPROFILEPATHW, (WPARAM)MAX_PATH, (LPARAM)szProfileDir);
+ Profile_GetPathW(MAX_PATH, szProfileDir);
ofn.lpstrInitialDir = szProfileDir;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrDefExt = L"log";
diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index f2c6a65a91..79b8a2f80c 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -354,7 +354,7 @@ extern "C" int __declspec(dllexport) Load(void) evtype.descr = LPGEN("Nudge");
evtype.eventIcon = iconList[0].hIcolib;
evtype.flags = DETF_HISTORY | DETF_MSGWINDOW;
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&evtype);
+ DbEvent_RegisterType(&evtype);
return 0;
}
diff --git a/plugins/Ping/src/log.cpp b/plugins/Ping/src/log.cpp index ef50c5cb0b..6d1a2a9767 100644 --- a/plugins/Ping/src/log.cpp +++ b/plugins/Ping/src/log.cpp @@ -33,7 +33,7 @@ INT_PTR GetLogFilename(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv;
wchar_t *filename = (wchar_t *)lParam;
if (db_get_ws(0, PLUG, "LogFilename", &dbv)) {
- CallService(MS_DB_GETPROFILEPATHW, wParam, (LPARAM)filename);
+ Profile_GetPathW(wParam, filename);
mir_wstrncat(filename, L"\\ping_log.txt", wParam - mir_wstrlen(filename));
}
else {
diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp index a9763b64fd..05e81a89b7 100644 --- a/plugins/Popup/src/config.cpp +++ b/plugins/Popup/src/config.cpp @@ -158,7 +158,7 @@ static void CopyModule(const char *szModule, const char *szNewModule) dbces.lParam = (LPARAM)¶m;
CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
- CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szModule);
+ DbModule_Delete(0, szModule);
}
void UpgradeDb()
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index c8649ee804..8962d354fe 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -1670,7 +1670,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
db_event_get(dat->hDbEventLast, &dbei);
if (DbEventIsMessageOrCustom(&dbei)) {
- buffer = DbGetEventTextW(&dbei, CP_ACP);
+ buffer = DbEvent_GetTextW(&dbei, CP_ACP);
if (buffer != NULL) {
wchar_t *quotedBuffer = GetQuotedTextW(buffer);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)quotedBuffer);
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 129ad0818a..be1a850a03 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -85,7 +85,7 @@ struct LogStreamData int DbEventIsCustomForMsgWindow(DBEVENTINFO *dbei)
{
- DBEVENTTYPEDESCR *et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
+ DBEVENTTYPEDESCR *et = DbEvent_GetType(dbei->szModule, dbei->eventType);
return et && (et->flags & DETF_MSGWINDOW);
}
@@ -151,11 +151,11 @@ EventData* getEventFromDB(SrmmWindowData *dat, MCONTACT hContact, MEVENT hDbEven if (evt->eventType == EVENTTYPE_FILE) {
char *filename = ((char*)dbei.pBlob) + sizeof(DWORD);
char *descr = filename + mir_strlen(filename) + 1;
- evt->pszTextT = DbGetEventStringT(&dbei, filename);
+ evt->pszTextT = DbEvent_GetString(&dbei, filename);
if (*descr != 0)
- evt->pszText2T = DbGetEventStringT(&dbei, descr);
+ evt->pszText2T = DbEvent_GetString(&dbei, descr);
}
- else evt->pszTextT = DbGetEventTextW(&dbei, CP_UTF8);
+ else evt->pszTextT = DbEvent_GetTextW(&dbei, CP_UTF8);
if (!(dat->flags & SMF_RTL) && RTL_Detect(evt->pszTextT))
evt->dwFlags |= IEEDF_RTL;
diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp index fafaf732ed..6f9475c6e8 100644 --- a/plugins/ShellExt/src/shlcom.cpp +++ b/plugins/ShellExt/src/shlcom.cpp @@ -425,7 +425,7 @@ void __stdcall ipcService(ULONG_PTR) if (pct != NULL) {
// will actually return with .dat if there's space for it, not what the docs say
pct->Status = STATUS_PROFILENAME;
- CallService(MS_DB_GETPROFILENAME, 49, UINT_PTR(pct) + sizeof(TSlotIPC));
+ Profile_GetNameA(49, (char*)pct + sizeof(TSlotIPC));
}
}
if (*bits & REQUEST_NEWICONS)
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index f85ad9bed1..36124651a1 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: - CallService(MS_DB_MODULE_DELETE, NULL, LPARAM("TabSRMM_Toolbar")); + DbModule_Delete(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 0694e9f815..aa1d32a4fd 100644 --- a/plugins/TabSRMM/src/chat/main.cpp +++ b/plugins/TabSRMM/src/chat/main.cpp @@ -242,7 +242,7 @@ static void CheckUpdate() mir_free(p);
}
- CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)CHAT_OLDFONTMODULE);
+ DbModule_Delete(NULL, CHAT_OLDFONTMODULE);
compat++;
}
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 9c552aaaa9..ed7cc7618a 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -421,7 +421,7 @@ static wchar_t* ShortenPreview(DBEVENTINFO* dbe) if (iPreviewLimit > 500 || iPreviewLimit == 0)
iPreviewLimit = 500;
- wchar_t *buf = DbGetEventTextW(dbe, CP_ACP);
+ wchar_t *buf = DbEvent_GetTextW(dbe, CP_ACP);
if (mir_wstrlen(buf) > iPreviewLimit) {
fAddEllipsis = true;
size_t iIndex = iPreviewLimit;
@@ -462,11 +462,11 @@ static wchar_t* GetPreviewT(WORD eventType, DBEVENTINFO* dbe) if (dbe->cbBlob > (sizeof(DWORD) + namelength + 1))
szDescr = szFileName + namelength + 1;
- ptrW tszFileName(DbGetEventStringT(dbe, szFileName));
+ ptrW tszFileName(DbEvent_GetString(dbe, szFileName));
wchar_t buf[1024];
if (szDescr && Utils::safe_strlen(szDescr, dbe->cbBlob - sizeof(DWORD) - namelength - 1) > 0) {
- ptrW tszDescr(DbGetEventStringT(dbe, szDescr));
+ ptrW tszDescr(DbEvent_GetString(dbe, szDescr));
if (tszFileName && tszDescr) {
mir_snwprintf(buf, L"%s: %s (%s)", TranslateT("Incoming file"), tszFileName, tszDescr);
return mir_wstrdup(buf);
@@ -591,7 +591,7 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, MCONTACT hContact, MEVENT hEve break;
default:
- pud.lchIcon = (HICON)CallService(MS_DB_EVENT_GETICON, LR_SHARED, (LPARAM)&dbe);
+ pud.lchIcon = DbEvent_GetIcon(&dbe, LR_SHARED);
pud.colorBack = pluginOptions->bDefaultColorOthers ? 0 : pluginOptions->colBackOthers;
pud.colorText = pluginOptions->bDefaultColorOthers ? 0 : pluginOptions->colTextOthers;
iSeconds = pluginOptions->iDelayOthers;
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 6f0a78a476..eda978011e 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -387,7 +387,7 @@ int TSAPI DbEventIsShown(DBEVENTINFO *dbei) int DbEventIsForMsgWindow(DBEVENTINFO *dbei)
{
- DBEVENTTYPEDESCR *et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
+ DBEVENTTYPEDESCR *et = DbEvent_GetType(dbei->szModule, dbei->eventType);
return et && (et->flags & DETF_MSGWINDOW);
}
@@ -420,7 +420,7 @@ static char* Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact, dat->cache->updateStats(TSessionStats::SET_LAST_RCV, mir_strlen((char *)dbei.pBlob));
wchar_t *formatted = NULL;
- wchar_t *msg = DbGetEventTextW(&dbei, CP_UTF8);
+ wchar_t *msg = DbEvent_GetTextW(&dbei, CP_UTF8);
if (!msg) {
mir_free(dbei.pBlob);
return NULL;
@@ -824,11 +824,11 @@ static char* Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact, }
{
char *szFileName = (char *)dbei.pBlob + sizeof(DWORD);
- ptrW tszFileName(DbGetEventStringT(&dbei, szFileName));
+ ptrW tszFileName(DbEvent_GetString(&dbei, szFileName));
char *szDescr = szFileName + mir_strlen(szFileName) + 1;
if (*szDescr != 0) {
- ptrW tszDescr(DbGetEventStringT(&dbei, szDescr));
+ ptrW tszDescr(DbEvent_GetString(&dbei, szDescr));
wchar_t buf[1000];
mir_snwprintf(buf, L"%s (%s)", tszFileName, tszDescr);
@@ -844,7 +844,7 @@ static char* Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact, str.AppendChar(' ');
}
- ptrW tszText(DbGetEventTextW(&dbei, CP_ACP));
+ ptrW tszText(DbEvent_GetTextW(&dbei, CP_ACP));
AppendUnicodeToBuffer(str, tszText, 0);
}
break;
diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index 750f006ed3..d744568995 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -119,7 +119,7 @@ int _DebugTraceW(const wchar_t *fmt, ...) char szLogFileName[MAX_PATH], szDataPath[MAX_PATH]; FILE *f; - CallService(MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)szDataPath); + Profile_GetPathA(MAX_PATH, szDataPath); mir_snprintf(szLogFileName, "%s\\%s", szDataPath, "tabsrmm_debug.log"); f = fopen(szLogFileName, "a+"); if (f) { diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index a68dae28fa..fe25c8d43c 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -173,7 +173,7 @@ wchar_t* GetLastMessageText(MCONTACT hContact, bool received) if (dbei.cbBlob == 0 || dbei.pBlob == 0) return 0; - wchar_t *buff = DbGetEventTextW( &dbei, CP_ACP ); + wchar_t *buff = DbEvent_GetTextW( &dbei, CP_ACP ); wchar_t *swzMsg = mir_wstrdup(buff); mir_free(buff); diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp index 36886e384f..466ad2a89c 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp @@ -69,7 +69,7 @@ static void InitAlteredPlacesBar() }
// Miranda's profile path
- if (!CallService(MS_DB_GETPROFILEPATH, _countof(szProfilePath), (LPARAM)szProfilePath))
+ if (!Profile_GetPathA(_countof(szProfilePath), szProfilePath))
{
// only add if different from profile path
RegSetValueExA(hkPlacesBar, "Place4", 0, REG_SZ, (PBYTE)szProfilePath, (DWORD)mir_strlen(szProfilePath) + 1);
diff --git a/plugins/UserInfoEx/src/svc_avatar.cpp b/plugins/UserInfoEx/src/svc_avatar.cpp index 9f26ba8a6a..bf510a731b 100644 --- a/plugins/UserInfoEx/src/svc_avatar.cpp +++ b/plugins/UserInfoEx/src/svc_avatar.cpp @@ -29,7 +29,7 @@ namespace NServices static int GetContactAvatarFileName(LPCTSTR zodiac, LPSTR szFileName, int cchFileName)
{
- if (!CallService(MS_DB_GETPROFILEPATH, (WPARAM)cchFileName, (LPARAM)szFileName)) {
+ if (!Profile_GetPathA(cchFileName, szFileName)) {
size_t len = mir_strlen(szFileName);
CHAR tmp[64];
diff --git a/plugins/Utils.pas/dbsettings.pas b/plugins/Utils.pas/dbsettings.pas index 8106fd7e66..df2b28aa22 100644 --- a/plugins/Utils.pas/dbsettings.pas +++ b/plugins/Utils.pas/dbsettings.pas @@ -32,7 +32,7 @@ function DBWriteString (hContact:TMCONTACT;szModule:PAnsiChar;szSetting:PAnsiCha function DBWriteUTF8 (hContact:TMCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:PAnsiChar):int_ptr;
function DBWriteUnicode(hContact:TMCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:PWideChar):int_ptr;
-//function DBFreeVariant(dbv:PDBVARIANT):int_ptr;
+//function db_free(dbv:PDBVARIANT):int_ptr;
function DBDeleteSetting(hContact:TMCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):int_ptr;
function DBDeleteGroup(hContact:TMCONTACT;szModule:PAnsiChar;prefix:PAnsiChar=nil):int_ptr;
@@ -87,7 +87,7 @@ begin else
result:=StrLen(dbv.szVal.a);
- DBFreeVariant(@dbv);
+ db_free(@dbv);
end;
function DBReadString(hContact:TMCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;
@@ -106,7 +106,7 @@ begin else
StrDup(result,default);
- DBFreeVariant(@dbv);
+ db_free(@dbv);
end;
function DBReadUTF8(hContact:TMCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:PAnsiChar=nil):PAnsiChar;
@@ -130,7 +130,7 @@ begin else
StrDupW(result,default);
- DBFreeVariant(@dbv);
+ db_free(@dbv);
end;
function DBReadStruct(hContact:TMCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;
@@ -147,7 +147,7 @@ begin if ptr=nil then
mGetMem(ptr,size);
move(dbv.pbVal^,ptr^,size);
- DBFreeVariant(@dbv);
+ db_free(@dbv);
result:=uint_ptr(ptr)
end
else
@@ -328,7 +328,7 @@ begin if DBReadSetting(hContact,szModule,szSetting,@ldbv)=0 then
begin
result:=ldbv._type;
- DBFreeVariant(@ldbv);
+ db_free(@ldbv);
end
else
result:=DBVT_DELETED;
diff --git a/plugins/Utils.pas/mircontacts.pas b/plugins/Utils.pas/mircontacts.pas index 0863c0cd35..cb87d93b5a 100644 --- a/plugins/Utils.pas/mircontacts.pas +++ b/plugins/Utils.pas/mircontacts.pas @@ -131,9 +131,9 @@ begin uid := PAnsiChar(CallProtoService(Proto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0));
if (uid <> PAnsiChar(CALLSERVICE_NOTFOUND)) and (uid <> nil) then
begin
- // DBGetContactSettingStr comparing to DBGetContactSetting don't translate strings
+ // db_get_s comparing to DBGetContactSetting don't translate strings
// when uType=0 (DBVT_ASIS)
- if DBGetContactSettingStr(hContact, Proto, uid, @dbv, DBVT_ASIS) = 0 then
+ if db_get_s(hContact, Proto, uid, @dbv, DBVT_ASIS) = 0 then
begin
case dbv._type of
DBVT_BYTE: StrDup(Result, IntToStr(buf,dbv.bVal));
@@ -150,7 +150,7 @@ begin end;
end;
// free variant
- DBFreeVariant(@dbv);
+ db_free(@dbv);
end;
end;
end;
@@ -315,7 +315,7 @@ begin end;
end;
end;
- DBFreeVariant(@ldbv);
+ db_free(@ldbv);
end;
end;
// added 2011.04.20
@@ -344,7 +344,7 @@ begin mFreeMem(Proto);
if not is_chat then
- DBFreeVariant(@dbv)
+ db_free(@dbv)
else
mFreeMem(dbv.szVal.W);
end;
@@ -378,7 +378,7 @@ begin if DBReadSetting(hContact,Proto,uid,@cws)=0 then
begin
StrCopy(p,opt_cuid); DBWriteSetting(0,group,section,@cws);
- DBFreeVariant(@cws);
+ db_free(@cws);
result:=1;
end;
end;
@@ -613,7 +613,7 @@ begin StrReplaceW(buf,'%uid%',p);
if ldbv._type in [DBVT_UTF8,DBVT_ASCIIZ] then
mFreeMem(p);
- DBFreeVariant(@ldbv);
+ db_free(@ldbv);
end;
end;
StrReplaceW(buf,'%uid%',nil);
diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas index dee3bbdc87..bbedeb252b 100644 --- a/plugins/Utils.pas/mirutils.pas +++ b/plugins/Utils.pas/mirutils.pas @@ -299,7 +299,7 @@ var altfilename,filename:array [0..127] of AnsiChar;
p:PAnsiChar;
begin
- CallService(MS_DB_GETPROFILEPATH,300,lparam(@profilepath));
+ Profile_GetPathA(300,@profilepath);
p:=StrEnd(profilepath);
p^:='\'; inc(p);
p^:=#0;
@@ -309,7 +309,7 @@ begin begin
StrCopy(filename,prefix);
p:=StrEnd(filename);
- CallService(MS_DB_GETPROFILENAME,SizeOf(filename)-integer(p-PAnsiChar(@filename)),lparam(p));
+ Profile_GetNameA(Sizeof(filename)-integer(p-PAnsiChar(@filename)),p);
ChangeExt(filename,ext);
result:=CheckPath(filename,profilepath,path);
end
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index 72493df3da..243d3f8789 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -126,7 +126,7 @@ static wchar_t* parseDBProfileName(ARGUMENTSINFO *ai) return NULL;
wchar_t name[MAX_PATH];
- if (CallService(MS_DB_GETPROFILENAMEW, _countof(name), (LPARAM)name))
+ if (Profile_GetNameW(_countof(name), name))
return NULL;
return mir_wstrdup(name);
@@ -138,9 +138,7 @@ static wchar_t* parseDBProfilePath(ARGUMENTSINFO *ai) return NULL;
wchar_t path[MAX_PATH];
- if (CallService(MS_DB_GETPROFILEPATHW, _countof(path), (LPARAM)path))
- return NULL;
-
+ Profile_GetPathW(_countof(path), path);
return mir_wstrdup(path);
}
@@ -579,7 +577,7 @@ static wchar_t* parseDbEvent(ARGUMENTSINFO *ai) return NULL;
}
- wchar_t *res = DbGetEventTextW(&dbe, CP_ACP);
+ wchar_t *res = DbEvent_GetTextW(&dbe, CP_ACP);
mir_free(dbe.pBlob);
return res;
}
diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index 251ba8ca03..33498fe920 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -62,7 +62,7 @@ static void GetProfileDirectory(wchar_t *szPath, int cbPath) //This is copied from Miranda's sources. In 0.2.1.0 it is needed, in newer vesions of Miranda use MS_DB_GETPROFILEPATH service { wchar_t tszOldPath[MAX_PATH]; - CallService(MS_DB_GETPROFILEPATHW, _countof(tszOldPath), (LPARAM)tszOldPath); + Profile_GetPathW(_countof(tszOldPath), tszOldPath); mir_wstrcat(tszOldPath, L"\\*.book"); VARSW ptszNewPath( L"%miranda_userdata%"); @@ -268,7 +268,7 @@ extern "C" int __declspec(dllexport) Load(void) PathToAbsoluteW( L".", szMirandaDir); // retrieve the current profile name - CallService(MS_DB_GETPROFILENAMEW, (WPARAM)_countof(ProfileName), (LPARAM)ProfileName); //not to pass entire array to fcn + Profile_GetNameW(_countof(ProfileName), ProfileName); wchar_t *fc = wcsrchr(ProfileName, '.'); if ( fc != NULL ) *fc = 0; diff --git a/plugins/mRadio/mradio.dpr b/plugins/mRadio/mradio.dpr index 2d60f57c1b..6eb6e2321e 100644 --- a/plugins/mRadio/mradio.dpr +++ b/plugins/mRadio/mradio.dpr @@ -65,7 +65,7 @@ begin StrCopyW(pc,'plugins\mradio.ini');
FastWideToAnsi(buf,storage);
mGetMem(storagep,MAX_PATH+32);
- CallService(MS_DB_GETPROFILEPATH,MAX_PATH-1,tlparam(storagep));
+ Profile_GetPathA(MAX_PATH,@storagep);
StrCat(storagep,'\mradio.ini');
DBWriteDWord(0,PluginName,optVersion,PluginInfo.version); //??
diff --git a/plugins/wbOSD/src/events.cpp b/plugins/wbOSD/src/events.cpp index 2aba79e1dd..f1260e9ad0 100644 --- a/plugins/wbOSD/src/events.cpp +++ b/plugins/wbOSD/src/events.cpp @@ -185,12 +185,12 @@ int HookedNewEvent(WPARAM wParam, LPARAM hDBEvent) if ( i1 == 1 )
c1 = mir_wstrdup(pcli->pfnGetContactDisplayName(wParam, 0));
else if ( i1 == 2 )
- c1 = DbGetEventTextW( &dbe, 0 );
+ c1 = DbEvent_GetTextW( &dbe, 0 );
if ( i2 == 1 )
c2 = mir_wstrdup(pcli->pfnGetContactDisplayName(wParam, 0));
else if ( i2 == 2 )
- c2 = DbGetEventTextW( &dbe, 0 );
+ c2 = DbEvent_GetTextW( &dbe, 0 );
wchar_t buffer[512];
mir_snwprintf(buffer, buf, c1, c2);
|