From 53fe3e46177d17b4941610de19f5cc6210700cb4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 12 Nov 2018 21:44:56 +0300 Subject: db_* functions replaced with g_plugin calls --- plugins/CrashDumper/src/crshdmp.cpp | 10 +++++----- plugins/CrashDumper/src/dumper.cpp | 2 +- plugins/CrashDumper/src/ui.cpp | 24 ++++++++++++------------ plugins/CrashDumper/src/upload.cpp | 10 +++++----- plugins/CrashDumper/src/utils.cpp | 2 +- 5 files changed, 24 insertions(+), 24 deletions(-) (limited to 'plugins/CrashDumper/src') diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index 89d6229fa6..7f603b9a9e 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -154,7 +154,7 @@ INT_PTR OpenUrl(WPARAM wParam, LPARAM) INT_PTR CopyLinkToClipboard(WPARAM, LPARAM) { - ptrW tmp(db_get_wsa(NULL, MODULENAME, "Username")); + ptrW tmp(g_plugin.getWStringA("Username")); if (tmp != NULL) { wchar_t buffer[MAX_PATH]; mir_snwprintf(buffer, L"https://vi.miranda-ng.org/detail/%s", tmp); @@ -336,7 +336,7 @@ static int ModulesLoaded(WPARAM, LPARAM) if (servicemode) ViewVersionInfo(0, 0); - else if (db_get_b(NULL, MODULENAME, "UploadChanged", 0) && !ProcessVIHash(false)) + else if (g_plugin.getByte("UploadChanged", 0) && !ProcessVIHash(false)) UploadVersionInfo(0, 0xa1); return 0; @@ -355,9 +355,9 @@ int CMPlugin::Load() if (hMsftedit == nullptr) return 1; - clsdates = db_get_b(NULL, MODULENAME, "ClassicDates", 1) != 0; - dtsubfldr = db_get_b(NULL, MODULENAME, "SubFolders", 1) != 0; - catchcrashes = db_get_b(NULL, MODULENAME, "CatchCrashes", 1) != 0; + clsdates = g_plugin.getByte("ClassicDates", 1) != 0; + dtsubfldr = g_plugin.getByte("SubFolders", 1) != 0; + catchcrashes = g_plugin.getByte("CatchCrashes", 1) != 0; profname = Utils_ReplaceVarsW(L"%miranda_profilename%.dat"); profpath = Utils_ReplaceVarsW(L"%miranda_userdata%"); diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp index 52d42d745e..ddf4fd2f56 100644 --- a/plugins/CrashDumper/src/dumper.cpp +++ b/plugins/CrashDumper/src/dumper.cpp @@ -604,6 +604,6 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const wcha if (len > 8192) free(dst); - if (db_get_b(0, MODULENAME, "ShowCrashMessageBox", 1) && msg && IDYES == MessageBox(nullptr, msg, L"Miranda Crash Dumper", MB_YESNO | MB_ICONERROR | MB_TASKMODAL | MB_DEFBUTTON2 | MB_TOPMOST)) + if (g_plugin.getByte("ShowCrashMessageBox", 1) && msg && IDYES == MessageBox(nullptr, msg, L"Miranda Crash Dumper", MB_YESNO | MB_ICONERROR | MB_TASKMODAL | MB_DEFBUTTON2 | MB_TOPMOST)) StoreStringToClip(buffer); } diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp index c9b642af73..c085d0efc1 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -187,15 +187,15 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP TranslateDialogDefault(hwndDlg); { DBVARIANT dbv; - if (db_get_s(NULL, MODULENAME, "Username", &dbv) == 0) { + if (g_plugin.getString("Username", &dbv) == 0) { SetDlgItemTextA(hwndDlg, IDC_USERNAME, dbv.pszVal); db_free(&dbv); } - if (db_get_s(NULL, MODULENAME, "Password", &dbv) == 0) { + if (g_plugin.getString("Password", &dbv) == 0) { SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal); db_free(&dbv); } - CheckDlgButton(hwndDlg, IDC_UPLOADCHN, db_get_b(NULL, MODULENAME, "UploadChanged", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_UPLOADCHN, g_plugin.getByte("UploadChanged", 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CLASSICDATES, clsdates ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DATESUBFOLDER, dtsubfldr ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CATCHCRASHES, catchcrashes ? BST_CHECKED : BST_UNCHECKED); @@ -230,28 +230,28 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY) { char szSetting[100]; GetDlgItemTextA(hwndDlg, IDC_USERNAME, szSetting, _countof(szSetting)); - db_set_s(NULL, MODULENAME, "Username", szSetting); + g_plugin.setString("Username", szSetting); GetDlgItemTextA(hwndDlg, IDC_PASSWORD, szSetting, _countof(szSetting)); - db_set_s(NULL, MODULENAME, "Password", szSetting); + g_plugin.setString("Password", szSetting); - db_set_b(NULL, MODULENAME, "UploadChanged", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UPLOADCHN)); + g_plugin.setByte("UploadChanged", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UPLOADCHN)); clsdates = IsDlgButtonChecked(hwndDlg, IDC_CLASSICDATES) == BST_CHECKED; if (clsdates) - db_set_b(NULL, MODULENAME, "ClassicDates", 1); + g_plugin.setByte("ClassicDates", 1); else - db_set_b(NULL, MODULENAME, "ClassicDates", 0); + g_plugin.setByte("ClassicDates", 0); dtsubfldr = IsDlgButtonChecked(hwndDlg, IDC_DATESUBFOLDER) == BST_CHECKED; if (dtsubfldr) - db_set_b(NULL, MODULENAME, "SubFolders", 1); + g_plugin.setByte("SubFolders", 1); else - db_set_b(NULL, MODULENAME, "SubFolders", 0); + g_plugin.setByte("SubFolders", 0); catchcrashes = IsDlgButtonChecked(hwndDlg, IDC_CATCHCRASHES) == BST_CHECKED; if (catchcrashes) - db_set_b(NULL, MODULENAME, "CatchCrashes", 1); + g_plugin.setByte("CatchCrashes", 1); else - db_set_b(NULL, MODULENAME, "CatchCrashes", 0); + g_plugin.setByte("CatchCrashes", 0); } break; } diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp index adfe5b0aa0..746567bd28 100644 --- a/plugins/CrashDumper/src/upload.cpp +++ b/plugins/CrashDumper/src/upload.cpp @@ -39,14 +39,14 @@ void GetLoginStr(char* user, size_t szuser, char* pass) { DBVARIANT dbv; - if (db_get_s(NULL, MODULENAME, "Username", &dbv) == 0) { + if (g_plugin.getString("Username", &dbv) == 0) { strncpy_s(user, szuser, dbv.pszVal, _TRUNCATE); db_free(&dbv); } else user[0] = 0; - if (db_get_s(NULL, MODULENAME, "Password", &dbv) == 0) { + if (g_plugin.getString("Password", &dbv) == 0) { BYTE hash[16]; mir_md5_state_t context; @@ -129,7 +129,7 @@ bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) // if the recieved code is 200 OK switch (nlhrReply->resultCode) { case 200: - if (db_get_b(NULL, MODULENAME, "UploadChanged", 0)) + if (g_plugin.getByte("UploadChanged", 0)) ProcessVIHash(true); ShowMessage(1, TranslateT("Version Info upload successful.")); @@ -242,11 +242,11 @@ bool ProcessVIHash(bool store) arrayToHex(hash, sizeof(hash), hashstr); if (store) { - db_set_s(NULL, MODULENAME, "VIHash", hashstr); + g_plugin.setString("VIHash", hashstr); return true; } - ptrA VIHash(db_get_sa(NULL, MODULENAME, "VIHash")); + ptrA VIHash(g_plugin.getStringA("VIHash")); if (VIHash == NULL) return false; diff --git a/plugins/CrashDumper/src/utils.cpp b/plugins/CrashDumper/src/utils.cpp index 9d0bb2cbd4..c2908ff458 100644 --- a/plugins/CrashDumper/src/utils.cpp +++ b/plugins/CrashDumper/src/utils.cpp @@ -421,6 +421,6 @@ bool IsPluginEnabled(wchar_t* filename) char* fname; crsi_t2a(fname, filename); char* ext = strstr(_strlwr(fname), ".dll"); - bool res = ext && ext[4] == '\0' && db_get_b(NULL, "PluginDisable", fname, 0) == 0; + bool res = ext && ext[4] == '\0' && db_get_b(0, "PluginDisable", fname, 0) == 0; return res; } -- cgit v1.2.3