From a6b9f6570b4cb4a425f91d4694e6b027f12cc8b7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 14 Nov 2018 15:57:47 +0300 Subject: hContact, MODULENAME -> g_plugin --- plugins/AvatarHistory/src/AvatarDlg.cpp | 19 ++-- plugins/AvatarHistory/src/AvatarHistory.cpp | 6 +- plugins/AvatarHistory/src/utils.cpp | 2 +- plugins/BasicHistory/src/HistoryWindow.cpp | 26 ++--- plugins/BasicHistory/src/Options.cpp | 8 +- plugins/BasicHistory/src/Scheduler.cpp | 3 - plugins/BuddyExpectator/src/BuddyExpectator.cpp | 38 ++++---- plugins/BuddyExpectator/src/options.cpp | 12 +-- plugins/BuddyPounce/src/dialog.cpp | 42 ++++----- plugins/BuddyPounce/src/main.cpp | 30 +++--- plugins/GmailNotifier/src/utility.cpp | 4 +- plugins/HTTPServer/src/GuiElements.cpp | 12 +-- plugins/LotusNotify/src/LotusNotify.cpp | 2 +- plugins/MessageState/src/messagestate.cpp | 4 +- plugins/MessageState/src/services.cpp | 6 +- plugins/MessageState/src/utils.cpp | 2 +- plugins/MirFox/src/MirandaOptions.cpp | 4 +- plugins/MirFox/src/MirandaUtils.cpp | 2 +- plugins/MirOTR/src/mirotrmenu.cpp | 2 +- plugins/MirOTR/src/options.cpp | 4 +- plugins/MirOTR/src/otr.cpp | 4 +- plugins/MirOTR/src/svcs_menu.cpp | 10 +- plugins/MirOTR/src/svcs_srmm.cpp | 2 +- plugins/Msg_Export/src/options.cpp | 2 +- plugins/NewAwaySysMod/src/MsgEventAdded.cpp | 6 +- plugins/NewAwaySysMod/src/Properties.cpp | 6 +- plugins/NewAwaySysMod/src/Properties.h | 10 +- plugins/New_GPG/src/main.cpp | 14 +-- plugins/New_GPG/src/messages.cpp | 46 ++++----- plugins/New_GPG/src/options.cpp | 50 +++++----- plugins/New_GPG/src/srmm.cpp | 8 +- plugins/New_GPG/src/ui.cpp | 4 +- plugins/New_GPG/src/utilities.cpp | 34 +++---- plugins/Popup/src/opt_contacts.cpp | 4 +- plugins/Popup/src/srmm_menu.cpp | 8 +- plugins/SecureIM/src/crypt_check.cpp | 8 +- plugins/SecureIM/src/crypt_dll.cpp | 2 +- plugins/SecureIM/src/crypt_lists.cpp | 8 +- plugins/SecureIM/src/options.cpp | 4 +- plugins/SmileyAdd/src/options.cpp | 6 +- plugins/Spamotron/src/options.cpp | 2 +- plugins/Spamotron/src/spamotron.cpp | 6 +- plugins/Spamotron/src/utils.cpp | 2 +- plugins/TooltipNotify/src/TooltipNotify.cpp | 6 +- plugins/Weather/src/weather_userinfo.cpp | 2 +- plugins/WebView/src/main.cpp | 2 +- plugins/WebView/src/webview.cpp | 38 ++++---- plugins/WebView/src/webview_alerts.cpp | 120 ++++++++++++------------ plugins/WebView/src/webview_datawnd.cpp | 8 +- plugins/WebView/src/webview_getdata.cpp | 88 ++++++++--------- plugins/WebView/src/webview_opts.cpp | 114 +++++++++++----------- plugins/WebView/src/webview_services.cpp | 40 ++++---- plugins/XSoundNotify/src/dialog.cpp | 18 ++-- plugins/XSoundNotify/src/options.cpp | 12 +-- plugins/XSoundNotify/src/xsn_main.cpp | 8 +- 55 files changed, 463 insertions(+), 467 deletions(-) (limited to 'plugins') diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index 664f1892b8..cc5c63a9af 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -287,9 +287,9 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA case IDOK: if (HIWORD(wParam) == BN_CLICKED) { MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA); - db_set_b(hContact, MODULENAME, "AvatarPopups", (BYTE)IsDlgButtonChecked(hwnd, IDC_POPUPUSER)); - db_set_b(hContact, MODULENAME, "LogToDisk", (BYTE)IsDlgButtonChecked(hwnd, IDC_LOGUSER)); - db_set_b(hContact, MODULENAME, "LogToHistory", (BYTE)IsDlgButtonChecked(hwnd, IDC_HISTORYUSER)); + g_plugin.setByte(hContact, "AvatarPopups", (BYTE)IsDlgButtonChecked(hwnd, IDC_POPUPUSER)); + g_plugin.setByte(hContact, "LogToDisk", (BYTE)IsDlgButtonChecked(hwnd, IDC_LOGUSER)); + g_plugin.setByte(hContact, "LogToHistory", (BYTE)IsDlgButtonChecked(hwnd, IDC_HISTORYUSER)); CleanupAvatarPic(hwnd); EndDialog(hwnd, 0); @@ -540,16 +540,15 @@ int ShowSaveDialog(HWND hwnd, wchar_t* fn, MCONTACT hContact) ofn.Flags = OFN_PATHMUSTEXIST | OFN_DONTADDTORECENT; ofn.lpstrDefExt = wcsrchr(fn, '.') + 1; - DBVARIANT dbvInitDir = { 0 }; - if (!db_get_ws(hContact, MODULENAME, "SavedAvatarFolder", &dbvInitDir)) { - ofn.lpstrInitialDir = dbvInitDir.pwszVal; - db_free(&dbvInitDir); - } - else ofn.lpstrInitialDir = L"."; + ptrW wszInitDir(g_plugin.getWStringA(hContact, "SavedAvatarFolder")); + if (wszInitDir) + ofn.lpstrInitialDir = wszInitDir; + else + ofn.lpstrInitialDir = L"."; if (GetSaveFileName(&ofn)) { CopyFile(fn, file, FALSE); - db_set_ws(hContact, MODULENAME, "SavedAvatarFolder", file); + g_plugin.setWString(hContact, "SavedAvatarFolder", file); } return 0; } diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index 7ed09f7e59..99632fc836 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -105,7 +105,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) return 0; DBVARIANT dbvOldHash = { 0 }; - bool ret = (db_get_ws(hContact, MODULENAME, "AvatarHash", &dbvOldHash) == 0); + bool ret = (g_plugin.getWString(hContact, "AvatarHash", &dbvOldHash) == 0); CONTACTAVATARCHANGEDNOTIFICATION* avatar = (CONTACTAVATARCHANGEDNOTIFICATION*)lParam; if (avatar == nullptr) { @@ -119,7 +119,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) Skin_PlaySound("avatar_removed"); // Is a flash avatar or avs could not load it - db_set_ws(hContact, MODULENAME, "AvatarHash", L"-"); + g_plugin.setWString(hContact, "AvatarHash", L"-"); if (ContactEnabled(hContact, "AvatarPopups", AVH_DEF_AVPOPUPS) && opts.popup_show_removed) ShowPopup(hContact, nullptr, opts.popup_removed); @@ -132,7 +132,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) return 0; } Skin_PlaySound("avatar_changed"); - db_set_ws(hContact, "AvatarHistory", "AvatarHash", avatar->hash); + g_plugin.setWString(hContact, "AvatarHash", avatar->hash); wchar_t history_filename[MAX_PATH] = L""; diff --git a/plugins/AvatarHistory/src/utils.cpp b/plugins/AvatarHistory/src/utils.cpp index a3af7ab9bd..9c86cfbc72 100644 --- a/plugins/AvatarHistory/src/utils.cpp +++ b/plugins/AvatarHistory/src/utils.cpp @@ -39,7 +39,7 @@ bool ContactEnabled(MCONTACT hContact, char *setting, int def) return false; BYTE globpref = g_plugin.getByte(setting, def); - BYTE userpref = db_get_b(hContact, MODULENAME, setting, BST_INDETERMINATE); + BYTE userpref = g_plugin.getByte(hContact, setting, BST_INDETERMINATE); return (globpref && userpref == BST_INDETERMINATE) || userpref == BST_CHECKED; } diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index ebac3bd0c5..17c78befc3 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -1608,14 +1608,14 @@ void HistoryWindow::RestorePos() contactToLoad = NULL; } - if (db_get_b(contactToLoad, MODULENAME, "history_ismax", 0)) + if (g_plugin.getByte(contactToLoad, "history_ismax")) ShowWindow(m_hWnd, SW_SHOWMAXIMIZED); - LONG pos = db_get_dw(contactToLoad, MODULENAME, "history_splitterv", 0); + LONG pos = g_plugin.getDword(contactToLoad, "history_splitterv"); if (pos > 0) SplitterMoved(splitterYhWnd, pos, false); - pos = db_get_dw(contactToLoad, MODULENAME, "history_splitter", 0); + pos = g_plugin.getDword(contactToLoad, "history_splitter"); if (pos > 0) SplitterMoved(splitterXhWnd, pos, false); } @@ -1625,13 +1625,13 @@ void HistoryWindow::SavePos(bool all) MCONTACT contactToSave = m_hContact; if (all) { for (auto &_hContact : Contacts()) { - db_unset(_hContact, MODULENAME, "history_x"); - db_unset(_hContact, MODULENAME, "history_y"); - db_unset(_hContact, MODULENAME, "history_width"); - db_unset(_hContact, MODULENAME, "history_height"); - db_unset(_hContact, MODULENAME, "history_ismax"); - db_unset(_hContact, MODULENAME, "history_splitterv"); - db_unset(_hContact, MODULENAME, "history_splitter"); + g_plugin.delSetting(_hContact, "history_x"); + g_plugin.delSetting(_hContact, "history_y"); + g_plugin.delSetting(_hContact, "history_width"); + g_plugin.delSetting(_hContact, "history_height"); + g_plugin.delSetting(_hContact, "history_ismax"); + g_plugin.delSetting(_hContact, "history_splitterv"); + g_plugin.delSetting(_hContact, "history_splitter"); } contactToSave = NULL; @@ -1641,9 +1641,9 @@ void HistoryWindow::SavePos(bool all) WINDOWPLACEMENT wp; wp.length = sizeof(wp); GetWindowPlacement(m_hWnd, &wp); - db_set_b(contactToSave, MODULENAME, "history_ismax", wp.showCmd == SW_MAXIMIZE ? 1 : 0); - db_set_dw(contactToSave, MODULENAME, "history_splitterv", splitterX); - db_set_dw(contactToSave, MODULENAME, "history_splitter", splitterY); + g_plugin.setByte(contactToSave, "history_ismax", wp.showCmd == SW_MAXIMIZE ? 1 : 0); + g_plugin.setDword(contactToSave, "history_splitterv", splitterX); + g_plugin.setDword(contactToSave, "history_splitter", splitterY); } #define DEF_FILTERS_START 50000 diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index f1434cf30e..0190050341 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -545,10 +545,10 @@ void Options::SaveTasks(std::list* tasks) mir_snprintf(buf, "IsInTask_%d", i); for (auto &hContact : Contacts()) - db_unset(hContact, MODULENAME, buf); + g_plugin.delSetting(hContact, buf); for (size_t j = 0; j < it->contacts.size(); ++j) - db_set_b(it->contacts[j], MODULENAME, buf, 1); + g_plugin.setByte(it->contacts[j], buf, 1); it->orderNr = i++; taskOptions.push_back(*it); @@ -600,7 +600,7 @@ void Options::SaveTasks(std::list* tasks) mir_snprintf(buf, "IsInTask_%d", i); for (auto &hContact : Contacts()) - db_unset(hContact, MODULENAME, buf); + g_plugin.delSetting(hContact, buf); } } @@ -686,7 +686,7 @@ void Options::LoadTasks() mir_snprintf(buf, "IsInTask_%d", i); for (auto &hContact : Contacts()) - if (db_get_b(hContact, MODULENAME, buf, 0) == 1) + if (g_plugin.getByte(hContact, buf) == 1) to.contacts.push_back(hContact); to.orderNr = i; diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index 9e15d37eeb..695f7b286d 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -21,9 +21,6 @@ along with this program. If not, see . #include "ExportManager.h" #include "HistoryWindow.h" -// Sorry for plain C implementation -#define MODULENAME "BasicHistory" - bool bPopupsEnabled; bool DoTask(TaskOptions& to); bool IsValidTask(TaskOptions& to, std::list* top = nullptr, std::wstring* err = nullptr, std::wstring* errDescr = nullptr); diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index 3d4d799d6d..2760f7c387 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -68,14 +68,14 @@ CMPlugin::CMPlugin() : time_t getLastSeen(MCONTACT hContact) { - return db_get_dw(hContact, MODULENAME, "LastSeen", db_get_dw(hContact, MODULENAME, "CreationTime", (DWORD)-1)); + return g_plugin.getDword(hContact, "LastSeen", g_plugin.getDword(hContact, "CreationTime", (DWORD)-1)); } void setLastSeen(MCONTACT hContact) { - db_set_dw(hContact, MODULENAME, "LastSeen", (DWORD)time(0)); - if (db_get_b(hContact, MODULENAME, "StillAbsentNotified", 0)) - db_set_b(hContact, MODULENAME, "StillAbsentNotified", 0); + g_plugin.setDword(hContact, "LastSeen", (DWORD)time(0)); + if (g_plugin.getByte(hContact, "StillAbsentNotified", 0)) + g_plugin.setByte(hContact, "StillAbsentNotified", 0); } time_t getLastInputMsg(MCONTACT hContact) @@ -223,7 +223,7 @@ bool isContactGoneFor(MCONTACT hContact, int days) if (options.hideInactive) if (daysSinceMessage >= options.iSilencePeriod) - if (!db_get_b(hContact, "CList", "Hidden", 0) && !db_get_b(hContact, MODULENAME, "NeverHide", 0)) { + if (!db_get_b(hContact, "CList", "Hidden", 0) && !g_plugin.getByte(hContact, "NeverHide", 0)) { POPUPDATAT_V2 ppd = { 0 }; ppd.cbSize = sizeof(ppd); ppd.lchContact = hContact; @@ -411,12 +411,12 @@ int onIconsChanged(WPARAM, LPARAM) */ INT_PTR MenuMissYouClick(WPARAM hContact, LPARAM) { - if (db_get_b(hContact, MODULENAME, "MissYou", 0)) { - db_set_b(hContact, MODULENAME, "MissYou", 0); + if (g_plugin.getByte(hContact, "MissYou", 0)) { + g_plugin.setByte(hContact, "MissYou", 0); ExtraIcon_Clear(hExtraIcon, hContact); } else { - db_set_b(hContact, MODULENAME, "MissYou", 1); + g_plugin.setByte(hContact, "MissYou", 1); ExtraIcon_SetIconByName(hExtraIcon, hContact, "enabled_icon"); } @@ -432,7 +432,7 @@ int onPrebuildContactMenu(WPARAM hContact, LPARAM) if (!proto) return 0; - if (db_get_b(hContact, MODULENAME, "MissYou", 0)) + if (g_plugin.getByte(hContact, "MissYou", 0)) Menu_ModifyItem(hContactMenu, LPGENW("Disable Miss You"), iconList[1].hIcolib); else Menu_ModifyItem(hContactMenu, LPGENW("Enable Miss You"), iconList[2].hIcolib); @@ -443,7 +443,7 @@ int onPrebuildContactMenu(WPARAM hContact, LPARAM) int onExtraImageApplying(WPARAM hContact, LPARAM) { - if (db_get_b(hContact, MODULENAME, "MissYou", 0)) + if (g_plugin.getByte(hContact, "MissYou", 0)) ExtraIcon_SetIconByName(hExtraIcon, hContact, "enabled_icon"); return 0; @@ -473,10 +473,10 @@ int SettingChanged(WPARAM hContact, LPARAM lParam) return 0; // Last status - db_set_dw(hContact, MODULENAME, "LastStatus", prevStatus); + g_plugin.setDword(hContact, "LastStatus", prevStatus); if (prevStatus == ID_STATUS_OFFLINE) { - if (db_get_b(hContact, MODULENAME, "MissYou", 0)) { + if (g_plugin.getByte(hContact, "MissYou", 0)) { // Display Popup POPUPDATAT_V2 ppd = { 0 }; ppd.cbSize = sizeof(ppd); @@ -508,12 +508,12 @@ int SettingChanged(WPARAM hContact, LPARAM lParam) return 0; } - if (db_get_dw(hContact, MODULENAME, "LastSeen", (DWORD)-1) == (DWORD)-1 && options.notifyFirstOnline) { + if (g_plugin.getDword(hContact, "LastSeen", (DWORD)-1) == (DWORD)-1 && options.notifyFirstOnline) { ReturnNotify(hContact, TranslateT("has gone online for the first time.")); setLastSeen(hContact); } - unsigned int AbsencePeriod = db_get_dw(hContact, MODULENAME, "iAbsencePeriod", options.iAbsencePeriod); + unsigned int AbsencePeriod = g_plugin.getDword(hContact, "iAbsencePeriod", options.iAbsencePeriod); if (isContactGoneFor(hContact, AbsencePeriod)) { wchar_t* message = TranslateT("has returned after a long absence."); wchar_t tmpBuf[251] = { 0 }; @@ -544,9 +544,9 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) { for (auto &hContact : Contacts()) { char *proto = GetContactProto(hContact); - if (proto && (db_get_b(hContact, proto, "ChatRoom", 0) == 0) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) && isContactGoneFor(hContact, options.iAbsencePeriod2) && (db_get_b(hContact, MODULENAME, "StillAbsentNotified", 0) == 0)) + if (proto && (db_get_b(hContact, proto, "ChatRoom", 0) == 0) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) && isContactGoneFor(hContact, options.iAbsencePeriod2) && (g_plugin.getByte(hContact, "StillAbsentNotified", 0) == 0)) { - db_set_b(hContact, MODULENAME, "StillAbsentNotified", 1); + g_plugin.setByte(hContact, "StillAbsentNotified", 1); Skin_PlaySound("buddyExpectatorStillAbsent"); wchar_t* message = TranslateT("has not returned after a long absence."); @@ -635,7 +635,7 @@ int ModulesLoaded(WPARAM, LPARAM) int ContactAdded(WPARAM hContact, LPARAM) { - db_set_dw(hContact, MODULENAME, "CreationTime", (DWORD)time(0)); + g_plugin.setDword(hContact, "CreationTime", (DWORD)time(0)); return 0; } @@ -664,8 +664,8 @@ int CMPlugin::Load() // ensure all contacts are timestamped DWORD current_time = (DWORD)time(0); for (auto &hContact : Contacts()) - if (!db_get_dw(hContact, MODULENAME, "CreationTime")) - db_set_dw(hContact, MODULENAME, "CreationTime", current_time); + if (!g_plugin.getDword(hContact, "CreationTime")) + g_plugin.setDword(hContact, "CreationTime", current_time); g_plugin.registerIcon("BuddyExpectator", iconList); diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp index aeac064fb6..4655dcfef6 100644 --- a/plugins/BuddyExpectator/src/options.cpp +++ b/plugins/BuddyExpectator/src/options.cpp @@ -247,8 +247,8 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, // clear all notified settings for (auto &hContact : Contacts()) - if (db_get_b(hContact, MODULENAME, "StillAbsentNotified", 0)) - db_set_b(hContact, MODULENAME, "StillAbsentNotified", 0); + if (g_plugin.getByte(hContact, "StillAbsentNotified", 0)) + g_plugin.setByte(hContact, "StillAbsentNotified", 0); // restart timer & run check KillTimer(nullptr, timer_id); @@ -504,10 +504,10 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lparam)->lParam; if (hContact) { - db_set_dw(hContact, MODULENAME, "iAbsencePeriod", GetDlgItemInt(hdlg, IDC_EDITABSENCE, nullptr, FALSE)); - db_set_b(hContact, MODULENAME, "MissYou", (IsDlgButtonChecked(hdlg, IDC_CHECK_MISSYOU) == BST_CHECKED) ? 1 : 0); - db_set_b(hContact, MODULENAME, "MissYouNotifyAlways", (IsDlgButtonChecked(hdlg, IDC_CHECK_NOTIFYALWAYS) == BST_CHECKED) ? 1 : 0); - db_set_b(hContact, MODULENAME, "NeverHide", (IsDlgButtonChecked(hdlg, IDC_CHECK_NEVERHIDE) == BST_CHECKED) ? 1 : 0); + g_plugin.setDword(hContact, "iAbsencePeriod", GetDlgItemInt(hdlg, IDC_EDITABSENCE, nullptr, FALSE)); + g_plugin.setByte(hContact, "MissYou", (IsDlgButtonChecked(hdlg, IDC_CHECK_MISSYOU) == BST_CHECKED) ? 1 : 0); + g_plugin.setByte(hContact, "MissYouNotifyAlways", (IsDlgButtonChecked(hdlg, IDC_CHECK_NOTIFYALWAYS) == BST_CHECKED) ? 1 : 0); + g_plugin.setByte(hContact, "NeverHide", (IsDlgButtonChecked(hdlg, IDC_CHECK_NEVERHIDE) == BST_CHECKED) ? 1 : 0); } break; } diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp index 3761a141b0..2293f3cffa 100644 --- a/plugins/BuddyPounce/src/dialog.cpp +++ b/plugins/BuddyPounce/src/dialog.cpp @@ -28,7 +28,7 @@ void populateContacts(MCONTACT BPhContact, HWND hwnd2CB) void saveLastSetting(MCONTACT hContact, HWND hwnd) { wchar_t number[8];//, string[1024];//for sending file name - switch (db_get_b(hContact, MODULENAME, "LastSetting", 2)) { // nothing to do + switch (g_plugin.getByte(hContact, "LastSetting", 2)) { // nothing to do case 0: // Send If My Status Is... break; case 1: // Send If They Change status to @@ -38,18 +38,18 @@ void saveLastSetting(MCONTACT hContact, HWND hwnd) break; case 3: // Reuse Pounce GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, _countof(number)); - db_set_b(hContact, MODULENAME, "Reuse", (BYTE)_wtoi(number)); + g_plugin.setByte(hContact, "Reuse", (BYTE)_wtoi(number)); break; case 4: // Give Up delay GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, _countof(number)); - db_set_b(hContact, MODULENAME, "GiveUpDays", (BYTE)_wtoi(number)); + g_plugin.setByte(hContact, "GiveUpDays", (BYTE)_wtoi(number)); { - db_set_dw(hContact, MODULENAME, "GiveUpDate", (DWORD)(_wtoi(number)*SECONDSINADAY)); + g_plugin.setDword(hContact, "GiveUpDate", (DWORD)(_wtoi(number)*SECONDSINADAY)); } break; case 5: // confirm window GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, _countof(number)); - db_set_w(hContact, MODULENAME, "ConfirmTimeout", (WORD)_wtoi(number)); + g_plugin.setWord(hContact, "ConfirmTimeout", (WORD)_wtoi(number)); break; } } @@ -65,7 +65,7 @@ void hideAll(HWND hwnd) void getDefaultMessage(HWND hwnd, UINT control, MCONTACT hContact) { DBVARIANT dbv; - if (!db_get_ws(hContact, MODULENAME, "PounceMsg", &dbv)) { + if (!g_plugin.getWString(hContact, "PounceMsg", &dbv)) { SetDlgItemText(hwnd, control, dbv.pwszVal); db_free(&dbv); } @@ -179,14 +179,14 @@ void statusModes(windowInfo *wi, int myStatusMode) // myStatusMode=1 sendIfMySta void deletePounce(MCONTACT hContact) { - db_unset(hContact, MODULENAME, "PounceMsg"); - db_unset(hContact, MODULENAME, "SendIfMyStatusIsFLAG"); - db_unset(hContact, MODULENAME, "SendIfTheirStatusIsFLAG"); - db_unset(hContact, MODULENAME, "Reuse"); - db_unset(hContact, MODULENAME, "GiveUpDays"); - db_unset(hContact, MODULENAME, "GiveUpDate"); - db_unset(hContact, MODULENAME, "ConfirmTimeout"); - db_unset(hContact, MODULENAME, "FileToSend"); + g_plugin.delSetting(hContact, "PounceMsg"); + g_plugin.delSetting(hContact, "SendIfMyStatusIsFLAG"); + g_plugin.delSetting(hContact, "SendIfTheirStatusIsFLAG"); + g_plugin.delSetting(hContact, "Reuse"); + g_plugin.delSetting(hContact, "GiveUpDays"); + g_plugin.delSetting(hContact, "GiveUpDate"); + g_plugin.delSetting(hContact, "ConfirmTimeout"); + g_plugin.delSetting(hContact, "FileToSend"); } INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -224,9 +224,9 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, L if (length > 1) { wchar_t *text = (wchar_t*)_alloca(length * sizeof(wchar_t)); GetDlgItemText(hwnd, IDC_MESSAGE, text, length); - db_set_ws(hContact, MODULENAME, "PounceMsg", text); + g_plugin.setWString(hContact, "PounceMsg", text); } - else db_unset(hContact, MODULENAME, "PounceMsg"); + else g_plugin.delSetting(hContact, "PounceMsg"); } // fall through case IDCANCEL: @@ -289,10 +289,10 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM break; } GetDlgItemText(hwnd, IDC_MESSAGE, text, length); - db_set_ws(hContact, MODULENAME, "PounceMsg", text); + g_plugin.setWString(hContact, "PounceMsg", text); mir_free(text); } - else db_unset(hContact, MODULENAME, "PounceMsg"); + else g_plugin.delSetting(hContact, "PounceMsg"); saveLastSetting(hContact, hwnd); } // fall through if (LOWORD(wParam) == IDC_SIMPLE) @@ -415,10 +415,10 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, break; } GetDlgItemText(hwnd, IDC_MESSAGE, text, length); - db_set_ws(hContact, MODULENAME, "PounceMsg", text); + g_plugin.setWString(hContact, "PounceMsg", text); mir_free(text); } - else db_unset(hContact, MODULENAME, "PounceMsg"); + else g_plugin.delSetting(hContact, "PounceMsg"); g_plugin.setByte("UseAdvanced", (BYTE)IsDlgButtonChecked(hwnd, IDC_USEADVANCED)); g_plugin.setByte("ShowDeliveryMessages", (BYTE)IsDlgButtonChecked(hwnd, IDC_SHOWDELIVERYMSGS)); @@ -567,7 +567,7 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP hContact = lParam; { DBVARIANT dbv; - if (db_get_ws(hContact, MODULENAME, "PounceMsg", &dbv)) + if (g_plugin.getWString(hContact, "PounceMsg", &dbv)) DestroyWindow(hwnd); else { SetDlgItemText(hwnd, IDC_MESSAGE, dbv.pwszVal); diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index 03c5bb3fe0..30a0d2278c 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -111,9 +111,9 @@ int statusCheck(int statusFlag, int status) int CheckDate(MCONTACT hContact) { time_t curtime = time(nullptr); - if (!db_get_b(hContact, MODULENAME, "GiveUpDays", 0)) + if (!g_plugin.getByte(hContact, "GiveUpDays", 0)) return 1; - if (db_get_b(hContact, MODULENAME, "GiveUpDays", 0) && (abs((time_t)db_get_dw(hContact, MODULENAME, "GiveUpDate", 0)) > curtime)) + if (g_plugin.getByte(hContact, "GiveUpDays", 0) && (abs((time_t)g_plugin.getDword(hContact, "GiveUpDate", 0)) > curtime)) return 1; return 0; } @@ -136,14 +136,14 @@ int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) if (newStatus != oldStatus && hContact != NULL && newStatus != ID_STATUS_OFFLINE) { DBVARIANT dbv; - if (!db_get_ws(hContact, MODULENAME, "PounceMsg", &dbv) && (dbv.pwszVal[0] != '\0')) { + if (!g_plugin.getWString(hContact, "PounceMsg", &dbv) && (dbv.pwszVal[0] != '\0')) { // check my status - if (statusCheck(db_get_w(hContact, MODULENAME, "SendIfMyStatusIsFLAG", 0), Proto_GetStatus(szProto)) + if (statusCheck(g_plugin.getWord(hContact, "SendIfMyStatusIsFLAG", 0), Proto_GetStatus(szProto)) // check the contacts status - && statusCheck(db_get_w(hContact, MODULENAME, "SendIfTheirStatusIsFLAG", 0), newStatus)) { + && statusCheck(g_plugin.getWord(hContact, "SendIfTheirStatusIsFLAG", 0), newStatus)) { // check if we r giving up after x days if (CheckDate(hContact)) { - if (db_get_w(hContact, MODULENAME, "ConfirmTimeout", 0)) { + if (g_plugin.getWord(hContact, "ConfirmTimeout", 0)) { SendPounceDlgProcStruct *spdps = (SendPounceDlgProcStruct *)mir_alloc(sizeof(SendPounceDlgProcStruct)); wchar_t *message = mir_wstrdup(dbv.pwszVal); // will get free()ed in the send confirm window proc spdps->hContact = hContact; @@ -164,7 +164,7 @@ int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) INT_PTR BuddyPounceMenuCommand(WPARAM hContact, LPARAM) { - if (g_plugin.getByte("UseAdvanced", 0) || db_get_b(hContact, MODULENAME, "UseAdvanced", 0)) + if (g_plugin.getByte("UseAdvanced", 0) || g_plugin.getByte(hContact, "UseAdvanced", 0)) CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POUNCE), nullptr, BuddyPounceDlgProc, hContact); else CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POUNCE_SIMPLE), nullptr, BuddyPounceSimpleDlgProc, hContact); @@ -175,12 +175,12 @@ INT_PTR AddSimpleMessage(WPARAM wParam, LPARAM lParam) { MCONTACT hContact = wParam; wchar_t* message = (wchar_t*)lParam; - db_set_ws(hContact, MODULENAME, "PounceMsg", message); - db_set_w(hContact, MODULENAME, "SendIfMyStatusIsFLAG", (WORD)g_plugin.getWord("SendIfMyStatusIsFLAG", 1)); - db_set_w(hContact, MODULENAME, "SendIfTheirStatusIsFLAG", (WORD)g_plugin.getWord("SendIfTheirStatusIsFLAG", 1)); - db_set_b(hContact, MODULENAME, "Reuse", (BYTE)g_plugin.getByte("Reuse", 0)); - db_set_b(hContact, MODULENAME, "GiveUpDays", (BYTE)g_plugin.getByte("GiveUpDays", 0)); - db_set_dw(hContact, MODULENAME, "GiveUpDate", (DWORD)(db_get_b(hContact, MODULENAME, "GiveUpDays", 0)*SECONDSINADAY)); + g_plugin.setWString(hContact, "PounceMsg", message); + g_plugin.setWord(hContact, "SendIfMyStatusIsFLAG", (WORD)g_plugin.getWord("SendIfMyStatusIsFLAG", 1)); + g_plugin.setWord(hContact, "SendIfTheirStatusIsFLAG", (WORD)g_plugin.getWord("SendIfTheirStatusIsFLAG", 1)); + g_plugin.setByte(hContact, "Reuse", (BYTE)g_plugin.getByte("Reuse", 0)); + g_plugin.setByte(hContact, "GiveUpDays", (BYTE)g_plugin.getByte("GiveUpDays", 0)); + g_plugin.setDword(hContact, "GiveUpDate", (DWORD)(g_plugin.getByte(hContact, "GiveUpDays", 0)*SECONDSINADAY)); return 0; } @@ -189,12 +189,12 @@ INT_PTR AddToPounce(WPARAM wParam, LPARAM lParam) MCONTACT hContact = wParam; wchar_t* message = (wchar_t*)lParam; DBVARIANT dbv; - if (!db_get_ws(hContact, MODULENAME, "PounceMsg", &dbv)) { + if (!g_plugin.getWString(hContact, "PounceMsg", &dbv)) { wchar_t* newPounce = (wchar_t*)mir_alloc(mir_wstrlen(dbv.pwszVal) + mir_wstrlen(message) + 1); if (!newPounce) return 1; mir_wstrcpy(newPounce, dbv.pwszVal); mir_wstrcat(newPounce, message); - db_set_ws(hContact, MODULENAME, "PounceMsg", newPounce); + g_plugin.setWString(hContact, "PounceMsg", newPounce); mir_free(newPounce); db_free(&dbv); } diff --git a/plugins/GmailNotifier/src/utility.cpp b/plugins/GmailNotifier/src/utility.cpp index 2751aa2f1c..27d8aac1f3 100644 --- a/plugins/GmailNotifier/src/utility.cpp +++ b/plugins/GmailNotifier/src/utility.cpp @@ -5,14 +5,14 @@ void BuildList(void) g_accs.destroy(); for (auto &hContact : Contacts(MODULENAME)) { - ptrA szName(db_get_sa(hContact, MODULENAME, "name")); + ptrA szName(g_plugin.getStringA(hContact, "name")); if (szName != nullptr) { Account *p = new Account; p->hContact = hContact; mir_strcpy(p->name, szName); CallService(MS_IGNORE_IGNORE, hContact, IGNOREEVENT_USERONLINE); - ptrA szPassword(db_get_sa(hContact, MODULENAME, "Password")); + ptrA szPassword(g_plugin.getStringA(hContact, "Password")); if (szPassword != nullptr) mir_strcpy(p->pass, szPassword); g_accs.insert(p); diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index 2d0bb6771b..bf3690caa8 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -1011,11 +1011,11 @@ static INT_PTR nShareNewFile(WPARAM hContact, LPARAM lParam) if (!stNewShare.dwAllowedIP) stNewShare.dwAllowedIP = db_get_dw(hContact, dbv.pszVal, "RealIP", 0); if (!stNewShare.dwAllowedIP) - stNewShare.dwAllowedIP = db_get_dw(hContact, MODULENAME, "LastUsedIP", 0); + stNewShare.dwAllowedIP = g_plugin.getDword(hContact, "LastUsedIP", 0); } db_free(&dbv); - stNewShare.dwAllowedMask = db_get_dw(hContact, MODULENAME, "LastUsedMask", 0); + stNewShare.dwAllowedMask = g_plugin.getDword(hContact, "LastUsedMask", 0); } if (!stNewShare.dwAllowedMask) { @@ -1029,14 +1029,14 @@ static INT_PTR nShareNewFile(WPARAM hContact, LPARAM lParam) return 0; if (stNewShare.dwAllowedIP) - db_set_dw(hContact, MODULENAME, "LastUsedIP", stNewShare.dwAllowedIP); + g_plugin.setDword(hContact, "LastUsedIP", stNewShare.dwAllowedIP); else - db_unset(hContact, MODULENAME, "LastUsedIP"); + g_plugin.delSetting(hContact, "LastUsedIP"); if (stNewShare.dwAllowedMask && stNewShare.dwAllowedMask != 0xFFFFFFFF) - db_set_dw(hContact, MODULENAME, "LastUsedMask", stNewShare.dwAllowedMask); + g_plugin.setDword(hContact, "LastUsedMask", stNewShare.dwAllowedMask); else - db_unset(hContact, MODULENAME, "LastUsedMask"); + g_plugin.delSetting(hContact, "LastUsedMask"); SendLinkToUser(hContact, stNewShare.pszSrvPath); return 0; diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index dfb8951922..bf600ad4fa 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -1715,7 +1715,7 @@ int CMPlugin::Load() // set all contacts to offline for (auto &hContact : Contacts(MODULENAME)) - db_set_w(hContact, MODULENAME, "status", ID_STATUS_OFFLINE); + g_plugin.setWord(hContact, "status", ID_STATUS_OFFLINE); CreateProtoServiceFunction(MODULENAME, PS_GETCAPS, GetCaps); CreateProtoServiceFunction(MODULENAME, PS_GETNAME, GetName); diff --git a/plugins/MessageState/src/messagestate.cpp b/plugins/MessageState/src/messagestate.cpp index 805ad0884e..81bc96e438 100644 --- a/plugins/MessageState/src/messagestate.cpp +++ b/plugins/MessageState/src/messagestate.cpp @@ -32,7 +32,7 @@ void SetSRMMIcon(MCONTACT hContact, SRMM_ICON_TYPE type, time_t time) if (type == ICON_READ) { - if (db_get_dw(hContact, MODULENAME, DBKEY_MESSAGE_READ_TIME_TYPE, -1) == MRD_TYPE_READTIME) + if (g_plugin.getDword(hContact, DBKEY_MESSAGE_READ_TIME_TYPE, -1) == MRD_TYPE_READTIME) { wcsftime(tszTooltip.GetBuffer(64), 64, TranslateT("Last message read at %X %x"), localtime(&time)); tszTooltip.ReleaseBuffer(); @@ -57,7 +57,7 @@ void SetSRMMIcon(MCONTACT hContact, SRMM_ICON_TYPE type, time_t time) int IconsUpdate(MCONTACT hContact) { - time_t readtime = db_get_dw(hContact, MODULENAME, DBKEY_MESSAGE_READ_TIME, 0); + time_t readtime = g_plugin.getDword(hContact, DBKEY_MESSAGE_READ_TIME, 0); time_t lasttime = GetLastSentMessageTime(hContact); if (lasttime != -1 && readtime != 0) { diff --git a/plugins/MessageState/src/services.cpp b/plugins/MessageState/src/services.cpp index 362354e118..3521ece9a9 100644 --- a/plugins/MessageState/src/services.cpp +++ b/plugins/MessageState/src/services.cpp @@ -10,10 +10,10 @@ void InitServices() INT_PTR UpdateService(WPARAM hContact, LPARAM lParam) { MessageReadData *mrd = (MessageReadData*)lParam; - if (mrd->dw_lastTime > db_get_dw(hContact, MODULENAME, DBKEY_MESSAGE_READ_TIME, 0)) + if (mrd->dw_lastTime > g_plugin.getDword(hContact, DBKEY_MESSAGE_READ_TIME, 0)) { - db_set_dw(hContact, MODULENAME, DBKEY_MESSAGE_READ_TIME, mrd->dw_lastTime); - db_set_dw(hContact, MODULENAME, DBKEY_MESSAGE_READ_TIME_TYPE, mrd->iTimeType); + g_plugin.setDword(hContact, DBKEY_MESSAGE_READ_TIME, mrd->dw_lastTime); + g_plugin.setDword(hContact, DBKEY_MESSAGE_READ_TIME_TYPE, mrd->iTimeType); IconsUpdate(hContact); } return 0; diff --git a/plugins/MessageState/src/utils.cpp b/plugins/MessageState/src/utils.cpp index 57246f8f44..7f8bf81487 100644 --- a/plugins/MessageState/src/utils.cpp +++ b/plugins/MessageState/src/utils.cpp @@ -14,5 +14,5 @@ time_t GetLastSentMessageTime(MCONTACT hContact) bool HasUnread(MCONTACT hContact) { - return (CheckProtoSupport(GetContactProto(hContact))) && ((GetLastSentMessageTime(hContact) > db_get_dw(hContact, MODULENAME, DBKEY_MESSAGE_READ_TIME, 0)) && db_get_dw(hContact, MODULENAME, DBKEY_MESSAGE_READ_TIME, 0) != 0); + return (CheckProtoSupport(GetContactProto(hContact))) && ((GetLastSentMessageTime(hContact) > g_plugin.getDword(hContact, DBKEY_MESSAGE_READ_TIME, 0)) && g_plugin.getDword(hContact, DBKEY_MESSAGE_READ_TIME, 0) != 0); } diff --git a/plugins/MirFox/src/MirandaOptions.cpp b/plugins/MirFox/src/MirandaOptions.cpp index 03714b8c71..5653ad774a 100644 --- a/plugins/MirFox/src/MirandaOptions.cpp +++ b/plugins/MirFox/src/MirandaOptions.cpp @@ -483,9 +483,9 @@ INT_PTR CALLBACK DlgProcOpts_Tab2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM //save to db 1 - on, 2 - off if (contactState == MFENUM_MIRANDACONTACT_STATE_OFF){ - db_set_b(hContact, MODULENAME, "state", 2); + g_plugin.setByte(hContact, "state", 2); } else { - db_set_b(hContact, MODULENAME, "state", 1); + g_plugin.setByte(hContact, "state", 1); } diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp index 8e69fd7c72..e786c2fb00 100644 --- a/plugins/MirFox/src/MirandaUtils.cpp +++ b/plugins/MirFox/src/MirandaUtils.cpp @@ -505,7 +505,7 @@ void MirandaUtils::translateOldDBNames() { int keyValue = db_get_b(hContact, OLD_PLUGIN_DB_ID, "state", 0); if (keyValue != 0){ - db_set_b(hContact, MODULENAME, "state", keyValue); + g_plugin.setByte(hContact, "state", keyValue); db_unset(hContact, OLD_PLUGIN_DB_ID, "state"); logger->log(L"TranslateOldDBNames: CONTACT db entry found and moved"); } diff --git a/plugins/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/src/mirotrmenu.cpp index d5dc58db0d..bffb67d743 100644 --- a/plugins/MirOTR/src/mirotrmenu.cpp +++ b/plugins/MirOTR/src/mirotrmenu.cpp @@ -86,7 +86,7 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam, LPARAM) } } else if (pcpp->MenuItemHandle == hHTMLConvMenuItem) - Menu_SetChecked(hHTMLConvMenuItem, db_get_b(hContact, MODULENAME, "HTMLConv", 0) != 0); + Menu_SetChecked(hHTMLConvMenuItem, g_plugin.getByte(hContact, "HTMLConv", 0) != 0); } return TRUE; } diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp index ecb07d9061..f71d65e2f0 100644 --- a/plugins/MirOTR/src/options.cpp +++ b/plugins/MirOTR/src/options.cpp @@ -559,8 +559,8 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM PROTOACCOUNT *pa = Proto_GetAccount(proto); ListView_SetItemText(lv, lvI.iItem, 1, pa->tszAccountName); - ListView_SetItemText(lv, lvI.iItem, 2, (wchar_t*)policy_to_string((OtrlPolicy)db_get_dw(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY))); - ListView_SetItemText(lv, lvI.iItem, 3, (db_get_b(hContact, MODULENAME, "HTMLConv", 0)) ? TranslateW(LANG_YES) : TranslateW(LANG_NO)); + ListView_SetItemText(lv, lvI.iItem, 2, (wchar_t*)policy_to_string((OtrlPolicy)g_plugin.getDword(hContact, "Policy", CONTACT_DEFAULT_POLICY))); + ListView_SetItemText(lv, lvI.iItem, 3, (g_plugin.getByte(hContact, "HTMLConv", 0)) ? TranslateW(LANG_YES) : TranslateW(LANG_NO)); } } } diff --git a/plugins/MirOTR/src/otr.cpp b/plugins/MirOTR/src/otr.cpp index 56c51be1a8..a668ba63e9 100644 --- a/plugins/MirOTR/src/otr.cpp +++ b/plugins/MirOTR/src/otr.cpp @@ -83,10 +83,10 @@ extern "C" { MCONTACT hContact = (UINT_PTR)opdata; DWORD pol; if (hContact) { - pol = db_get_dw(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY); + pol = g_plugin.getDword(hContact, "Policy", CONTACT_DEFAULT_POLICY); if (options.bHaveSecureIM && pol != OTRL_POLICY_MANUAL_MOD && pol != OTRL_POLICY_NEVER && db_get_b(hContact, "SecureIM", "StatusID", 0)) { // if SecureIM is not disabled for this contact, MirOTR will be set to manual - db_set_dw(hContact, MODULENAME, "Policy", OTRL_POLICY_MANUAL_MOD); + g_plugin.setDword(hContact, "Policy", OTRL_POLICY_MANUAL_MOD); return OTRL_POLICY_MANUAL_MOD; } if (pol != CONTACT_DEFAULT_POLICY) return pol; diff --git a/plugins/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/src/svcs_menu.cpp index d0104d60dc..a4c7797fb5 100644 --- a/plugins/MirOTR/src/svcs_menu.cpp +++ b/plugins/MirOTR/src/svcs_menu.cpp @@ -11,7 +11,7 @@ int StartOTR(MCONTACT hContact) if (!proto) return 1; // error char *uname = contact_get_id(hContact); if (!uname) return 1; // error - DWORD pol = db_get_dw(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY); + DWORD pol = g_plugin.getDword(hContact, "Policy", CONTACT_DEFAULT_POLICY); if (pol == CONTACT_DEFAULT_POLICY) pol = options.default_policy; lib_cs_lock(); @@ -143,10 +143,10 @@ INT_PTR SVC_ToggleHTMLOTR(WPARAM hContact, LPARAM) if (hSub != 0) hContact = hSub; - if (db_get_b(hContact, MODULENAME, "HTMLConv", 0)) - db_set_b(hContact, MODULENAME, "HTMLConv", 0); + if (g_plugin.getByte(hContact, "HTMLConv", 0)) + g_plugin.setByte(hContact, "HTMLConv", 0); else - db_set_b(hContact, MODULENAME, "HTMLConv", 1); + g_plugin.setByte(hContact, "HTMLConv", 1); return 0; } @@ -199,7 +199,7 @@ int SVC_PrebuildContactMenu(WPARAM hContact, LPARAM) if ((caps & PF1_IM) == 0) return 0; - DWORD pol = db_get_dw(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY); + DWORD pol = g_plugin.getDword(hContact, "Policy", CONTACT_DEFAULT_POLICY); if (pol == CONTACT_DEFAULT_POLICY) pol = options.default_policy; diff --git a/plugins/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/src/svcs_srmm.cpp index 6b4c70d1e5..34053374b2 100644 --- a/plugins/MirOTR/src/svcs_srmm.cpp +++ b/plugins/MirOTR/src/svcs_srmm.cpp @@ -65,7 +65,7 @@ void SetEncryptionStatus(MCONTACT hContact, TrustLevel level) Srmm_ModifyIcon(hContact, &sid2); Srmm_SetButtonState(hContact, &button); - db_set_dw(hContact, MODULENAME, "TrustLevel", level); + g_plugin.setDword(hContact, "TrustLevel", level); if (!chat_room) { MCONTACT hMeta = db_mc_getMeta(hContact); diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index 5d61ced0a1..cec37e9e5f 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -502,7 +502,7 @@ public: sItem.pszText = szTmp; listUsers.SetItem(&sItem); - listUsers.SetCheckState(sItem.iItem, db_get_b(hContact, MODULENAME, "EnableLog", 1)); + listUsers.SetCheckState(sItem.iItem, g_plugin.getByte(hContact, "EnableLog", 1)); } listUsers.SortItems(CompareFunc, 1); diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp index 43b596af48..6840363e3f 100644 --- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp +++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp @@ -176,7 +176,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) COptPage AutoreplyOptData(g_AutoreplyOptPage); AutoreplyOptData.DBToMem(); if (dbei->eventType == EVENTTYPE_MESSAGE) - db_set_w(hContact, MODULENAME, DB_MESSAGECOUNT, db_get_w(hContact, MODULENAME, DB_MESSAGECOUNT, 0) + 1); // increment message counter + g_plugin.setWord(hContact, DB_MESSAGECOUNT, g_plugin.getWord(hContact, DB_MESSAGECOUNT, 0) + 1); // increment message counter if (AutoreplyOptData.GetValue(StatusModeList[i].DisableReplyCtlID)) return 0; @@ -210,7 +210,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) int SendCount = (int)AutoreplyOptData.GetValue(IDC_REPLYDLG_SENDCOUNT); if ((AutoreplyOptData.GetValue(IDC_REPLYDLG_DONTSENDTOICQ) && UIN) || // an icq contact - (SendCount != -1 && db_get_b(hContact, MODULENAME, DB_SENDCOUNT, 0) >= SendCount)) + (SendCount != -1 && g_plugin.getByte(hContact, DB_SENDCOUNT, 0) >= SendCount)) return 0; if ((dbei->eventType == EVENTTYPE_MESSAGE && !AutoreplyOptData.GetValue(IDC_REPLYDLG_EVENTMSG)) || @@ -218,7 +218,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) (dbei->eventType == EVENTTYPE_FILE && !AutoreplyOptData.GetValue(IDC_REPLYDLG_EVENTFILE))) return 0; - db_set_b(hContact, MODULENAME, DB_SENDCOUNT, db_get_b(hContact, MODULENAME, DB_SENDCOUNT, 0) + 1); + g_plugin.setByte(hContact, DB_SENDCOUNT, g_plugin.getByte(hContact, DB_SENDCOUNT, 0) + 1); GetDynamicStatMsg(hContact); // it updates VarParseData.Message needed for %extratext% in the format TCString Reply(*(TCString*)AutoreplyOptData.GetValue(IDC_REPLYDLG_PREFIX)); if (Reply != nullptr && ServiceExists(MS_VARS_FORMATSTRING) && !g_SetAwayMsgPage.GetDBValueCopy(IDS_SAWAYMSG_DISABLEVARIABLES)) { diff --git a/plugins/NewAwaySysMod/src/Properties.cpp b/plugins/NewAwaySysMod/src/Properties.cpp index 2d85ad477c..b746c6d6fc 100644 --- a/plugins/NewAwaySysMod/src/Properties.cpp +++ b/plugins/NewAwaySysMod/src/Properties.cpp @@ -24,9 +24,9 @@ CProtoStates g_ProtoStates; void ResetContactSettingsOnStatusChange(MCONTACT hContact) { - db_unset(hContact, MODULENAME, DB_REQUESTCOUNT); - db_unset(hContact, MODULENAME, DB_SENDCOUNT); - db_unset(hContact, MODULENAME, DB_MESSAGECOUNT); + g_plugin.delSetting(hContact, DB_REQUESTCOUNT); + g_plugin.delSetting(hContact, DB_SENDCOUNT); + g_plugin.delSetting(hContact, DB_MESSAGECOUNT); } void ResetSettingsOnStatusChange(const char *szProto = nullptr, int bResetPersonalMsgs = false, int Status = 0) diff --git a/plugins/NewAwaySysMod/src/Properties.h b/plugins/NewAwaySysMod/src/Properties.h index fa1e083f7b..506c160076 100644 --- a/plugins/NewAwaySysMod/src/Properties.h +++ b/plugins/NewAwaySysMod/src/Properties.h @@ -421,9 +421,9 @@ public: CString Setting(Parent->ContactStatusToDBSetting(DB_IGNOREREQUESTS, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS)); MCONTACT hContact = (Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL; if (m_value) - db_set_b(hContact, MODULENAME, Setting, 1); + g_plugin.setByte(hContact, Setting, 1); else - db_unset(hContact, MODULENAME, Setting); + g_plugin.delSetting(hContact, Setting); return *this; } @@ -445,13 +445,13 @@ public: { CString Setting(Parent->ContactStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS)); MCONTACT hContact = (Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL; - if (db_get_b(hContact, MODULENAME, Setting, VAL_USEDEFAULT) == m_value) + if (g_plugin.getByte(hContact, Setting, VAL_USEDEFAULT) == m_value) return *this; if (m_value != VAL_USEDEFAULT) - db_set_b(hContact, MODULENAME, Setting, m_value != 0); + g_plugin.setByte(hContact, Setting, m_value != 0); else - db_unset(hContact, MODULENAME, Setting); + g_plugin.delSetting(hContact, Setting); return *this; } operator int() {return db_get_b((Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL, MODULENAME, Parent->ContactStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS), Parent->m_hContact ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY);} diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index 81e162fff5..c9fd96bcdf 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -284,7 +284,7 @@ void ImportKey(MCONTACT hContact, std::wstring new_key) } else db_set_ws(metaGetMostOnline(hContact), MODULENAME, "GPGPubKey", new_key.c_str()); } - else db_set_ws(hContact, MODULENAME, "GPGPubKey", new_key.c_str()); + else g_plugin.setWString(hContact, "GPGPubKey", new_key.c_str()); // gpg execute block std::vector cmd; @@ -454,7 +454,7 @@ void ImportKey(MCONTACT hContact, std::wstring new_key) char *tmp = nullptr; string::size_type s = output.find("gpg: key ") + mir_strlen("gpg: key "); string::size_type s2 = output.find(":", s); - db_set_s(hContact, MODULENAME, "KeyID", output.substr(s, s2 - s).c_str()); + g_plugin.setString(hContact, "KeyID", output.substr(s, s2 - s).c_str()); s = output.find("“", s2); if (s == string::npos) { s = output.find("\"", s2); @@ -475,7 +475,7 @@ void ImportKey(MCONTACT hContact, std::wstring new_key) tmp = (char*)mir_alloc(sizeof(char)*(output.substr(s, s2 - s - (uncommon ? 1 : 0)).length() + 1)); mir_strcpy(tmp, output.substr(s, s2 - s - (uncommon ? 1 : 0)).c_str()); mir_utf8decode(tmp, nullptr); - db_set_s(hContact, MODULENAME, "KeyMainName", tmp); + g_plugin.setString(hContact, "KeyMainName", tmp); mir_free(tmp); } if ((s = output.find(")", s2)) == string::npos) @@ -488,7 +488,7 @@ void ImportKey(MCONTACT hContact, std::wstring new_key) tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2, s - s2).length() + 1)); mir_strcpy(tmp, output.substr(s2, s - s2).c_str()); mir_utf8decode(tmp, nullptr); - db_set_s(hContact, MODULENAME, "KeyComment", tmp); + g_plugin.setString(hContact, "KeyComment", tmp); mir_free(tmp); s += 3; s2 = output.find(">", s); @@ -496,7 +496,7 @@ void ImportKey(MCONTACT hContact, std::wstring new_key) tmp = (char*)mir_alloc(sizeof(char)*(output.substr(s, s2 - s).length() + 1)); mir_strcpy(tmp, output.substr(s, s2 - s).c_str()); mir_utf8decode(tmp, nullptr); - db_set_s(hContact, MODULENAME, "KeyMainEmail", tmp); + g_plugin.setString(hContact, "KeyMainEmail", tmp); mir_free(tmp); } } @@ -504,11 +504,11 @@ void ImportKey(MCONTACT hContact, std::wstring new_key) tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2, s - s2).length() + 1)); mir_strcpy(tmp, output.substr(s2, s - s2).c_str()); mir_utf8decode(tmp, nullptr); - db_set_s(hContact, MODULENAME, "KeyMainEmail", output.substr(s2, s - s2).c_str()); + g_plugin.setString(hContact, "KeyMainEmail", output.substr(s2, s - s2).c_str()); mir_free(tmp); } } - db_unset(hContact, MODULENAME, "bAlwatsTrust"); + g_plugin.delSetting(hContact, "bAlwatsTrust"); } MessageBox(nullptr, toUTF16(output).c_str(), L"", MB_OK); diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index 526227ae1f..1189fca923 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -95,7 +95,7 @@ static void RecvMsgSvc_func(RecvParams *param) ::Sleep(step); count += step; if (count >= timeout) { - db_set_b(hContact, MODULENAME, "GPGEncryption", 0); + g_plugin.setByte(hContact, "GPGEncryption", 0); setSrmmIcon(hContact); setClistIcon(hContact); globals.debuglog << std::string(time_str() + "info: failed to create temporary file for decryption, disabling gpg for contact to avoid deadlock"); @@ -167,11 +167,11 @@ static void RecvMsgSvc_func(RecvParams *param) boost::filesystem::remove(path, e); } HistoryLog(hContact, db_event(param->msg, param->timestamp, 0, dbflags)); - BYTE enc = db_get_b(hContact, MODULENAME, "GPGEncryption", 0); - db_set_b(hContact, MODULENAME, "GPGEncryption", 0); + BYTE enc = g_plugin.getByte(hContact, "GPGEncryption", 0); + g_plugin.setByte(hContact, "GPGEncryption", 0); ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)"Unable to decrypt PGP encrypted message"); HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); - db_set_b(hContact, MODULENAME, "GPGEncryption", enc); + g_plugin.setByte(hContact, "GPGEncryption", enc); delete param; return; } @@ -192,11 +192,11 @@ static void RecvMsgSvc_func(RecvParams *param) if (globals.bDebugLog) globals.debuglog << std::string(time_str() + ": info: failed to decrypt messaage from " + toUTF8(Clist_GetContactDisplayName(hContact)) + " password needed, trying to get one"); if (globals._terminate) { - BYTE enc = db_get_b(hContact, MODULENAME, "GPGEncryption", 0); - db_set_b(hContact, MODULENAME, "GPGEncryption", 0); + BYTE enc = g_plugin.getByte(hContact, "GPGEncryption", 0); + g_plugin.setByte(hContact, "GPGEncryption", 0); ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)"Unable to decrypt PGP encrypted message"); HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); - db_set_b(hContact, MODULENAME, "GPGEncryption", enc); + g_plugin.setByte(hContact, "GPGEncryption", enc); break; } { //save inkey id @@ -230,11 +230,11 @@ static void RecvMsgSvc_func(RecvParams *param) } HistoryLog(hContact, db_event(param->msg, param->timestamp, 0, dbflags)); - BYTE enc = db_get_b(hContact, MODULENAME, "GPGEncryption", 0); - db_set_b(hContact, MODULENAME, "GPGEncryption", 0); + BYTE enc = g_plugin.getByte(hContact, "GPGEncryption", 0); + g_plugin.setByte(hContact, "GPGEncryption", 0); ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)"Unable to decrypt PGP encrypted message"); HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); - db_set_b(hContact, MODULENAME, "GPGEncryption", enc); + g_plugin.setByte(hContact, "GPGEncryption", enc); delete param; return; } @@ -257,11 +257,11 @@ static void RecvMsgSvc_func(RecvParams *param) } HistoryLog(hContact, db_event(param->msg, param->timestamp, 0, dbflags)); - BYTE enc = db_get_b(hContact, MODULENAME, "GPGEncryption", 0); - db_set_b(hContact, MODULENAME, "GPGEncryption", 0); + BYTE enc = g_plugin.getByte(hContact, "GPGEncryption", 0); + g_plugin.setByte(hContact, "GPGEncryption", 0); ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)"Unable to decrypt PGP encrypted message"); HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); - db_set_b(hContact, MODULENAME, "GPGEncryption", enc); + g_plugin.setByte(hContact, "GPGEncryption", enc); delete param; return; } @@ -289,11 +289,11 @@ static void RecvMsgSvc_func(RecvParams *param) ptrA tmp4((char*)mir_alloc(sizeof(char)*(str1.length() + 1))); mir_strcpy(tmp4, str1.c_str()); HistoryLog(hContact, db_event(param->msg, param->timestamp, 0, dbflags)); - BYTE enc = db_get_b(hContact, MODULENAME, "GPGEncryption", 0); - db_set_b(hContact, MODULENAME, "GPGEncryption", 0); + BYTE enc = g_plugin.getByte(hContact, "GPGEncryption", 0); + g_plugin.setByte(hContact, "GPGEncryption", 0); ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)"Unable to decrypt PGP encrypted message"); HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); - db_set_b(hContact, MODULENAME, "GPGEncryption", enc); + g_plugin.setByte(hContact, "GPGEncryption", enc); delete param; return; } @@ -329,11 +329,11 @@ static void RecvMsgSvc_func(RecvParams *param) globals.debuglog << std::string(time_str() + ": info: Failed to decrypt GPG encrypted message."); HistoryLog(hContact, db_event(param->msg, param->timestamp, 0, dbflags)); - BYTE enc = db_get_b(hContact, MODULENAME, "GPGEncryption", 0); - db_set_b(hContact, MODULENAME, "GPGEncryption", 0); + BYTE enc = g_plugin.getByte(hContact, "GPGEncryption", 0); + g_plugin.setByte(hContact, "GPGEncryption", 0); ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)"Unable to decrypt PGP encrypted message"); HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT)); - db_set_b(hContact, MODULENAME, "GPGEncryption", enc); + g_plugin.setByte(hContact, "GPGEncryption", enc); delete param; return; } @@ -629,7 +629,7 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags) cmd.push_back(L"\"\""); cmd.push_back(L"--no-version"); } - if (db_get_b(hContact, MODULENAME, "bAlwaysTrust", 0)) { + if (g_plugin.getByte(hContact, "bAlwaysTrust", 0)) { cmd.push_back(L"--trust-model"); cmd.push_back(L"always"); } @@ -658,7 +658,7 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags) ::Sleep(step); count += step; if (count >= timeout) { - db_set_b(hContact, MODULENAME, "GPGEncryption", 0); //disable encryption + g_plugin.setByte(hContact, "GPGEncryption", 0); //disable encryption setSrmmIcon(hContact); setClistIcon(hContact); globals.debuglog << std::string(time_str() + ": info: failed to create temporary file for encryption, disabling encryption to avoid deadlock"); @@ -693,7 +693,7 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags) if (out.find("There is no assurance this key belongs to the named user") != string::npos) { out.clear(); if (MessageBox(nullptr, TranslateT("We're trying to encrypt with untrusted key. Do you want to trust this key permanently?"), TranslateT("Warning"), MB_YESNO) == IDYES) { - db_set_b(hContact, MODULENAME, "bAlwaysTrust", 1); + g_plugin.setByte(hContact, "bAlwaysTrust", 1); std::vector tmp; tmp.push_back(L"--trust-model"); tmp.push_back(L"always"); @@ -739,7 +739,7 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags) f.open(path.c_str(), std::ios::in | std::ios::ate | std::ios::binary); count += step; if (count >= timeout) { - db_set_b(hContact, MODULENAME, "GPGEncryption", 0); //disable encryption + g_plugin.setByte(hContact, "GPGEncryption", 0); //disable encryption setSrmmIcon(hContact); setClistIcon(hContact); globals.debuglog << std::string(time_str() + ": info: gpg failed to encrypt message, disabling encryption to avoid deadlock"); diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index abf4af389d..b42c4f8d30 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -95,7 +95,7 @@ public: mir_free(tmp); - if (db_get_b(hContact, MODULENAME, "GPGEncryption", 0)) + if (g_plugin.getByte(hContact, "GPGEncryption", 0)) list_USERLIST.SetCheckState(row, 1); user_data[i] = hContact; list_USERLIST.SetColumnWidth(0, LVSCW_AUTOSIZE); @@ -233,12 +233,12 @@ public: } } else { - db_unset(hContact, MODULENAME, "KeyID"); - db_unset(hContact, MODULENAME, "GPGPubKey"); - db_unset(hContact, MODULENAME, "KeyMainName"); - db_unset(hContact, MODULENAME, "KeyType"); - db_unset(hContact, MODULENAME, "KeyMainEmail"); - db_unset(hContact, MODULENAME, "KeyComment"); + g_plugin.delSetting(hContact, "KeyID"); + g_plugin.delSetting(hContact, "GPGPubKey"); + g_plugin.delSetting(hContact, "KeyMainName"); + g_plugin.delSetting(hContact, "KeyType"); + g_plugin.delSetting(hContact, "KeyMainEmail"); + g_plugin.delSetting(hContact, "KeyComment"); setClistIcon(hContact); setSrmmIcon(hContact); } @@ -730,7 +730,7 @@ public: } else db_set_ws(metaGetMostOnline(hContact), MODULENAME, "GPGPubKey", key_buf.substr(ws1, ws2 - ws1).c_str()); } - else db_set_ws(hContact, MODULENAME, "GPGPubKey", key_buf.substr(ws1, ws2 - ws1).c_str()); + else g_plugin.setWString(hContact, "GPGPubKey", key_buf.substr(ws1, ws2 - ws1).c_str()); } tmp = (wchar_t*)mir_alloc(sizeof(wchar_t) * (key_buf.length() + 1)); mir_wstrcpy(tmp, key_buf.substr(ws1, ws2 - ws1).c_str()); @@ -785,7 +785,7 @@ public: } else db_unset(metaGetMostOnline(hContact), MODULENAME, "bAlwatsTrust"); } - else db_unset(hContact, MODULENAME, "bAlwatsTrust"); + else g_plugin.delSetting(hContact, "bAlwatsTrust"); } { if (output.find("already in secret keyring") != string::npos) { @@ -813,7 +813,7 @@ public: db_set_s(metaGetMostOnline(hContact), MODULENAME, "KeyID", tmp3); } else - db_set_s(hContact, MODULENAME, "KeyID", tmp3); + g_plugin.setString(hContact, "KeyID", tmp3); } mir_free(tmp3); } @@ -849,12 +849,12 @@ public: for (int i = 0; i < count; i++) { MCONTACT hcnt = db_mc_getSub(hContact, i); if (hcnt) - db_set_s(hcnt, MODULENAME, "KeyMainName", output.substr(s, s2 - s - 1).c_str()); + g_plugin.setString(hcnt, "KeyMainName", output.substr(s, s2 - s - 1).c_str()); } } - else db_set_s(metaGetMostOnline(hContact), MODULENAME, "KeyMainName", output.substr(s, s2 - s - 1).c_str()); + else g_plugin.setString(metaGetMostOnline(hContact), "KeyMainName", output.substr(s, s2 - s - 1).c_str()); } - else db_set_s(hContact, MODULENAME, "KeyMainName", output.substr(s, s2 - s - 1).c_str()); + else g_plugin.setString(hContact, "KeyMainName", output.substr(s, s2 - s - 1).c_str()); } mir_free(tmp3); } @@ -879,12 +879,12 @@ public: for (int i = 0; i < count; i++) { MCONTACT hcnt = db_mc_getSub(hContact, i); if (hcnt) - db_set_s(hcnt, MODULENAME, "KeyComment", output.substr(s2, s - s2).c_str()); + g_plugin.setString(hcnt, "KeyComment", output.substr(s2, s - s2).c_str()); } } - else db_set_s(metaGetMostOnline(hContact), MODULENAME, "KeyComment", output.substr(s2, s - s2).c_str()); + else g_plugin.setString(metaGetMostOnline(hContact), "KeyComment", output.substr(s2, s - s2).c_str()); } - else db_set_s(hContact, MODULENAME, "KeyComment", output.substr(s2, s - s2).c_str()); + else g_plugin.setString(hContact, "KeyComment", output.substr(s2, s - s2).c_str()); } mir_free(tmp3); s += 3; @@ -899,12 +899,12 @@ public: for (int i = 0; i < count; i++) { MCONTACT hcnt = db_mc_getSub(hContact, i); if (hcnt) - db_set_s(hcnt, MODULENAME, "KeyMainEmail", output.substr(s, s2 - s).c_str()); + g_plugin.setString(hcnt, "KeyMainEmail", output.substr(s, s2 - s).c_str()); } } - else db_set_s(metaGetMostOnline(hContact), MODULENAME, "KeyMainEmail", output.substr(s, s2 - s).c_str()); + else g_plugin.setString(metaGetMostOnline(hContact), "KeyMainEmail", output.substr(s, s2 - s).c_str()); } - else db_set_s(hContact, MODULENAME, "KeyMainEmail", output.substr(s, s2 - s).c_str()); + else g_plugin.setString(hContact, "KeyMainEmail", output.substr(s, s2 - s).c_str()); } mir_free(tmp3); tmp = mir_wstrdup(toUTF16(output.substr(s, s2 - s)).c_str()); @@ -923,12 +923,12 @@ public: for (int i = 0; i < count; i++) { MCONTACT hcnt = db_mc_getSub(hContact, i); if (hcnt) - db_set_s(hcnt, MODULENAME, "KeyMainEmail", output.substr(s2, s - s2).c_str()); + g_plugin.setString(hcnt, "KeyMainEmail", output.substr(s2, s - s2).c_str()); } } - else db_set_s(metaGetMostOnline(hContact), MODULENAME, "KeyMainEmail", output.substr(s2, s - s2).c_str()); + else g_plugin.setString(metaGetMostOnline(hContact), "KeyMainEmail", output.substr(s2, s - s2).c_str()); } - else db_set_s(hContact, MODULENAME, "KeyMainEmail", output.substr(s2, s - s2).c_str()); + else g_plugin.setString(hContact, "KeyMainEmail", output.substr(s2, s - s2).c_str()); } mir_free(tmp3); tmp = mir_wstrdup(toUTF16(output.substr(s2, s - s2)).c_str()); @@ -970,7 +970,7 @@ public: while ((s = out.find("\r", s)) != string::npos) { out.erase(s, 1); } - db_set_s(hContact, MODULENAME, "GPGPubKey", out.c_str()); + g_plugin.setString(hContact, "GPGPubKey", out.c_str()); } } tmp = mir_wstrdup(toUTF16(output).c_str()); @@ -1002,9 +1002,9 @@ public: db_set_b(metaGetMostOnline(hContact), MODULENAME, "GPGEncryption", 0); } else if (!isContactSecured(hContact)) - db_set_b(hContact, MODULENAME, "GPGEncryption", 1); + g_plugin.setByte(hContact, "GPGEncryption", 1); else - db_set_b(hContact, MODULENAME, "GPGEncryption", 0); + g_plugin.setByte(hContact, "GPGEncryption", 0); } } this->Close(); diff --git a/plugins/New_GPG/src/srmm.cpp b/plugins/New_GPG/src/srmm.cpp index 129cb29570..7adf54ff34 100755 --- a/plugins/New_GPG/src/srmm.cpp +++ b/plugins/New_GPG/src/srmm.cpp @@ -41,9 +41,9 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) if (mir_strcmp(sicd->szModule, MODULENAME)) return 0; // not our event - BYTE enc = db_get_b(hContact, MODULENAME, "GPGEncryption", 0); + BYTE enc = g_plugin.getByte(hContact, "GPGEncryption", 0); if (enc) { - db_set_b(hContact, MODULENAME, "GPGEncryption", 0); + g_plugin.setByte(hContact, "GPGEncryption", 0); hMeta ? db_set_b(hMeta, MODULENAME, "GPGEncryption", 0) : 0; setSrmmIcon(hContact); setClistIcon(hContact); @@ -56,14 +56,14 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) ShowLoadPublicKeyDialog(); } else { - db_set_b(hContact, MODULENAME, "GPGEncryption", 1); + g_plugin.setByte(hContact, "GPGEncryption", 1); hMeta ? db_set_b(hMeta, MODULENAME, "GPGEncryption", 1) : 0; setSrmmIcon(hContact); setClistIcon(hContact); return 0; } if (isContactHaveKey(hContact)) { - db_set_b(hContact, MODULENAME, "GPGEncryption", 1); + g_plugin.setByte(hContact, "GPGEncryption", 1); hMeta ? db_set_b(hMeta, MODULENAME, "GPGEncryption", 1) : 0; setSrmmIcon(hContact); setClistIcon(hContact); diff --git a/plugins/New_GPG/src/ui.cpp b/plugins/New_GPG/src/ui.cpp index fdf68a5bff..e651779b50 100755 --- a/plugins/New_GPG/src/ui.cpp +++ b/plugins/New_GPG/src/ui.cpp @@ -944,7 +944,7 @@ bool CDlgNewKey::OnInitDialog() SetWindowPos(m_hwnd, nullptr, globals.new_key_rect.left, globals.new_key_rect.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); wchar_t *tmp = UniGetContactSettingUtf(hContact, MODULENAME, "GPGPubKey", L""); lbl_MESSAGE.SetText(tmp[0] ? TranslateT("There is existing key for contact, would you like to replace it with new key?") : TranslateT("New public key was received, do you want to import it?")); - btn_IMPORT_AND_USE.Enable(db_get_b(hContact, MODULENAME, "GPGEncryption", 0)); + btn_IMPORT_AND_USE.Enable(g_plugin.getByte(hContact, "GPGEncryption", 0)); btn_IMPORT.SetText(tmp[0] ? TranslateT("Replace") : TranslateT("Accept")); mir_free(tmp); tmp = new wchar_t[256]; @@ -970,7 +970,7 @@ void CDlgNewKey::onClick_IMPORT(CCtrlButton*) void CDlgNewKey::onClick_IMPORT_AND_USE(CCtrlButton*) { ImportKey(hContact, new_key); - db_set_b(hContact, MODULENAME, "GPGEncryption", 1); + g_plugin.setByte(hContact, "GPGEncryption", 1); void setSrmmIcon(MCONTACT hContact); void setClistIcon(MCONTACT hContact); setSrmmIcon(hContact); diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index bbb140f0c7..84096558b8 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -163,8 +163,8 @@ INT_PTR SendKey(WPARAM w, LPARAM) } } if (szMessage[0]) { - BYTE enc = db_get_b(hContact, MODULENAME, "GPGEncryption", 0); - db_set_b(hContact, MODULENAME, "GPGEncryption", 0); + BYTE enc = g_plugin.getByte(hContact, "GPGEncryption", 0); + g_plugin.setByte(hContact, "GPGEncryption", 0); ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)szMessage); std::string msg = "Public key "; char *keyid = UniGetContactSettingUtf(0, MODULENAME, key_id_str.c_str(), ""); @@ -178,7 +178,7 @@ INT_PTR SendKey(WPARAM w, LPARAM) mir_free(szMessage); szMessage = mir_strdup(msg.c_str()); HistoryLog(hContact, db_event(szMessage, 0, 0, DBEF_SENT)); - db_set_b(hContact, MODULENAME, "GPGEncryption", enc); + g_plugin.setByte(hContact, "GPGEncryption", enc); } else mir_free(szMessage); @@ -198,12 +198,12 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM) if (hcnt) db_set_b(hcnt, MODULENAME, "GPGEncryption", enc ? 0 : 1); } - db_set_b(hContact, MODULENAME, "GPGEncryption", enc ? 0 : 1); + g_plugin.setByte(hContact, "GPGEncryption", enc ? 0 : 1); } } else { - enc = db_get_b(hContact, MODULENAME, "GPGEncryption", 0); - db_set_b(hContact, MODULENAME, "GPGEncryption", enc ? 0 : 1); + enc = g_plugin.getByte(hContact, "GPGEncryption", 0); + g_plugin.setByte(hContact, "GPGEncryption", enc ? 0 : 1); } void setSrmmIcon(MCONTACT hContact); void setClistIcon(MCONTACT hContact); @@ -243,13 +243,13 @@ int OnPreBuildContactMenu(WPARAM w, LPARAM) int flags; wchar_t *tmp = UniGetContactSettingUtf(hContact, MODULENAME, "GPGPubKey", L""); if (!tmp[0]) { - db_unset(hContact, MODULENAME, "GPGEncryption"); + g_plugin.delSetting(hContact, "GPGEncryption"); flags = CMIF_GRAYED; } else flags = 0; Menu_ModifyItem(globals.hToggleEncryption, - db_get_b(hContact, MODULENAME, "GPGEncryption", 0) ? L"Turn off GPG encryption" : L"Turn on GPG encryption", + g_plugin.getByte(hContact, "GPGEncryption", 0) ? L"Turn off GPG encryption" : L"Turn on GPG encryption", INVALID_HANDLE_VALUE, flags); mir_free(tmp); return 0; @@ -938,7 +938,7 @@ void AddHandlers() bool isContactSecured(MCONTACT hContact) { - BYTE gpg_enc = db_get_b(hContact, MODULENAME, "GPGEncryption", 0); + BYTE gpg_enc = g_plugin.getByte(hContact, "GPGEncryption", 0); if (!gpg_enc) { if (globals.bDebugLog) globals.debuglog << std::string(time_str() + ": encryption is turned off for " + toUTF8(Clist_GetContactDisplayName(hContact))); @@ -1075,7 +1075,7 @@ const bool StriStr(const char *str, const char *substr) bool IsOnline(MCONTACT hContact) { - if (db_get_b(hContact, MODULENAME, "Status", 0) == ID_STATUS_OFFLINE) + if (g_plugin.getByte(hContact, "Status", 0) == ID_STATUS_OFFLINE) return false; return true; } @@ -1632,7 +1632,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) tmp2 = (char*)mir_alloc((output.substr(s, s2 - s).length() + 1) * sizeof(char)); mir_strcpy(tmp2, output.substr(s, s2 - s).c_str()); mir_utf8decode(tmp2, nullptr); - db_set_s(hContact, MODULENAME, "KeyID", tmp2); + g_plugin.setString(hContact, "KeyID", tmp2); mir_free(tmp2); s = output.find("“", s2); if (s == string::npos) { @@ -1650,7 +1650,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) mir_strcpy(tmp2, output.substr(s, s2 - s - 1).c_str()); mir_utf8decode(tmp2, nullptr); if (hContact) { - db_set_s(hContact, MODULENAME, "KeyMainName", output.substr(s, s2 - s - 1).c_str()); + g_plugin.setString(hContact, "KeyMainName", output.substr(s, s2 - s - 1).c_str()); } mir_free(tmp2); if ((s = output.find(")", s2)) == string::npos) @@ -1663,7 +1663,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) mir_strcpy(tmp2, output.substr(s2, s - s2).c_str()); mir_utf8decode(tmp2, nullptr); if (hContact) - db_set_s(hContact, MODULENAME, "KeyComment", output.substr(s2, s - s2).c_str()); + g_plugin.setString(hContact, "KeyComment", output.substr(s2, s - s2).c_str()); mir_free(tmp2); s += 3; s2 = output.find(">", s); @@ -1671,7 +1671,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) mir_strcpy(tmp2, output.substr(s, s2 - s).c_str()); mir_utf8decode(tmp2, nullptr); if (hContact) - db_set_s(hContact, MODULENAME, "KeyMainEmail", output.substr(s, s2 - s).c_str()); + g_plugin.setString(hContact, "KeyMainEmail", output.substr(s, s2 - s).c_str()); mir_free(tmp2); } else { @@ -1679,12 +1679,12 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) mir_strcpy(tmp2, output.substr(s2, s - s2).c_str()); mir_utf8decode(tmp2, nullptr); if (hContact) - db_set_s(hContact, MODULENAME, "KeyMainEmail", output.substr(s2, s - s2).c_str()); + g_plugin.setString(hContact, "KeyMainEmail", output.substr(s2, s - s2).c_str()); mir_free(tmp2); } } - db_set_b(hContact, MODULENAME, "GPGEncryption", 1); - db_set_ws(hContact, MODULENAME, "GPGPubKey", toUTF16(key).c_str()); + g_plugin.setByte(hContact, "GPGEncryption", 1); + g_plugin.setWString(hContact, "GPGPubKey", toUTF16(key).c_str()); } boost::filesystem::remove(path); break; diff --git a/plugins/Popup/src/opt_contacts.cpp b/plugins/Popup/src/opt_contacts.cpp index cfca450f13..af65fe46f5 100644 --- a/plugins/Popup/src/opt_contacts.cpp +++ b/plugins/Popup/src/opt_contacts.cpp @@ -32,7 +32,7 @@ static void sttSetAllContactIcons(HWND hwndList) { for (auto &hContact : Contacts()) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0); - DWORD dwMode = db_get_b(hContact, MODULENAME, "ShowMode", 0); + DWORD dwMode = g_plugin.getByte(hContact, "ShowMode", 0); for (int i = 0; i < 4 /*_countof(sttIcons)*/; ++i) // hIml element [0] = SKINICON_OTHER_SMALLDOT // hIml element [1..5] = IcoLib_GetIcon(....) ~ old sttIcons @@ -103,7 +103,7 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM, LPARAM lParam) HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0); for (int i = 0; i < 4 /*_countof(sttIcons)*/; ++i) { if (SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, 0))) { - db_set_b(hContact, MODULENAME, "ShowMode", i); + g_plugin.setByte(hContact, "ShowMode", i); break; } } diff --git a/plugins/Popup/src/srmm_menu.cpp b/plugins/Popup/src/srmm_menu.cpp index 2ff5091fba..62f1d1403a 100644 --- a/plugins/Popup/src/srmm_menu.cpp +++ b/plugins/Popup/src/srmm_menu.cpp @@ -36,7 +36,7 @@ static void SrmmMenu_UpdateIcon(MCONTACT hContact) if (!hContact) return; - int mode = db_get_b(hContact, MODULENAME, "ShowMode", PU_SHOWMODE_AUTO); + int mode = g_plugin.getByte(hContact, "ShowMode", PU_SHOWMODE_AUTO); StatusIconData sid = {}; sid.szModule = MODULENAME; @@ -76,7 +76,7 @@ static int SrmmMenu_ProcessIconClick(WPARAM hContact, LPARAM lParam) if (!hContact) return 0; - int mode = db_get_b(hContact, MODULENAME, "ShowMode", PU_SHOWMODE_AUTO); + int mode = g_plugin.getByte(hContact, "ShowMode", PU_SHOWMODE_AUTO); if (sicd->flags & MBCF_RIGHTBUTTON) { HMENU hMenu = CreatePopupMenu(); @@ -90,12 +90,12 @@ static int SrmmMenu_ProcessIconClick(WPARAM hContact, LPARAM lParam) mode = TrackPopupMenu(hMenu, TPM_RETURNCMD, sicd->clickLocation.x, sicd->clickLocation.y, 0, WindowList_Find(hDialogsList, hContact), nullptr); if (mode) { - db_set_b(hContact, MODULENAME, "ShowMode", mode - 1); + g_plugin.setByte(hContact, "ShowMode", mode - 1); SrmmMenu_UpdateIcon(hContact); } } else { - db_set_b(hContact, MODULENAME, "ShowMode", (mode == PU_SHOWMODE_AUTO) ? PU_SHOWMODE_BLOCK : PU_SHOWMODE_AUTO); + g_plugin.setByte(hContact, "ShowMode", (mode == PU_SHOWMODE_AUTO) ? PU_SHOWMODE_BLOCK : PU_SHOWMODE_AUTO); SrmmMenu_UpdateIcon(hContact); } diff --git a/plugins/SecureIM/src/crypt_check.cpp b/plugins/SecureIM/src/crypt_check.cpp index d85f9e0e2b..0b9242d9e2 100644 --- a/plugins/SecureIM/src/crypt_check.cpp +++ b/plugins/SecureIM/src/crypt_check.cpp @@ -38,14 +38,14 @@ BYTE isContactSecured(MCONTACT hContact) break; case MODE_PGP: - if (!db_get_s(hContact, MODULENAME, "pgp", &dbv)) { + if (!g_plugin.getString(hContact, "pgp", &dbv)) { res |= SECURED; db_free(&dbv); } break; case MODE_GPG: - if (!db_get_s(hContact, MODULENAME, "gpg", &dbv)) { + if (!g_plugin.getString(hContact, "gpg", &dbv)) { res |= SECURED; db_free(&dbv); } @@ -137,7 +137,7 @@ bool isContactPGP(MCONTACT hContact) return false; DBVARIANT dbv; - if (db_get_s(hContact, MODULENAME, "pgp", &dbv)) return false; + if (g_plugin.getString(hContact, "pgp", &dbv)) return false; db_free(&dbv); return true; } @@ -151,7 +151,7 @@ bool isContactGPG(MCONTACT hContact) return false; DBVARIANT dbv; - if (db_get_s(hContact, MODULENAME, "gpg", &dbv)) return false; + if (g_plugin.getString(hContact, "gpg", &dbv)) return false; db_free(&dbv); return true; } diff --git a/plugins/SecureIM/src/crypt_dll.cpp b/plugins/SecureIM/src/crypt_dll.cpp index 822f479059..b4a9f03614 100644 --- a/plugins/SecureIM/src/crypt_dll.cpp +++ b/plugins/SecureIM/src/crypt_dll.cpp @@ -89,7 +89,7 @@ BOOL CalculateKeyX(pUinKey ptr, MCONTACT hContact) db_set_blob(hContact, MODULENAME, "offlineKey", buffer, keysize); // store timeout of key in database (2 days) - db_set_dw(hContact, MODULENAME, "offlineKeyTimeout", gettime() + (60 * 60 * 24 * g_plugin.getWord("okt", 2))); + g_plugin.setDword(hContact, "offlineKeyTimeout", gettime() + (60 * 60 * 24 * g_plugin.getWord("okt", 2))); // key exchange is finished showPopupEC(ptr->hContact); diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp index 22d2ec4964..d94b25875b 100644 --- a/plugins/SecureIM/src/crypt_lists.cpp +++ b/plugins/SecureIM/src/crypt_lists.cpp @@ -82,16 +82,16 @@ pUinKey addContact(MCONTACT hContact) p->footer = FOOTER; p->hContact = hContact; p->proto = proto; - p->mode = db_get_b(hContact, MODULENAME, "mode", 99); + p->mode = g_plugin.getByte(hContact, "mode", 99); if (p->mode == 99) { if (isContactPGP(hContact)) p->mode = MODE_PGP; else p->mode = isContactGPG(hContact) ? MODE_GPG : MODE_RSAAES; - db_set_b(hContact, MODULENAME, "mode", p->mode); + g_plugin.setByte(hContact, "mode", p->mode); } - p->status = db_get_b(hContact, MODULENAME, "StatusID", STATUS_ENABLED); - p->gpgMode = db_get_b(hContact, MODULENAME, "gpgANSI", 0); + p->status = g_plugin.getByte(hContact, "StatusID", STATUS_ENABLED); + p->gpgMode = g_plugin.getByte(hContact, "gpgANSI", 0); arClist.insert(p); return p; } diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index e1ba269df9..1104b30e18 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -1064,7 +1064,7 @@ void RefreshPGPDlg(HWND hDlg, BOOL iInit) for (auto &hContact : Contacts()) { pUinKey ptr = getUinKey(hContact); if (ptr && ptr->mode == MODE_PGP && isSecureProtocol(hContact) && !isChatRoom(hContact)) { - LPSTR szKeyID = db_get_sa(hContact, MODULENAME, "pgp_abbr"); + LPSTR szKeyID = g_plugin.getStringA(hContact, "pgp_abbr"); lvi.iItem++; lvi.iImage = (szKeyID != nullptr); @@ -1127,7 +1127,7 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit) if (iInit) ptr->tgpgMode = ptr->gpgMode; - LPSTR szKeyID = db_get_sa(hContact, MODULENAME, "gpg"); + LPSTR szKeyID = g_plugin.getStringA(hContact, "gpg"); lvi.iItem++; lvi.iImage = (szKeyID != nullptr); diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index 799c9284e8..02fb05bdca 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -594,7 +594,7 @@ void OptionsType::WriteCustomCategories(const CMStringW &cats) void OptionsType::ReadContactCategory(MCONTACT hContact, CMStringW &cats) { - ptrW tszValue(db_get_wsa(hContact, MODULENAME, "CustomCategory")); + ptrW tszValue(g_plugin.getWStringA(hContact, "CustomCategory")); if (tszValue != NULL) cats = tszValue; } @@ -602,9 +602,9 @@ void OptionsType::ReadContactCategory(MCONTACT hContact, CMStringW &cats) void OptionsType::WriteContactCategory(MCONTACT hContact, const CMStringW &cats) { if (cats.IsEmpty()) - db_unset(hContact, MODULENAME, "CustomCategory"); + g_plugin.delSetting(hContact, "CustomCategory"); else - db_set_ws(hContact, MODULENAME, "CustomCategory", cats.c_str()); + g_plugin.setWString(hContact, "CustomCategory", cats.c_str()); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp index 83e8a1c4b4..0cff0e8420 100644 --- a/plugins/Spamotron/src/options.cpp +++ b/plugins/Spamotron/src/options.cpp @@ -6,7 +6,7 @@ wchar_t* _getCOptS(wchar_t *buf, unsigned int buflen, MCONTACT hContact, const c { DBVARIANT dbv = {0}; wcsnset(buf, 0, buflen); - if (db_get_ws(hContact, MODULENAME, option, &dbv) != 0) + if (g_plugin.getWString(hContact, option, &dbv) != 0) wcsncpy(buf, def, min(buflen, mir_wstrlen(def)+1)); else if (dbv.type == DBVT_WCHAR) { wcsncpy(buf, dbv.pwszVal, min(buflen, mir_wstrlen(dbv.pwszVal)+1)); diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index cb0fb0874e..1f63559f90 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -238,9 +238,9 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) _dbei->flags = 0; _dbei->pBlob = _dbv.pbVal + sizeof(DWORD); db_event_add(hContact,_dbei); - db_unset(hContact, MODULENAME, "AuthEvent"); - db_unset(hContact, MODULENAME, "AuthEventPending"); - db_unset(hContact, MODULENAME, "AuthEventModule"); + g_plugin.delSetting(hContact, "AuthEvent"); + g_plugin.delSetting(hContact, "AuthEventPending"); + g_plugin.delSetting(hContact, "AuthEventModule"); mir_free(szAuthEventModule); free(_dbei); } diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp index 6ae1ca6d84..39f4fd35f5 100644 --- a/plugins/Spamotron/src/utils.cpp +++ b/plugins/Spamotron/src/utils.cpp @@ -505,6 +505,6 @@ void MarkUnread(MCONTACT hContact) db_event_add(hContact,&_dbei); } db_free(&_dbv); - db_unset(hContact, MODULENAME, "LastMsgEvents"); + g_plugin.delSetting(hContact, "LastMsgEvents"); } } diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index 4fb336b948..591d200892 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -214,7 +214,7 @@ int CTooltipNotify::ContactSettingChanged(WPARAM hContact, LPARAM lParam) if (db_get_b(hContact, "CList", "NotOnList", 0) && m_sOptions.bIgnoreUnknown) return 0; - if (db_get_b(hContact, MODULENAME, CONTACT_IGNORE_TTNOTIFY, m_sOptions.bIgnoreNew)) + if (g_plugin.getByte(hContact, CONTACT_IGNORE_TTNOTIFY, m_sOptions.bIgnoreNew)) return 0; if (idle && !m_sOptions.bIdle) @@ -709,7 +709,7 @@ void CTooltipNotify::LoadList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown for (auto &hContact : Contacts()) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, hContact, 0); - if (hItem && !db_get_b(hContact, MODULENAME, CONTACT_IGNORE_TTNOTIFY, m_sOptions.bIgnoreNew)) + if (hItem && !g_plugin.getByte(hContact, CONTACT_IGNORE_TTNOTIFY, m_sOptions.bIgnoreNew)) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 1); } } @@ -726,7 +726,7 @@ void CTooltipNotify::SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, hContact, 0); if (hItem) { BYTE bChecked = (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0)); - db_set_b(hContact, MODULENAME, CONTACT_IGNORE_TTNOTIFY, bChecked ? 0 : 1); + g_plugin.setByte(hContact, CONTACT_IGNORE_TTNOTIFY, bChecked ? 0 : 1); } } } diff --git a/plugins/Weather/src/weather_userinfo.cpp b/plugins/Weather/src/weather_userinfo.cpp index 023c91589f..f2dd115684 100644 --- a/plugins/Weather/src/weather_userinfo.cpp +++ b/plugins/Weather/src/weather_userinfo.cpp @@ -131,7 +131,7 @@ static INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, L // set icons Window_FreeIcon_IcoLib(hwndDlg); - Window_SetProtoIcon_IcoLib(hwndDlg, MODULENAME, db_get_w(hContact, MODULENAME, "StatusIcon", 0)); + Window_SetProtoIcon_IcoLib(hwndDlg, MODULENAME, g_plugin.getWord(hContact, "StatusIcon", 0)); RedrawWindow(GetDlgItem(hwndDlg, IDC_HEADERBAR), nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); break; diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp index 61f54354bc..c94cb0b578 100644 --- a/plugins/WebView/src/main.cpp +++ b/plugins/WebView/src/main.cpp @@ -82,7 +82,7 @@ void ChangeContactStatus(int con_stat) status_code = ID_STATUS_NA; for (auto &hContact : Contacts(MODULENAME)) - db_set_w(hContact, MODULENAME, "Status", status_code); + g_plugin.setWord(hContact, "Status", status_code); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp index 0edd6fa306..6e72610729 100644 --- a/plugins/WebView/src/webview.cpp +++ b/plugins/WebView/src/webview.cpp @@ -169,12 +169,12 @@ int Doubleclick(WPARAM wParam, LPARAM) if (mir_strcmp(MODULENAME, szProto)) return 0; - int action = db_get_b(hContact, MODULENAME, DBLE_WIN_KEY, 1); + int action = g_plugin.getByte(hContact, DBLE_WIN_KEY, 1); if (action == 0) { - ptrW url(db_get_wsa(hContact, MODULENAME, "URL")); + ptrW url(g_plugin.getWStringA(hContact, "URL")); Utils_OpenUrlW(url); - db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE); + g_plugin.setWord(hContact, "Status", ID_STATUS_ONLINE); } else if (action == 1) { HWND hwndDlg = WindowList_Find(hWindowList, hContact); @@ -184,15 +184,15 @@ int Doubleclick(WPARAM wParam, LPARAM) } else { hwndDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact); - HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST; + HWND hTopmost = g_plugin.getByte(hContact, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST; SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((HICON)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0))); if (g_plugin.getByte(SAVE_INDIVID_POS_KEY, 0)) SetWindowPos(hwndDlg, hTopmost, - db_get_dw(hContact, MODULENAME, "WVx", 100), // Xposition, - db_get_dw(hContact, MODULENAME, "WVy", 100), // Yposition, - db_get_dw(hContact, MODULENAME, "WVwidth", 412), // WindowWidth, - db_get_dw(hContact, MODULENAME, "WVheight", 350), 0); // WindowHeight, + g_plugin.getDword(hContact, "WVx", 100), // Xposition, + g_plugin.getDword(hContact, "WVy", 100), // Yposition, + g_plugin.getDword(hContact, "WVwidth", 412), // WindowWidth, + g_plugin.getDword(hContact, "WVheight", 350), 0); // WindowHeight, else SetWindowPos(hwndDlg, HWND_TOPMOST, Xposition, Yposition, WindowWidth, WindowHeight, 0); } @@ -201,11 +201,11 @@ int Doubleclick(WPARAM wParam, LPARAM) SetActiveWindow(hwndDlg); if (g_plugin.getByte(UPDATE_ON_OPEN_KEY, 0)) { - if (db_get_b(hContact, MODULENAME, ENABLE_ALERTS_KEY, 0)) + if (g_plugin.getByte(hContact, ENABLE_ALERTS_KEY, 0)) mir_forkthread(ReadFromFile, (void*)hContact); else mir_forkthread(GetData, (void*)hContact); - db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE); + g_plugin.setWord(hContact, "Status", ID_STATUS_ONLINE); } } @@ -362,15 +362,15 @@ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM) return 0; } - HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST; + HWND hTopmost = g_plugin.getByte(hContact, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST; hwndDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact); SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)); if (g_plugin.getByte(SAVE_INDIVID_POS_KEY, 0)) SetWindowPos(hwndDlg, hTopmost, - db_get_dw(hContact, MODULENAME, "WVx", 100), // Xposition, - db_get_dw(hContact, MODULENAME, "WVy", 100), // Yposition, - db_get_dw(hContact, MODULENAME, "WVwidth", 100), // WindowWidth, - db_get_dw(hContact, MODULENAME, "WVheight", 100), 0); // WindowHeight, + g_plugin.getDword(hContact, "WVx", 100), // Xposition, + g_plugin.getDword(hContact, "WVy", 100), // Yposition, + g_plugin.getDword(hContact, "WVwidth", 100), // WindowWidth, + g_plugin.getDword(hContact, "WVheight", 100), 0); // WindowHeight, else SetWindowPos(hwndDlg, HWND_TOPMOST, Xposition, Yposition, WindowWidth, WindowHeight, 0); @@ -378,11 +378,11 @@ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM) SetActiveWindow(hwndDlg); if (g_plugin.getByte(UPDATE_ON_OPEN_KEY, 0)) { - if (db_get_b(hContact, MODULENAME, ENABLE_ALERTS_KEY, 0)) + if (g_plugin.getByte(hContact, ENABLE_ALERTS_KEY, 0)) mir_forkthread(ReadFromFile, (void*)hContact); else mir_forkthread(GetData, (void*)hContact); - db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE); + g_plugin.setWord(hContact, "Status", ID_STATUS_ONLINE); } return 0; @@ -438,11 +438,11 @@ int OnTopMenuCommand(WPARAM, LPARAM, MCONTACT singlecontact) INT_PTR WebsiteMenuCommand(WPARAM wParam, LPARAM) { MCONTACT hContact = wParam; - ptrW url(db_get_wsa(hContact, MODULENAME, "URL")); + ptrW url(g_plugin.getWStringA(hContact, "URL")); if (url) Utils_OpenUrlW(url); - db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE); + g_plugin.setWord(hContact, "Status", ID_STATUS_ONLINE); return 0; } diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp index 56b7db8e0d..2f4ad8b34f 100644 --- a/plugins/WebView/src/webview_alerts.cpp +++ b/plugins/WebView/src/webview_alerts.cpp @@ -30,7 +30,7 @@ int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_COMMAND: case WM_CONTEXTMENU: MCONTACT hContact = PUGetContact(hWnd); - ptrW url( db_get_wsa(hContact, MODULENAME, URL_KEY)); + ptrW url( g_plugin.getWStringA(hContact, URL_KEY)); if (message == WM_COMMAND) { // left click if(hContact != NULL) { @@ -160,7 +160,7 @@ int OSDAlert(WPARAM hContact, LPARAM lParam) if (hContact != NULL) { DBVARIANT dbv; - if (!db_get_s(hContact, MODULENAME, PRESERVE_NAME_KEY, &dbv)) { + if (!g_plugin.getString(hContact, PRESERVE_NAME_KEY, &dbv)) { strncpy_s(contactname, _countof(contactname), dbv.pszVal, _TRUNCATE); db_free(&dbv); } @@ -204,19 +204,19 @@ int ErrorMsgs(WPARAM wParam, LPARAM lParam) void SaveToFile(MCONTACT hContact, char *truncated) { char *mode; - if (!db_get_b(hContact, MODULENAME, APPEND_KEY, 0)) + if (!g_plugin.getByte(hContact, APPEND_KEY, 0)) mode = "w"; else mode = "a"; char url[300]; url[0] = '\0'; DBVARIANT dbv; - if (!db_get_s(hContact, MODULENAME, URL_KEY, &dbv)) { + if (!g_plugin.getString(hContact, URL_KEY, &dbv)) { strncpy_s(url, _countof(url), dbv.pszVal, _TRUNCATE); db_free(&dbv); } - if ( db_get_s(hContact, MODULENAME, FILE_KEY, &dbv)) + if ( g_plugin.getString(hContact, FILE_KEY, &dbv)) return; FILE *pfile = fopen(dbv.pszVal, mode); @@ -272,22 +272,22 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn memset(&cachecompare, 0, sizeof(cachecompare)); // alerts - if (db_get_b(hContact, MODULENAME, ENABLE_ALERTS_KEY, 0)) { // ALERTS - alertIndex = db_get_b(hContact, MODULENAME, ALRT_INDEX_KEY, 0); - eventIndex = db_get_b(hContact, MODULENAME, EVNT_INDEX_KEY, 0); + if (g_plugin.getByte(hContact, ENABLE_ALERTS_KEY, 0)) { // ALERTS + alertIndex = g_plugin.getByte(hContact, ALRT_INDEX_KEY, 0); + eventIndex = g_plugin.getByte(hContact, EVNT_INDEX_KEY, 0); if (notpresent) { if (alertIndex == 0) { // Popup Sleep(1000); WAlertPopup(hContact, TranslateT("Start/end strings not found or strings not set.")); // contactlist name// - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); } else if (alertIndex == 1) { // log to file - if (!db_get_s(hContact, MODULENAME, FILE_KEY, &tdbv)) { + if (!g_plugin.getString(hContact, FILE_KEY, &tdbv)) { int AmountWspcRem = 0; - if (!db_get_b(hContact, MODULENAME, SAVE_AS_RAW_KEY, 0)) { + if (!g_plugin.getByte(hContact, SAVE_AS_RAW_KEY, 0)) { CodetoSymbol(tempraw); Sleep(100); // avoid 100% CPU @@ -303,7 +303,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn EraseSymbols(tempraw); Sleep(100); // avoid 100% CPU - AmountWspcRem = db_get_b(hContact, MODULENAME, RWSPACE_KEY, 0); + AmountWspcRem = g_plugin.getByte(hContact, RWSPACE_KEY, 0); RemoveInvis(tempraw, AmountWspcRem); Sleep(100); // avoid 100% CPU @@ -313,19 +313,19 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn SaveToFile(hContact, tempraw); db_free(&tdbv); - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); } } else if (alertIndex == 3) { WAlertOSD(hContact, TranslateT("Alert start/end strings not found or strings not set.")); - if (db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if (g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); } else if (eventIndex == 2) { WDisplayDataAlert(hContact); - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); HWND hwndDlg = (WindowList_Find(hWindowList, hContact)); @@ -336,7 +336,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn } if (eventIndex == 0) { // string present - if (!db_get_s(hContact, MODULENAME, ALERT_STRING_KEY, &tdbv)) { + if (!g_plugin.getString(hContact, ALERT_STRING_KEY, &tdbv)) { strncpy_s(alertstring, _countof(alertstring), tdbv.pszVal, _TRUNCATE); db_free(&tdbv); @@ -353,13 +353,13 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn WAlertPopup(hContact, displaystring); // contactlist name// - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); } // else if (alertIndex == 1) { - if (!db_get_s(hContact, MODULENAME, FILE_KEY, &tdbv)) { + if (!g_plugin.getString(hContact, FILE_KEY, &tdbv)) { int AmountWspcRem = 0; - if (!db_get_b(hContact, MODULENAME, SAVE_AS_RAW_KEY, 0)) { + if (!g_plugin.getByte(hContact, SAVE_AS_RAW_KEY, 0)) { CodetoSymbol(tempraw); Sleep(100); // avoid 100% CPU @@ -375,7 +375,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn EraseSymbols(tempraw); Sleep(100); // avoid 100% CPU - AmountWspcRem = db_get_b(hContact, MODULENAME, RWSPACE_KEY, 0); + AmountWspcRem = g_plugin.getByte(hContact, RWSPACE_KEY, 0); RemoveInvis(tempraw, AmountWspcRem); Sleep(100); // avoid 100% CPU @@ -384,7 +384,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn SaveToFile(hContact, tempraw); db_free(&tdbv); - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); } } @@ -393,13 +393,13 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn WAlertOSD(hContact, displaystring); // contactlist name// - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); } else if (alertIndex == 2) { WDisplayDataAlert(hContact); // contactlist name// - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); HWND hwndDlg = WindowList_Find(hWindowList, hContact); @@ -437,7 +437,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn else { fwrite(tempraw, mir_strlen(tempraw), 1, pcachefile); //smaller cache fclose(pcachefile); - db_set_ws(hContact, MODULENAME, CACHE_FILE_KEY, newcachepath); + g_plugin.setWString(hContact, CACHE_FILE_KEY, newcachepath); } // end write to cache @@ -451,20 +451,20 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn if (alertIndex == 0) { // popup WAlertPopup(hContact, TranslateT("The web page has changed.")); // contactlist name// - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); } else if (alertIndex == 3) { // osd WAlertOSD(hContact, TranslateT("The web page has changed.")); // contactlist name// - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); } else if (alertIndex == 1) { // log - if (!db_get_s(hContact, MODULENAME, FILE_KEY, &tdbv)) { + if (!g_plugin.getString(hContact, FILE_KEY, &tdbv)) { int AmountWspcRem = 0; - if (!db_get_b(hContact, MODULENAME, SAVE_AS_RAW_KEY, 0)) { + if (!g_plugin.getByte(hContact, SAVE_AS_RAW_KEY, 0)) { CodetoSymbol(tempraw); Sleep(100); // avoid 100% CPU @@ -480,7 +480,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn EraseSymbols(tempraw); Sleep(100); // avoid 100% CPU - AmountWspcRem = db_get_b(hContact, MODULENAME, RWSPACE_KEY, 0); + AmountWspcRem = g_plugin.getByte(hContact, RWSPACE_KEY, 0); RemoveInvis(tempraw, AmountWspcRem); Sleep(100); // avoid 100% CPU @@ -490,14 +490,14 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn SaveToFile(hContact, tempraw); db_free(&tdbv); // contactlist name// - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); } } else if (alertIndex == 2) { // window WDisplayDataAlert(hContact); // contactlist name// - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); } else MessageBox(nullptr, TranslateT("Unknown alert type."), _A2W(MODULENAME), MB_OK); @@ -507,11 +507,11 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn if (eventIndex == 2) { // part of webpage changed Alerttempstring[0] = Alerttempstring2[0] = 0; - if (!db_get_s(hContact, MODULENAME, ALRT_S_STRING_KEY, &tdbv)) { + if (!g_plugin.getString(hContact, ALRT_S_STRING_KEY, &tdbv)) { strncpy_s(Alerttempstring, _countof(Alerttempstring), tdbv.pszVal, _TRUNCATE); db_free(&tdbv); } - if (!db_get_s(hContact, MODULENAME, ALRT_E_STRING_KEY, &tdbv)) { + if (!g_plugin.getString(hContact, ALRT_E_STRING_KEY, &tdbv)) { strncpy_s(Alerttempstring2, _countof(Alerttempstring2), tdbv.pszVal, _TRUNCATE); db_free(&tdbv); } @@ -563,14 +563,14 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn Sleep(1000); WAlertPopup(hContact, TranslateT("Alert start/end strings not found or strings not set.")); // contactlist name// - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); } else if (alertIndex == 1) { // LOG if (!notpresent) { // dont log to file twice if both types of start/end strings not present - if (!db_get_s(hContact, MODULENAME, FILE_KEY, &tdbv)) { + if (!g_plugin.getString(hContact, FILE_KEY, &tdbv)) { int AmountWspcRem = 0; - if (!db_get_b(hContact, MODULENAME, SAVE_AS_RAW_KEY, 0)) { + if (!g_plugin.getByte(hContact, SAVE_AS_RAW_KEY, 0)) { CodetoSymbol(tempraw); Sleep(100); // avoid 100% CPU @@ -586,7 +586,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn EraseSymbols(tempraw); Sleep(100); // avoid 100% CPU - AmountWspcRem = db_get_b(hContact, MODULENAME, RWSPACE_KEY, 0); + AmountWspcRem = g_plugin.getByte(hContact, RWSPACE_KEY, 0); RemoveInvis(tempraw, AmountWspcRem); Sleep(100); // avoid 100% CPU @@ -596,7 +596,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn SaveToFile(hContact, tempraw); db_free(&tdbv); // contactlist name - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); } } @@ -604,13 +604,13 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn else if (alertIndex == 3) { // osd WAlertOSD(hContact, TranslateT("Alert start/end strings not found or strings not set.")); // contactlist name// - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); } else if (alertIndex == 2) { // window WDisplayDataAlert(hContact); // contactlist name// - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); HWND hwndDlg = (WindowList_Find(hWindowList, hContact)); @@ -618,7 +618,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn } else MessageBox(nullptr, TranslateT("Alert start/end strings not found or strings not set."), _A2W(MODULENAME), MB_OK); - db_set_w(hContact, MODULENAME, "Status", ID_STATUS_AWAY); + g_plugin.setWord(hContact, "Status", ID_STATUS_AWAY); } /////////////// @@ -648,7 +648,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn WErrorPopup((UINT_PTR)contactname, TranslateT("Cannot write to file 2")); else { fwrite(raw, mir_strlen(raw), 1, pcachefile); //smaller cache - db_set_ws(hContact, MODULENAME, CACHE_FILE_KEY, newcachepath); + g_plugin.setWString(hContact, CACHE_FILE_KEY, newcachepath); fclose(pcachefile); } // end write to cache @@ -662,19 +662,19 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn if (alertIndex == 0) { // popup WAlertPopup(hContact, TranslateT("Specific part of the web page has changed.")); // contactlist name// - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); } else if (alertIndex == 3) { // osd WAlertOSD(hContact, TranslateT("Specific part of the web page has changed.")); // contactlist name// - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); } else if (alertIndex == 1) { // log to file - if (!db_get_s(hContact, MODULENAME, FILE_KEY, &tdbv)) { + if (!g_plugin.getString(hContact, FILE_KEY, &tdbv)) { int AmountWspcRem = 0; - if (!db_get_b(hContact, MODULENAME, SAVE_AS_RAW_KEY, 0)) { + if (!g_plugin.getByte(hContact, SAVE_AS_RAW_KEY, 0)) { CodetoSymbol(tempraw); Sleep(100); // avoid 100% CPU @@ -690,7 +690,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn EraseSymbols(tempraw); Sleep(100); // avoid 100% CPU - AmountWspcRem = db_get_b(hContact, MODULENAME, RWSPACE_KEY, 0); + AmountWspcRem = g_plugin.getByte(hContact, RWSPACE_KEY, 0); RemoveInvis(tempraw, AmountWspcRem); Sleep(100); // avoid 100% CPU @@ -700,14 +700,14 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn SaveToFile(hContact, tempraw); db_free(&tdbv); // contactlist name - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); } } else if (alertIndex == 2) { // window WDisplayDataAlert(hContact); // contactlist name// - if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0)) + if ( g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0)) db_set_s(hContact, "CList", "MyHandle", tstr); } else MessageBox(nullptr, TranslateT("Unknown alert type."), _A2W(MODULENAME), MB_OK); @@ -720,11 +720,11 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn //if always log to file option is enabled do this if (wasAlert && alertIndex != 1) { // dont do for log to file alert - if ( db_get_b(hContact, MODULENAME, ALWAYS_LOG_KEY, 0)) { - if (!db_get_s(hContact, MODULENAME, FILE_KEY, &tdbv)) { + if ( g_plugin.getByte(hContact, ALWAYS_LOG_KEY, 0)) { + if (!g_plugin.getString(hContact, FILE_KEY, &tdbv)) { int AmountWspcRem = 0; - if (!db_get_b(hContact, MODULENAME, SAVE_AS_RAW_KEY, 0)) { + if (!g_plugin.getByte(hContact, SAVE_AS_RAW_KEY, 0)) { CodetoSymbol(tempraw); Sleep(100); // avoid 100% CPU @@ -740,7 +740,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn EraseSymbols(tempraw); Sleep(100); // avoid 100% CPU - AmountWspcRem = db_get_b(hContact, MODULENAME, RWSPACE_KEY, 0); + AmountWspcRem = g_plugin.getByte(hContact, RWSPACE_KEY, 0); RemoveInvis(tempraw, AmountWspcRem); Sleep(100); // avoid 100% CPU @@ -764,14 +764,14 @@ int DataWndAlertCommand(WPARAM wParam, LPARAM) return 0; HWND hwndDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, hContact); - HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST; + HWND hTopmost = g_plugin.getByte(hContact, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST; SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) ((HICON) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0))); if ( g_plugin.getByte(SAVE_INDIVID_POS_KEY, 0)) SetWindowPos(hwndDlg, hTopmost, - db_get_dw(hContact, MODULENAME, "WVx", 100), // Xposition, - db_get_dw(hContact, MODULENAME, "WVy", 100), // Yposition, - db_get_dw(hContact, MODULENAME, "WVwidth", 100), // WindowWidth, - db_get_dw(hContact, MODULENAME, "WVheight", 100), 0); // WindowHeight, + g_plugin.getDword(hContact, "WVx", 100), // Xposition, + g_plugin.getDword(hContact, "WVy", 100), // Yposition, + g_plugin.getDword(hContact, "WVwidth", 100), // WindowWidth, + g_plugin.getDword(hContact, "WVheight", 100), 0); // WindowHeight, else SetWindowPos(hwndDlg, HWND_TOPMOST, Xposition, Yposition, WindowWidth, WindowHeight, 0); @@ -798,7 +798,7 @@ void ReadFromFile(void *param) db_free(&dbv); } - if ( db_get_s(hContact, MODULENAME, CACHE_FILE_KEY, &dbv)) + if ( g_plugin.getString(hContact, CACHE_FILE_KEY, &dbv)) return; FILE *pfile; @@ -830,7 +830,7 @@ void ReadFromFile(void *param) EraseSymbols(truncated); Sleep(100); // avoid 100% CPU - AmountWspcRem = db_get_b(hContact, MODULENAME, RWSPACE_KEY, 0); + AmountWspcRem = g_plugin.getByte(hContact, RWSPACE_KEY, 0); RemoveInvis(truncated, AmountWspcRem); Sleep(100); // avoid 100% CPU diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp index ae30c5d20f..fba496f197 100644 --- a/plugins/WebView/src/webview_datawnd.cpp +++ b/plugins/WebView/src/webview_datawnd.cpp @@ -129,8 +129,8 @@ static MCONTACT FindContactByUrl(HWND hwndDlg) GetWindowText(hwndDlg, titlebartxt, _countof(titlebartxt)); for (auto &hContact : Contacts(MODULENAME)) { - ptrW db1( db_get_wsa(hContact, MODULENAME, URL_KEY)); - ptrW db2( db_get_wsa(hContact, MODULENAME, PRESERVE_NAME_KEY)); + ptrW db1( g_plugin.getWStringA(hContact, URL_KEY)); + ptrW db2( g_plugin.getWStringA(hContact, PRESERVE_NAME_KEY)); if (!mir_wstrcmp(urltext, db1) && !mir_wstrcmp(titlebartxt, db2)) { contactcount++; @@ -351,7 +351,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_STOP: if (hContact = FindContactByUrl(hwndDlg)) - db_set_b(hContact, MODULENAME, STOP_KEY, 1); + g_plugin.setByte(hContact, STOP_KEY, 1); break; case IDC_STICK_BUTTON: @@ -360,7 +360,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA { wchar_t *ptszToolTip; HWND hTopmost; - if (!db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0)) { + if (!g_plugin.getByte(hContact, ON_TOP_KEY, 0)) { hTopmost = HWND_NOTOPMOST; ptszToolTip = TranslateT("Stick to the front"); } diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp index 590f0d4fdc..c77d994379 100644 --- a/plugins/WebView/src/webview_getdata.cpp +++ b/plugins/WebView/src/webview_getdata.cpp @@ -67,16 +67,16 @@ void GetData(void *param) memset(&tstr, 0, sizeof(tstr)); memset(×tring, 0, sizeof(timestring)); - db_set_b(hContact, MODULENAME, STOP_KEY, 0); + g_plugin.setByte(hContact, STOP_KEY, 0); - if (db_get_s(hContact, MODULENAME, PRESERVE_NAME_KEY, &dbv)) { + if (g_plugin.getString(hContact, PRESERVE_NAME_KEY, &dbv)) { if (!db_get_s(hContact, "CList", "MyHandle", &dbv)) { - db_set_s(hContact, MODULENAME, PRESERVE_NAME_KEY, dbv.pszVal); + g_plugin.setString(hContact, PRESERVE_NAME_KEY, dbv.pszVal); db_free(&dbv); } } - if (!db_get_s(hContact, MODULENAME, PRESERVE_NAME_KEY, &dbv)) { + if (!g_plugin.getString(hContact, PRESERVE_NAME_KEY, &dbv)) { strncpy_s(contactname, _countof(contactname), dbv.pszVal, _TRUNCATE); db_free(&dbv); } @@ -86,17 +86,17 @@ void GetData(void *param) if (!Startingup) g_plugin.setByte(HAS_CRASHED_KEY, 1); - if (!db_get_s(hContact, MODULENAME, START_STRING_KEY, &dbv)) { + if (!g_plugin.getString(hContact, START_STRING_KEY, &dbv)) { strncpy_s(tempstring, _countof(tempstring), dbv.pszVal, _TRUNCATE); db_free(&dbv); } - if (!db_get_s(hContact, MODULENAME, END_STRING_KEY, &dbv)) { + if (!g_plugin.getString(hContact, END_STRING_KEY, &dbv)) { strncpy_s(tempstring2, _countof(tempstring2), dbv.pszVal, _TRUNCATE); db_free(&dbv); } - if (!db_get_s(hContact, MODULENAME, URL_KEY, &dbv)) { + if (!g_plugin.getString(hContact, URL_KEY, &dbv)) { strncpy_s(url, _countof(url), dbv.pszVal, _TRUNCATE); db_free(&dbv); } @@ -132,12 +132,12 @@ void GetData(void *param) SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Download in progress, please wait...")); db_set_ws(hContact, "CList", "StatusMsg", TranslateT("Updating...")); - db_set_w(hContact, MODULENAME, "Status", ID_STATUS_DND); // download + g_plugin.setWord(hContact, "Status", ID_STATUS_DND); // download NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUser, &nlhr); if (nlhrReply) { if (nlhrReply->resultCode < 200 || nlhrReply->resultCode >= 300) { - db_set_w(hContact, MODULENAME, "Status", ID_STATUS_AWAY); + g_plugin.setWord(hContact, "Status", ID_STATUS_AWAY); wchar_t *statusText = TranslateT("The server replied with a failure code"); SetDlgItemText(hwndDlg, IDC_STATUSBAR, statusText); @@ -153,7 +153,7 @@ void GetData(void *param) } // END REPLY if (!nlhrReply) { - db_set_w(hContact, MODULENAME, "Status", ID_STATUS_NA); + g_plugin.setWord(hContact, "Status", ID_STATUS_NA); wchar_t *statusText = TranslateT("The server is down or lagging."); SetDlgItemText(hwndDlg, IDC_STATUSBAR, statusText); @@ -177,7 +177,7 @@ void GetData(void *param) // download successful if (DownloadSuccess) { // all the site - if (db_get_b(hContact, MODULENAME, U_ALLSITE_KEY, 0) == 1) + if (g_plugin.getByte(hContact, U_ALLSITE_KEY, 0) == 1) mir_strncpy(truncated, truncated2, MAXSIZE1); else { // use start and end string // putting data into string @@ -231,13 +231,13 @@ void GetData(void *param) DownloadSuccess = 1; } - else if (db_get_b(hContact, MODULENAME, U_ALLSITE_KEY, 0) == 0) { + else if (g_plugin.getByte(hContact, U_ALLSITE_KEY, 0) == 0) { wchar_t *szStatusText = TranslateT("Invalid search parameters."); WErrorPopup(hContact, szStatusText); DownloadSuccess = 0; SetDlgItemText(hwndDlg, IDC_STATUSBAR, szStatusText); - db_set_w(hContact, MODULENAME, "Status", ID_STATUS_AWAY); + g_plugin.setWord(hContact, "Status", ID_STATUS_AWAY); } } // end putting data into string } // end use start and end strings @@ -245,7 +245,7 @@ void GetData(void *param) if (DownloadSuccess) { // download success if (statpos == 0 && statposend == 0) { - if (db_get_b(hContact, MODULENAME, U_ALLSITE_KEY, 0) == 0) { + if (g_plugin.getByte(hContact, U_ALLSITE_KEY, 0) == 0) { wchar_t *statusText = TranslateT("Both search strings not found or strings not set."); WErrorPopup(hContact, statusText); db_set_ws(hContact, "CList", "StatusMsg", statusText); @@ -253,7 +253,7 @@ void GetData(void *param) DownloadSuccess = 0; SetDlgItemText(hwndDlg, IDC_STATUSBAR, statusText); TherewasAlert = ProcessAlerts(hContact, _T2A(statusText), contactname, contactname, 1); - db_set_w(hContact, MODULENAME, "Status", ID_STATUS_AWAY); + g_plugin.setWord(hContact, "Status", ID_STATUS_AWAY); } } } // end download success @@ -267,21 +267,21 @@ void GetData(void *param) time_t ftime; struct tm *nTime; - if (!db_get_s(hContact, MODULENAME, PRESERVE_NAME_KEY, &dbv)) { + if (!g_plugin.getString(hContact, PRESERVE_NAME_KEY, &dbv)) { memset(&temptime, 0, sizeof(temptime)); memset(&tstr, 0, sizeof(tstr)); ftime = time(0); nTime = localtime(&ftime); // 12 hour - if (db_get_b(hContact, MODULENAME, USE_24_HOUR_KEY, 0) == 0) + if (g_plugin.getByte(hContact, USE_24_HOUR_KEY, 0) == 0) strftime(temptime, 128, "(%b %d,%I:%M %p)", nTime); // 24 hour - if (db_get_b(hContact, MODULENAME, USE_24_HOUR_KEY, 0) == 1) + if (g_plugin.getByte(hContact, USE_24_HOUR_KEY, 0) == 1) strftime(temptime, 128, "(%b %d,%H:%M:%S)", nTime); - if (db_get_b(hContact, MODULENAME, CONTACT_PREFIX_KEY, 1) == 1) + if (g_plugin.getByte(hContact, CONTACT_PREFIX_KEY, 1) == 1) mir_snprintf(tstr, "%s %s", temptime, dbv.pszVal); - if (db_get_b(hContact, MODULENAME, CONTACT_PREFIX_KEY, 1) == 0) + if (g_plugin.getByte(hContact, CONTACT_PREFIX_KEY, 1) == 0) mir_snprintf(tstr, "%s %s", dbv.pszVal, temptime); db_free(&dbv); } @@ -292,16 +292,16 @@ void GetData(void *param) ftime = time(0); nTime = localtime(&ftime); // 12 hour - if (db_get_b(hContact, MODULENAME, USE_24_HOUR_KEY, 0) == 0) + if (g_plugin.getByte(hContact, USE_24_HOUR_KEY, 0) == 0) strftime(temptime, 128, "(%b %d,%I:%M %p)", nTime); // 24 hour - if (db_get_b(hContact, MODULENAME, USE_24_HOUR_KEY, 0) == 1) + if (g_plugin.getByte(hContact, USE_24_HOUR_KEY, 0) == 1) strftime(temptime, 128, "(%b %d,%H:%M:%S)", nTime); - db_set_ws(hContact, MODULENAME, PRESERVE_NAME_KEY, dbv.pwszVal); - if (db_get_b(hContact, MODULENAME, CONTACT_PREFIX_KEY, 1) == 1) + g_plugin.setWString(hContact, PRESERVE_NAME_KEY, dbv.pwszVal); + if (g_plugin.getByte(hContact, CONTACT_PREFIX_KEY, 1) == 1) mir_snprintf(tstr, "%s %s", temptime, dbv.pszVal); - if (db_get_b(hContact, MODULENAME, CONTACT_PREFIX_KEY, 1) == 0) + if (g_plugin.getByte(hContact, CONTACT_PREFIX_KEY, 1) == 0) mir_snprintf(tstr, "%s %s", dbv.pszVal, temptime); db_free(&dbv); } @@ -325,16 +325,16 @@ void GetData(void *param) static char buff[MAXSIZE1]; char Alerttempstring[300], Alerttempstring2[300]; - eventIndex = db_get_b(hContact, MODULENAME, EVNT_INDEX_KEY, 0); + eventIndex = g_plugin.getByte(hContact, EVNT_INDEX_KEY, 0); if (eventIndex == 2) { strncpy(buff, truncated, _countof(buff)); Filter(buff); - if (!db_get_s(hContact, MODULENAME, ALRT_S_STRING_KEY, &dbv)) { + if (!g_plugin.getString(hContact, ALRT_S_STRING_KEY, &dbv)) { strncpy_s(Alerttempstring, _countof(Alerttempstring), dbv.pszVal, _TRUNCATE); db_free(&dbv); } - if (!db_get_s(hContact, MODULENAME, ALRT_E_STRING_KEY, &dbv)) { + if (!g_plugin.getString(hContact, ALRT_E_STRING_KEY, &dbv)) { strncpy_s(Alerttempstring2, _countof(Alerttempstring2), dbv.pszVal, _TRUNCATE); db_free(&dbv); } @@ -347,18 +347,18 @@ void GetData(void *param) } } - if ((((strstr(truncated2, tempstring)) != nullptr) && ((strstr(truncated2, tempstring2)) != nullptr) && (db_get_b(hContact, MODULENAME, U_ALLSITE_KEY, 0) == 0)) || (db_get_b(hContact, MODULENAME, U_ALLSITE_KEY, 0) == 1)) { + if ((((strstr(truncated2, tempstring)) != nullptr) && ((strstr(truncated2, tempstring2)) != nullptr) && (g_plugin.getByte(hContact, U_ALLSITE_KEY, 0) == 0)) || (g_plugin.getByte(hContact, U_ALLSITE_KEY, 0) == 1)) { RemoveTabs(truncated); - if ( db_get_b(hContact, MODULENAME, CLEAR_DISPLAY_KEY, 0)) { + if ( g_plugin.getByte(hContact, CLEAR_DISPLAY_KEY, 0)) { SendToRichEdit(hwndDlg, truncated, TextClr, BackgoundClr); SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Processing data (Stage 1)")); - if (db_get_b(hContact, MODULENAME, STOP_KEY, 1) == 1) { + if (g_plugin.getByte(hContact, STOP_KEY, 1) == 1) { LBL_Stop: wchar_t *statusText = TranslateT("Processing data stopped by user."); SetDlgItemText(hwndDlg, IDC_STATUSBAR, statusText); - db_set_b(hContact, MODULENAME, STOP_KEY, 0); - db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE); + g_plugin.setByte(hContact, STOP_KEY, 0); + g_plugin.setWord(hContact, "Status", ID_STATUS_ONLINE); db_set_ws(hContact, "CList", "StatusMsg", statusText); AlreadyDownloading = 0; return; @@ -369,7 +369,7 @@ LBL_Stop: wchar_t *statusText = TranslateT("Processing data stopped by user.") SendToRichEdit(hwndDlg, truncated, TextClr, BackgoundClr); SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Processing data (Stage 2)")); - if (db_get_b(hContact, MODULENAME, STOP_KEY, 1) == 1) + if (g_plugin.getByte(hContact, STOP_KEY, 1) == 1) goto LBL_Stop; EraseBlock(truncated); @@ -377,7 +377,7 @@ LBL_Stop: wchar_t *statusText = TranslateT("Processing data stopped by user.") SendToRichEdit(hwndDlg, truncated, TextClr, BackgoundClr); SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Processing data (Stage 3)")); - if (db_get_b(hContact, MODULENAME, STOP_KEY, 1) == 1) + if (g_plugin.getByte(hContact, STOP_KEY, 1) == 1) goto LBL_Stop; FastTagFilter(truncated); @@ -385,7 +385,7 @@ LBL_Stop: wchar_t *statusText = TranslateT("Processing data stopped by user.") SendToRichEdit(hwndDlg, truncated, TextClr, BackgoundClr); SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Processing data (Stage 4)")); - if (db_get_b(hContact, MODULENAME, STOP_KEY, 1) == 1) + if (g_plugin.getByte(hContact, STOP_KEY, 1) == 1) goto LBL_Stop; NumSymbols(truncated); @@ -393,7 +393,7 @@ LBL_Stop: wchar_t *statusText = TranslateT("Processing data stopped by user.") SendToRichEdit(hwndDlg, truncated, TextClr, BackgoundClr); SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Processing data (Stage 5)")); - if (db_get_b(hContact, MODULENAME, STOP_KEY, 1) == 1) + if (g_plugin.getByte(hContact, STOP_KEY, 1) == 1) goto LBL_Stop; EraseSymbols(truncated); @@ -402,8 +402,8 @@ LBL_Stop: wchar_t *statusText = TranslateT("Processing data stopped by user.") SendToRichEdit(hwndDlg, truncated, TextClr, BackgoundClr); SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Processing data (Stage 6)")); - AmountWspcRem = db_get_b(hContact, MODULENAME, RWSPACE_KEY, 0); - if (db_get_b(hContact, MODULENAME, STOP_KEY, 1) == 1) + AmountWspcRem = g_plugin.getByte(hContact, RWSPACE_KEY, 0); + if (g_plugin.getByte(hContact, STOP_KEY, 1) == 1) goto LBL_Stop; RemoveInvis(truncated, AmountWspcRem); @@ -411,7 +411,7 @@ LBL_Stop: wchar_t *statusText = TranslateT("Processing data stopped by user.") SendToRichEdit(hwndDlg, truncated, TextClr, BackgoundClr); SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Processing data (Stage 7)")); - if (db_get_b(hContact, MODULENAME, STOP_KEY, 1) == 1) + if (g_plugin.getByte(hContact, STOP_KEY, 1) == 1) goto LBL_Stop; Removewhitespace(truncated); @@ -424,7 +424,7 @@ LBL_Stop: wchar_t *statusText = TranslateT("Processing data stopped by user.") if ( g_plugin.getByte(DATA_POPUP_KEY, 0)) WAlertPopup(hContact, _A2T(truncated)); - if (db_get_b(hContact, MODULENAME, STOP_KEY, 1) == 1) + if (g_plugin.getByte(hContact, STOP_KEY, 1) == 1) goto LBL_Stop; // removed any excess characters at the end. @@ -443,16 +443,16 @@ LBL_Stop: wchar_t *statusText = TranslateT("Processing data stopped by user.") } if (TherewasAlert) { - db_set_w(hContact, MODULENAME, "Status", ID_STATUS_OCCUPIED); + g_plugin.setWord(hContact, "Status", ID_STATUS_OCCUPIED); db_set_ws(hContact, "CList", "StatusMsg", TranslateT("Alert!")); } else { - db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE); + g_plugin.setWord(hContact, "Status", ID_STATUS_ONLINE); db_set_ws(hContact, "CList", "StatusMsg", TranslateT("Online")); } } - if (db_get_b(hContact, MODULENAME, U_ALLSITE_KEY, 0) == 0) { + if (g_plugin.getByte(hContact, U_ALLSITE_KEY, 0) == 0) { if (statpos > statposend) DownloadSuccess = 0; else if (statpos == 0 && statposend == 0) diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp index a6011d7074..655e17fd2e 100644 --- a/plugins/WebView/src/webview_opts.cpp +++ b/plugins/WebView/src/webview_opts.cpp @@ -278,25 +278,25 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l EnableWindow(GetDlgItem(hwndDlg, IDC_ALERT_APPLY), 0); - if (!db_get_ws(hContact, MODULENAME, ALERT_STRING_KEY, &dbv)) { + if (!g_plugin.getWString(hContact, ALERT_STRING_KEY, &dbv)) { SetDlgItemText(hwndDlg, IDC_ALERT_STRING, dbv.pwszVal); db_free(&dbv); } - if (!db_get_ws(hContact, MODULENAME, ALRT_S_STRING_KEY, &dbv)) { + if (!g_plugin.getWString(hContact, ALRT_S_STRING_KEY, &dbv)) { SetDlgItemText(hwndDlg, IDC_START2, dbv.pwszVal); db_free(&dbv); } - if (!db_get_ws(hContact, MODULENAME, ALRT_E_STRING_KEY, &dbv)) { + if (!g_plugin.getWString(hContact, ALRT_E_STRING_KEY, &dbv)) { SetDlgItemText(hwndDlg, IDC_END2, dbv.pwszVal); db_free(&dbv); } - CheckDlgButton(hwndDlg, IDC_ENABLE_ALERTS, db_get_b(hContact, MODULENAME, ENABLE_ALERTS_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ADD_DATE_NAME, db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_24_HOUR, db_get_b(hContact, MODULENAME, USE_24_HOUR_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ALWAYS_LOG, db_get_b(hContact, MODULENAME, ALWAYS_LOG_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ENABLE_ALERTS, g_plugin.getByte(hContact, ENABLE_ALERTS_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ADD_DATE_NAME, g_plugin.getByte(hContact, APND_DATE_NAME_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_24_HOUR, g_plugin.getByte(hContact, USE_24_HOUR_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ALWAYS_LOG, g_plugin.getByte(hContact, ALWAYS_LOG_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); - SetDlgItemText(hwndDlg, IDC_ALERT_TYPE, TranslateW(AlertTypes[db_get_b(hContact, MODULENAME, ALRT_INDEX_KEY, 0)])); - SetDlgItemText(hwndDlg, IDC_EVENT_TYPE, TranslateW(EventTypes[db_get_b(hContact, MODULENAME, EVNT_INDEX_KEY, 0)])); + SetDlgItemText(hwndDlg, IDC_ALERT_TYPE, TranslateW(AlertTypes[g_plugin.getByte(hContact, ALRT_INDEX_KEY, 0)])); + SetDlgItemText(hwndDlg, IDC_EVENT_TYPE, TranslateW(EventTypes[g_plugin.getByte(hContact, EVNT_INDEX_KEY, 0)])); for (i = 0; i < _countof(AlertTypes); i++) SendDlgItemMessage(hwndDlg, IDC_ALERT_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateW(AlertTypes[i])); @@ -304,7 +304,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l for (i = 0; i < _countof(EventTypes); i++) SendDlgItemMessage(hwndDlg, IDC_EVENT_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateW(EventTypes[i])); - if (db_get_b(hContact, MODULENAME, ENABLE_ALERTS_KEY, 0)) { + if (g_plugin.getByte(hContact, ENABLE_ALERTS_KEY, 0)) { CheckDlgButton(hwndDlg, IDC_ENABLE_ALERTS, BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ADD_DATE_NAME, BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_24_HOUR, BST_UNCHECKED); @@ -334,12 +334,12 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYS_LOG), (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS))); EnableWindow(GetDlgItem(hwndDlg, IDC_SAVE_AS_RAW), (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS))); - if (!db_get_s(hContact, MODULENAME, EVNT_INDEX_KEY, &dbv)) { - eventIndex = db_get_b(hContact, MODULENAME, EVNT_INDEX_KEY, 0); + if (!g_plugin.getString(hContact, EVNT_INDEX_KEY, &dbv)) { + eventIndex = g_plugin.getByte(hContact, EVNT_INDEX_KEY, 0); db_free(&dbv); } - if (!db_get_s(hContact, MODULENAME, ALRT_INDEX_KEY, &dbv)) { - alertIndex = db_get_b(hContact, MODULENAME, ALRT_INDEX_KEY, 0); + if (!g_plugin.getString(hContact, ALRT_INDEX_KEY, &dbv)) { + alertIndex = g_plugin.getByte(hContact, ALRT_INDEX_KEY, 0); db_free(&dbv); } @@ -407,20 +407,20 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l } } - if (!db_get_ws(hContact, MODULENAME, FILE_KEY, &dbv)) { + if (!g_plugin.getWString(hContact, FILE_KEY, &dbv)) { SetDlgItemText(hwndDlg, IDC_FILENAME, dbv.pwszVal); db_free(&dbv); } - CheckDlgButton(hwndDlg, IDC_APPEND, db_get_b(hContact, MODULENAME, APPEND_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SAVE_AS_RAW, db_get_b(hContact, MODULENAME, SAVE_AS_RAW_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_APPEND, g_plugin.getByte(hContact, APPEND_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SAVE_AS_RAW, g_plugin.getByte(hContact, SAVE_AS_RAW_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); - if (db_get_b(hContact, MODULENAME, CONTACT_PREFIX_KEY, 1) == 1) + if (g_plugin.getByte(hContact, CONTACT_PREFIX_KEY, 1) == 1) CheckRadioButton(hwndDlg, IDC_PREFIX, IDC_SUFFIX, IDC_PREFIX); else CheckRadioButton(hwndDlg, IDC_PREFIX, IDC_SUFFIX, IDC_SUFFIX); - if (db_get_b(hContact, MODULENAME, ALWAYS_LOG_KEY, 0)) { + if (g_plugin.getByte(hContact, ALWAYS_LOG_KEY, 0)) { if (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)) { EnableWindow(GetDlgItem(hwndDlg, IDC_APPEND), 1); EnableWindow(GetDlgItem(hwndDlg, IDC_FILENAME), 1); @@ -510,8 +510,8 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l EnableWindow(GetDlgItem(hwndDlg, IDC_ALERT_TYPE), (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS))); EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYS_LOG), (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS))); - eventIndex = db_get_b(hContact, MODULENAME, EVNT_INDEX_KEY, 0); - alertIndex = db_get_b(hContact, MODULENAME, ALRT_INDEX_KEY, 0); + eventIndex = g_plugin.getByte(hContact, EVNT_INDEX_KEY, 0); + alertIndex = g_plugin.getByte(hContact, ALRT_INDEX_KEY, 0); if (eventIndex == 2) { // part of webpage changed EnableWindow(GetDlgItem(hwndDlg, IDC_START2), (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS))); @@ -618,7 +618,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l alertIndex = SendDlgItemMessage(hwndDlg, IDC_ALERT_TYPE, CB_GETCURSEL, 0, 0); if (HIWORD(wParam) == CBN_SELCHANGE) { - db_set_b(hContact, MODULENAME, ALRT_INDEX_KEY, alertIndex); + g_plugin.setByte(hContact, ALRT_INDEX_KEY, alertIndex); if (alertIndex == 0) { // PopUp EnableWindow(GetDlgItem(hwndDlg, IDC_APPEND), 0); @@ -665,7 +665,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l eventIndex = SendDlgItemMessage(hwndDlg, IDC_EVENT_TYPE, CB_GETCURSEL, 0, 0); if (HIWORD(wParam) == CBN_SELCHANGE) { - db_set_b(hContact, MODULENAME, EVNT_INDEX_KEY, eventIndex); + g_plugin.setByte(hContact, EVNT_INDEX_KEY, eventIndex); if (eventIndex == 0) { // event when string is present EnableWindow(GetDlgItem(hwndDlg, IDC_ALERT_STRING), 1); @@ -694,13 +694,13 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l { hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - eventIndex = db_get_b(hContact, MODULENAME, EVNT_INDEX_KEY, 0); - alertIndex = db_get_b(hContact, MODULENAME, ALRT_INDEX_KEY, 0); + eventIndex = g_plugin.getByte(hContact, EVNT_INDEX_KEY, 0); + alertIndex = g_plugin.getByte(hContact, ALRT_INDEX_KEY, 0); - db_set_b(hContact, MODULENAME, ENABLE_ALERTS_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)); - db_set_b(hContact, MODULENAME, APND_DATE_NAME_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ADD_DATE_NAME)); - db_set_b(hContact, MODULENAME, USE_24_HOUR_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_24_HOUR)); - db_set_b(hContact, MODULENAME, ALWAYS_LOG_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALWAYS_LOG)); + g_plugin.setByte(hContact, ENABLE_ALERTS_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)); + g_plugin.setByte(hContact, APND_DATE_NAME_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ADD_DATE_NAME)); + g_plugin.setByte(hContact, USE_24_HOUR_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_24_HOUR)); + g_plugin.setByte(hContact, ALWAYS_LOG_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALWAYS_LOG)); //if alerts is unticked delete the cache if (!(IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS))) @@ -741,21 +741,21 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l wchar_t buf[MAX_PATH]; GetDlgItemText(hwndDlg, IDC_FILENAME, buf, _countof(buf)); - db_set_ws(hContact, MODULENAME, FILE_KEY, buf); + g_plugin.setWString(hContact, FILE_KEY, buf); - db_set_b(hContact, MODULENAME, APPEND_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_APPEND)); - db_set_b(hContact, MODULENAME, SAVE_AS_RAW_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVE_AS_RAW)); + g_plugin.setByte(hContact, APPEND_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_APPEND)); + g_plugin.setByte(hContact, SAVE_AS_RAW_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVE_AS_RAW)); GetDlgItemText(hwndDlg, IDC_ALERT_STRING, buf, _countof(buf)); - db_set_ws(hContact, MODULENAME, ALERT_STRING_KEY, buf); + g_plugin.setWString(hContact, ALERT_STRING_KEY, buf); GetDlgItemText(hwndDlg, IDC_START2, buf, _countof(buf)); - db_set_ws(hContact, MODULENAME, ALRT_S_STRING_KEY, buf); + g_plugin.setWString(hContact, ALRT_S_STRING_KEY, buf); GetDlgItemText(hwndDlg, IDC_END2, buf, _countof(buf)); - db_set_ws(hContact, MODULENAME, ALRT_E_STRING_KEY, buf); + g_plugin.setWString(hContact, ALRT_E_STRING_KEY, buf); - db_set_b(hContact, MODULENAME, CONTACT_PREFIX_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PREFIX)); + g_plugin.setByte(hContact, CONTACT_PREFIX_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PREFIX)); EnableWindow(GetDlgItem(hwndDlg, IDC_ALERT_APPLY), 0); @@ -800,44 +800,44 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_APPLY), 0); - if (!db_get_ws(hContact, MODULENAME, URL_KEY, &dbv)) { + if (!g_plugin.getWString(hContact, URL_KEY, &dbv)) { SetDlgItemText(hwndDlg, IDC_URL, dbv.pwszVal); db_free(&dbv); } - if (!db_get_ws(hContact, MODULENAME, START_STRING_KEY, &dbv)) { + if (!g_plugin.getWString(hContact, START_STRING_KEY, &dbv)) { SetDlgItemText(hwndDlg, IDC_START, dbv.pwszVal); db_free(&dbv); } - if (!db_get_ws(hContact, MODULENAME, END_STRING_KEY, &dbv)) { + if (!g_plugin.getWString(hContact, END_STRING_KEY, &dbv)) { SetDlgItemText(hwndDlg, IDC_END, dbv.pwszVal); db_free(&dbv); } - if (db_get_ws(hContact, MODULENAME, PRESERVE_NAME_KEY, &dbv)) { + if (g_plugin.getWString(hContact, PRESERVE_NAME_KEY, &dbv)) { db_free(&dbv); db_get_ws(hContact, "CList", "MyHandle", &dbv); - db_set_ws(hContact, MODULENAME, PRESERVE_NAME_KEY, dbv.pwszVal); + g_plugin.setWString(hContact, PRESERVE_NAME_KEY, dbv.pwszVal); db_free(&dbv); } - if (!db_get_ws(hContact, MODULENAME, PRESERVE_NAME_KEY, &dbv)) { + if (!g_plugin.getWString(hContact, PRESERVE_NAME_KEY, &dbv)) { SetDlgItemText(hwndDlg, IDC_SITE_NAME, dbv.pwszVal); db_free(&dbv); } - CheckDlgButton(hwndDlg, IDC_CLEAN, db_get_b(hContact, MODULENAME, CLEAR_DISPLAY_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CLEAN, g_plugin.getByte(hContact, CLEAR_DISPLAY_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_RWSPACE, TBM_SETRANGE, FALSE, MAKELONG(0, 4)); - SendDlgItemMessage(hwndDlg, IDC_RWSPACE, TBM_SETPOS, TRUE, db_get_b(hContact, MODULENAME, RWSPACE_KEY, 0)); + SendDlgItemMessage(hwndDlg, IDC_RWSPACE, TBM_SETPOS, TRUE, g_plugin.getByte(hContact, RWSPACE_KEY, 0)); SetDlgItemText(hwndDlg, IDC_RWSPC_TEXT, TranslateW(szTrackerBarDescr[SendDlgItemMessage(hwndDlg, IDC_RWSPACE, TBM_GETPOS, 0, 0)])); EnableWindow(GetDlgItem(hwndDlg, IDC_RWSPACE), (IsDlgButtonChecked(hwndDlg, IDC_CLEAN))); EnableWindow(GetDlgItem(hwndDlg, IDC_RWSPC_TEXT), (IsDlgButtonChecked(hwndDlg, IDC_CLEAN))); - if (db_get_b(hContact, MODULENAME, DBLE_WIN_KEY, 1) == 1) + if (g_plugin.getByte(hContact, DBLE_WIN_KEY, 1) == 1) CheckRadioButton(hwndDlg, IDC_DBLE_WEB, IDC_DBLE_WIN, IDC_DBLE_WIN); else CheckRadioButton(hwndDlg, IDC_DBLE_WEB, IDC_DBLE_WIN, IDC_DBLE_WEB); - if (db_get_b(hContact, MODULENAME, U_ALLSITE_KEY, 0) == 1) { + if (g_plugin.getByte(hContact, U_ALLSITE_KEY, 0) == 1) { CheckRadioButton(hwndDlg, IDC_U_SE_STRINGS, IDC_U_ALLSITE, IDC_U_ALLSITE); EnableWindow(GetDlgItem(hwndDlg, IDC_START), 0); EnableWindow(GetDlgItem(hwndDlg, IDC_END), 0); @@ -895,12 +895,12 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); GetDlgItemText(hwndDlg, IDC_START, string, _countof(string)); - db_set_ws(hContact, MODULENAME, ALRT_S_STRING_KEY, string); + g_plugin.setWString(hContact, ALRT_S_STRING_KEY, string); GetDlgItemText(hwndDlg, IDC_END, string, _countof(string)); - db_set_ws(hContact, MODULENAME, ALRT_E_STRING_KEY, string); + g_plugin.setWString(hContact, ALRT_E_STRING_KEY, string); - db_set_w(hContact, MODULENAME, EVNT_INDEX_KEY, 2); + g_plugin.setWord(hContact, EVNT_INDEX_KEY, 2); } break; @@ -990,23 +990,23 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); GetDlgItemText(hwndDlg, IDC_URL, url, _countof(url)); - db_set_ws(hContact, MODULENAME, URL_KEY, url); - db_set_ws(hContact, MODULENAME, "Homepage", url); + g_plugin.setWString(hContact, URL_KEY, url); + g_plugin.setWString(hContact, "Homepage", url); GetDlgItemText(hwndDlg, IDC_START, str, _countof(str)); - db_set_ws(hContact, MODULENAME, START_STRING_KEY, str); + g_plugin.setWString(hContact, START_STRING_KEY, str); GetDlgItemText(hwndDlg, IDC_END, str, _countof(str)); - db_set_ws(hContact, MODULENAME, END_STRING_KEY, str); + g_plugin.setWString(hContact, END_STRING_KEY, str); GetDlgItemText(hwndDlg, IDC_SITE_NAME, str, _countof(str)); db_set_ws(hContact, "CList", "MyHandle", str); - db_set_b(hContact, MODULENAME, DBLE_WIN_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DBLE_WIN)); - db_set_b(hContact, MODULENAME, U_ALLSITE_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_U_ALLSITE)); + g_plugin.setByte(hContact, DBLE_WIN_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DBLE_WIN)); + g_plugin.setByte(hContact, U_ALLSITE_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_U_ALLSITE)); - db_set_b(hContact, MODULENAME, CLEAR_DISPLAY_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLEAN)); - db_set_b(hContact, MODULENAME, RWSPACE_KEY, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_RWSPACE, TBM_GETPOS, 0, 0))); + g_plugin.setByte(hContact, CLEAR_DISPLAY_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLEAN)); + g_plugin.setByte(hContact, RWSPACE_KEY, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_RWSPACE, TBM_GETPOS, 0, 0))); SetDlgItemText(ParentHwnd, IDC_OPEN_URL, FixButtonText(url, _countof(url))); diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp index 96d416ad40..4e6f24f6f5 100644 --- a/plugins/WebView/src/webview_services.cpp +++ b/plugins/WebView/src/webview_services.cpp @@ -45,7 +45,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam) // A contact is renamed if (!strcmp(cws->szSetting, "MyHandle")) { - ptrW oldName( db_get_wsa(hContact, MODULENAME, PRESERVE_NAME_KEY)); + ptrW oldName( g_plugin.getWStringA(hContact, PRESERVE_NAME_KEY)); if (oldName == NULL) return 0; @@ -73,8 +73,8 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam) } if ( wcschr(nick, '(') == nullptr) { - db_set_ws(hContact, MODULENAME, PRESERVE_NAME_KEY, nick); - db_set_ws(hContact, MODULENAME, "Nick", nick); + g_plugin.setWString(hContact, PRESERVE_NAME_KEY, nick); + g_plugin.setWString(hContact, "Nick", nick); db_set_ws(hContact, "CList", "MyHandle", nick); } @@ -98,7 +98,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam) fclose(pcachefile); if (mir_wstrcmp(newcachepath, renamedcachepath)) { MoveFile(newcachepath, renamedcachepath); - db_set_ws(hContact, MODULENAME, CACHE_FILE_KEY, renamedcachepath); + g_plugin.setWString(hContact, CACHE_FILE_KEY, renamedcachepath); } } } @@ -114,7 +114,7 @@ int SiteDeleted(WPARAM wParam, LPARAM) if (mir_strcmp(GetContactProto(hContact), MODULENAME)) return 0; - ptrW contactName( db_get_wsa(hContact, MODULENAME, PRESERVE_NAME_KEY)); + ptrW contactName( g_plugin.getWStringA(hContact, PRESERVE_NAME_KEY)); // TEST GET NAME FOR CACHE wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50]; @@ -132,7 +132,7 @@ int SiteDeleted(WPARAM wParam, LPARAM) if (pcachefile != nullptr) { fclose(pcachefile); DeleteFile(newcachepath); - db_set_s(hContact, MODULENAME, CACHE_FILE_KEY, ""); + g_plugin.setString(hContact, CACHE_FILE_KEY, ""); } } return 0; @@ -249,7 +249,7 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM) // Make sure no contact has offline status for any reason on first time run if ( g_plugin.getByte("FirstTime", 100) == 100) { for (auto &hContact : Contacts(MODULENAME)) - db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE); + g_plugin.setWord(hContact, "Status", ID_STATUS_ONLINE); g_plugin.setByte("FirstTime", 1); } @@ -345,7 +345,7 @@ INT_PTR AddToList(WPARAM, LPARAM lParam) // search for existing contact for (auto &hContact : Contacts(MODULENAME)) { // check ID to see if the contact already exist in the database - if (db_get_ws(hContact, MODULENAME, "URL", &dbv)) + if (g_plugin.getWString(hContact, "URL", &dbv)) continue; if (!mir_wstrcmpi(psr->nick.w, dbv.pwszVal)) { // remove the flag for not on list and hidden, thus make the @@ -364,10 +364,10 @@ INT_PTR AddToList(WPARAM, LPARAM lParam) Proto_AddToContact(hContact, MODULENAME); /////////write to db - db_set_b(hContact, MODULENAME, ON_TOP_KEY, 0); - db_set_b(hContact, MODULENAME, DBLE_WIN_KEY, 1); - db_set_s(hContact, MODULENAME, END_STRING_KEY, ""); - db_set_b(hContact, MODULENAME, RWSPACE_KEY, 1); + g_plugin.setByte(hContact, ON_TOP_KEY, 0); + g_plugin.setByte(hContact, DBLE_WIN_KEY, 1); + g_plugin.setString(hContact, END_STRING_KEY, ""); + g_plugin.setByte(hContact, RWSPACE_KEY, 1); //Convert url into a name for contact wchar_t Cnick[255]; @@ -424,14 +424,14 @@ INT_PTR AddToList(WPARAM, LPARAM lParam) //end convert db_set_ws(hContact, "CList", "MyHandle", Newnick); - db_set_ws(hContact, MODULENAME, PRESERVE_NAME_KEY, Newnick); - db_set_ws(hContact, MODULENAME, "Nick", Newnick); - db_set_b(hContact, MODULENAME, CLEAR_DISPLAY_KEY, 1); - db_set_s(hContact, MODULENAME, START_STRING_KEY, ""); - db_set_ws(hContact, MODULENAME, URL_KEY, psr->nick.w); - db_set_ws(hContact, MODULENAME, "Homepage", psr->nick.w); - db_set_b(hContact, MODULENAME, U_ALLSITE_KEY, 1); - db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE); + g_plugin.setWString(hContact, PRESERVE_NAME_KEY, Newnick); + g_plugin.setWString(hContact, "Nick", Newnick); + g_plugin.setByte(hContact, CLEAR_DISPLAY_KEY, 1); + g_plugin.setString(hContact, START_STRING_KEY, ""); + g_plugin.setWString(hContact, URL_KEY, psr->nick.w); + g_plugin.setWString(hContact, "Homepage", psr->nick.w); + g_plugin.setByte(hContact, U_ALLSITE_KEY, 1); + g_plugin.setWord(hContact, "Status", ID_STATUS_ONLINE); // ignore status change db_set_dw(hContact, "Ignore", "Mask", 8); diff --git a/plugins/XSoundNotify/src/dialog.cpp b/plugins/XSoundNotify/src/dialog.cpp index 110e72a6d5..92da7e0041 100644 --- a/plugins/XSoundNotify/src/dialog.cpp +++ b/plugins/XSoundNotify/src/dialog.cpp @@ -52,7 +52,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP } EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_CHOOSE_SOUND), TRUE); DBVARIANT dbv = { 0 }; - if (!db_get_ws(hContact, MODULENAME, SETTINGSKEY, &dbv)) { + if (!g_plugin.getWString(hContact, SETTINGSKEY, &dbv)) { EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_TEST_PLAY), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_RESET_SOUND), TRUE); SetDlgItemText(hwndDlg, IDC_CONT_LABEL_SOUND, PathFindFileName(dbv.pwszVal)); @@ -64,10 +64,10 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP SetDlgItemText(hwndDlg, IDC_CONT_LABEL_SOUND, TranslateT("Not set")); } EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_IGNORE_SOUND), TRUE); - CheckDlgButton(hwndDlg, IDC_CONT_IGNORE_SOUND, db_get_b(hContact, MODULENAME, SETTINGSIGNOREKEY, 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CONT_IGNORE_SOUND, g_plugin.getByte(hContact, SETTINGSIGNOREKEY, 0) ? BST_CHECKED : BST_UNCHECKED); p = XSN_Users.find((XSN_Data *)&hContact); if (p == nullptr) { - ptrW name(db_get_wsa(hContact, MODULENAME, SETTINGSKEY)); + ptrW name(g_plugin.getWStringA(hContact, SETTINGSKEY)); if (name != NULL) XSN_Users.insert(new XSN_Data(hContact, name, IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0, 1)); } @@ -82,9 +82,9 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP if (mir_wstrcmpi(p->path, L"")) { wchar_t shortpath[MAX_PATH]; PathToRelativeW(p->path, shortpath); - db_set_ws(hContact, MODULENAME, SETTINGSKEY, shortpath); + g_plugin.setWString(hContact, SETTINGSKEY, shortpath); } - db_set_b(hContact, MODULENAME, SETTINGSIGNOREKEY, p->ignore); + g_plugin.setByte(hContact, SETTINGSIGNOREKEY, p->ignore); } case IDCANCEL: @@ -134,7 +134,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP isIgnoreSound = 0; if (p == nullptr) { DBVARIANT dbv; - if (!db_get_ws(hContact, MODULENAME, SETTINGSKEY, &dbv)) { + if (!g_plugin.getWString(hContact, SETTINGSKEY, &dbv)) { wchar_t longpath[MAX_PATH] = { 0 }; PathToAbsoluteW(dbv.pwszVal, longpath); Skin_PlaySoundFile(longpath); @@ -159,15 +159,15 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP XSN_Users.remove(p); delete p; } - db_unset(hContact, MODULENAME, SETTINGSKEY); - db_unset(hContact, MODULENAME, SETTINGSIGNOREKEY); + g_plugin.delSetting(hContact, SETTINGSKEY); + g_plugin.delSetting(hContact, SETTINGSIGNOREKEY); break; case IDC_CONT_IGNORE_SOUND: p = XSN_Users.find((XSN_Data *)&hContact); if (p == nullptr) { DBVARIANT dbv; - if (!db_get_ws(hContact, MODULENAME, SETTINGSKEY, &dbv)) { + if (!g_plugin.getWString(hContact, SETTINGSKEY, &dbv)) { wchar_t longpath[MAX_PATH]; PathToAbsoluteW(dbv.pwszVal, longpath); XSN_Users.insert(new XSN_Data(hContact, longpath, IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0, 1)); diff --git a/plugins/XSoundNotify/src/options.cpp b/plugins/XSoundNotify/src/options.cpp index da6828ce61..957816a898 100644 --- a/plugins/XSoundNotify/src/options.cpp +++ b/plugins/XSoundNotify/src/options.cpp @@ -117,7 +117,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l else { MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0); DBVARIANT dbv = { 0 }; - if (!db_get_ws(hContact, MODULENAME, SETTINGSKEY, &dbv)) { + if (!g_plugin.getWString(hContact, SETTINGSKEY, &dbv)) { EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_TEST_PLAY), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_RESET_SOUND), TRUE); SetDlgItemText(hwndDlg, IDC_OPT_LABEL_SOUND, PathFindFileName(dbv.pwszVal)); @@ -128,7 +128,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_RESET_SOUND), FALSE); SetDlgItemText(hwndDlg, IDC_OPT_LABEL_SOUND, TranslateT("Not set")); } - CheckDlgButton(hwndDlg, IDC_OPT_IGNORE_SOUND, db_get_b(hContact, MODULENAME, SETTINGSIGNOREKEY, 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_OPT_IGNORE_SOUND, g_plugin.getByte(hContact, SETTINGSIGNOREKEY, 0) ? BST_CHECKED : BST_UNCHECKED); } } return 0; @@ -219,7 +219,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l isIgnoreSound = 0; if (p == nullptr) { DBVARIANT dbv; - if (!db_get_ws(hContact, MODULENAME, SETTINGSKEY, &dbv)) { + if (!g_plugin.getWString(hContact, SETTINGSKEY, &dbv)) { wchar_t longpath[MAX_PATH]; PathToAbsoluteW(dbv.pwszVal, longpath); Skin_PlaySoundFile(longpath); @@ -265,8 +265,8 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l delete p; SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } - db_unset(hContact, MODULENAME, SETTINGSKEY); - db_unset(hContact, MODULENAME, SETTINGSIGNOREKEY); + g_plugin.delSetting(hContact, SETTINGSKEY); + g_plugin.delSetting(hContact, SETTINGSIGNOREKEY); } } return 0; @@ -295,7 +295,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact); if (p == nullptr) { DBVARIANT dbv; - if (!db_get_ws(hContact, MODULENAME, SETTINGSKEY, &dbv)) { + if (!g_plugin.getWString(hContact, SETTINGSKEY, &dbv)) { wchar_t longpath[MAX_PATH]; PathToAbsoluteW(dbv.pwszVal, longpath); XSN_Users.insert(new XSN_Data(hContact, longpath, IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0, 1)); diff --git a/plugins/XSoundNotify/src/xsn_main.cpp b/plugins/XSoundNotify/src/xsn_main.cpp index 1991619bd8..5455779b36 100644 --- a/plugins/XSoundNotify/src/xsn_main.cpp +++ b/plugins/XSoundNotify/src/xsn_main.cpp @@ -104,9 +104,9 @@ static int ProcessEvent(WPARAM hContact, LPARAM lParam) if (!isReceiveMessage(lParam)) return 0; - isIgnoreSound = db_get_b(hContact, MODULENAME, SETTINGSIGNOREKEY, 0); + isIgnoreSound = g_plugin.getByte(hContact, SETTINGSIGNOREKEY, 0); DBVARIANT dbv; - if (!isIgnoreSound && !db_get_ws(hContact, MODULENAME, SETTINGSKEY, &dbv)) { + if (!isIgnoreSound && !g_plugin.getWString(hContact, SETTINGSKEY, &dbv)) { wchar_t PlaySoundPath[MAX_PATH] = { 0 }; PathToAbsoluteW(dbv.pwszVal, PlaySoundPath); isOwnSound = 0; @@ -149,9 +149,9 @@ static int ProcessChatEvent(WPARAM, LPARAM lParam) if (nick == NULL || gce->ptszText == nullptr) return 0; if (wcsstr(gce->ptszText, nick)) { - isIgnoreSound = db_get_b(hContact, MODULENAME, SETTINGSIGNOREKEY, 0); + isIgnoreSound = g_plugin.getByte(hContact, SETTINGSIGNOREKEY, 0); DBVARIANT dbv; - if (!isIgnoreSound && !db_get_ws(hContact, MODULENAME, SETTINGSKEY, &dbv)) { + if (!isIgnoreSound && !g_plugin.getWString(hContact, SETTINGSKEY, &dbv)) { wchar_t PlaySoundPath[MAX_PATH] = { 0 }; PathToAbsoluteW(dbv.pwszVal, PlaySoundPath); isOwnSound = 0; -- cgit v1.2.3