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/Non-IM Contact/src/contactinfo.cpp | 4 ++-- plugins/Non-IM Contact/src/dialog.cpp | 12 ++++++------ plugins/Non-IM Contact/src/files.cpp | 18 +++++++++--------- plugins/Non-IM Contact/src/main.cpp | 2 +- plugins/Non-IM Contact/src/namereplacing.cpp | 8 ++++---- plugins/Non-IM Contact/src/services.cpp | 12 ++++++------ plugins/Non-IM Contact/src/stdafx.h | 2 +- plugins/Non-IM Contact/src/timer.cpp | 8 ++++---- 8 files changed, 33 insertions(+), 33 deletions(-) (limited to 'plugins/Non-IM Contact/src') diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp index ec3a49d1e3..9ee6ce2d77 100644 --- a/plugins/Non-IM Contact/src/contactinfo.cpp +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -156,10 +156,10 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP EnableWindow(GetDlgItem(hwnd, IDC_TIMER), 1); wchar_t string[512]; SetDlgItemText(hwnd, IDC_TIMER, _itow(db_get_w(hContact, MODNAME, "Timer", 15), string, 10)); - if (!db_get_w(NULL, MODNAME, "Timer", 1)) + if (!db_get_w(0, MODNAME, "Timer", 1)) SetDlgItemText(hwnd, IDC_TIMER_INTERVAL_MSG, TranslateT("Non-IM Contact protocol timer is Disabled")); else { - mir_snwprintf(string, TranslateT("Timer intervals... Non-IM Contact Protocol timer is %d seconds"), db_get_w(NULL, MODNAME, "Timer", 1)); + mir_snwprintf(string, TranslateT("Timer intervals... Non-IM Contact Protocol timer is %d seconds"), db_get_w(0, MODNAME, "Timer", 1)); SetDlgItemText(hwnd, IDC_TIMER_INTERVAL_MSG, string); } } diff --git a/plugins/Non-IM Contact/src/dialog.cpp b/plugins/Non-IM Contact/src/dialog.cpp index fe21a066f3..873aac3052 100644 --- a/plugins/Non-IM Contact/src/dialog.cpp +++ b/plugins/Non-IM Contact/src/dialog.cpp @@ -22,10 +22,10 @@ INT_PTR CALLBACK DlgProcNimcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwnd); - CheckDlgButton(hwnd, IDC_AWAYISNOTONLINE, db_get_b(NULL, MODNAME, "AwayAsStatus", 0) ? BST_CHECKED : BST_UNCHECKED); - if (db_get_w(NULL, MODNAME, "Timer", 1)) { + CheckDlgButton(hwnd, IDC_AWAYISNOTONLINE, db_get_b(0, MODNAME, "AwayAsStatus", 0) ? BST_CHECKED : BST_UNCHECKED); + if (db_get_w(0, MODNAME, "Timer", 1)) { EnableWindow(GetDlgItem(hwnd, IDC_TIMER_INT), 1); - SetDlgItemText(hwnd, IDC_TIMER_INT, _itow(db_get_w(NULL, MODNAME, "Timer", 1), tmp, 10)); + SetDlgItemText(hwnd, IDC_TIMER_INT, _itow(db_get_w(0, MODNAME, "Timer", 1), tmp, 10)); EnableWindow(GetDlgItem(hwnd, IDC_TIMER_TEXT), 1); } else { @@ -58,12 +58,12 @@ INT_PTR CALLBACK DlgProcNimcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(NULL, MODNAME, "AwayAsStatus", (BYTE)IsDlgButtonChecked(hwnd, IDC_AWAYISNOTONLINE)); + db_set_b(0, MODNAME, "AwayAsStatus", (BYTE)IsDlgButtonChecked(hwnd, IDC_AWAYISNOTONLINE)); if (BST_UNCHECKED == IsDlgButtonChecked(hwnd, IDC_DISABLETIMER) && GetWindowTextLength(GetDlgItem(hwnd, IDC_TIMER_INT))) { GetDlgItemText(hwnd, IDC_TIMER_INT, tmp, _countof(tmp)); - db_set_w(NULL, MODNAME, "Timer", (WORD)_wtoi(tmp)); + db_set_w(0, MODNAME, "Timer", (WORD)_wtoi(tmp)); } - else db_set_w(NULL, MODNAME, "Timer", 0); + else db_set_w(0, MODNAME, "Timer", 0); return TRUE; } } diff --git a/plugins/Non-IM Contact/src/files.cpp b/plugins/Non-IM Contact/src/files.cpp index b0164a9ed7..8a58b495ac 100644 --- a/plugins/Non-IM Contact/src/files.cpp +++ b/plugins/Non-IM Contact/src/files.cpp @@ -132,8 +132,8 @@ void readFile(HWND hwnd) SendDlgItemMessageA(hwnd, IDC_FILE_CONTENTS, LB_ADDSTRING, 0, (LPARAM)temp1); lineNumber++; fileLength++; - if ((unsigned int)SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_GETHORIZONTALEXTENT, 0, 0) <= (mir_strlen(temp1)*db_get_b(NULL, MODNAME, "WidthMultiplier", 5))) - SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_SETHORIZONTALEXTENT, (mir_strlen(temp1)*db_get_b(NULL, MODNAME, "WidthMultiplier", 5)), 0); + if ((unsigned int)SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_GETHORIZONTALEXTENT, 0, 0) <= (mir_strlen(temp1)*db_get_b(0, MODNAME, "WidthMultiplier", 5))) + SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_SETHORIZONTALEXTENT, (mir_strlen(temp1)*db_get_b(0, MODNAME, "WidthMultiplier", 5)), 0); } fclose(filen); } @@ -157,7 +157,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if ((!strncmp("http://", string, mir_strlen("http://"))) || (!strncmp("https://", string, mir_strlen("https://")))) { SetDlgItemTextA(hwnd, IDC_URL, string); mir_snprintf(fn, "fn%d_timer", i); - SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(db_get_w(NULL, MODNAME, fn, 60), tmp, 10)); + SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(db_get_w(0, MODNAME, fn, 60), tmp, 10)); } readFile(hwnd); } @@ -184,7 +184,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) mir_snprintf(szFileName, "%s\\plugins\\%s.html", getMimDir(temp), fn); if (savehtml(szFileName)) { mir_snprintf(fn, "fn%d", i); - db_set_s(NULL, MODNAME, fn, url); + db_set_s(0, MODNAME, fn, url); int timer; if (!GetWindowTextLength(GetDlgItem(hwnd, IDC_WWW_TIMER))) timer = 60; @@ -193,7 +193,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) timer = atoi(text); } mir_snprintf(fn, "fn%d_timer", i); - db_set_w(NULL, MODNAME, fn, (WORD)timer); + db_set_w(0, MODNAME, fn, (WORD)timer); SendMessage(hwnd, WM_RELOADWINDOW, 0, 0); } break; @@ -214,7 +214,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) mir_snprintf(fn, "fn%d", i); if (db_get_static(NULL, MODNAME, fn, file, _countof(file))) { if (Openfile(file, 1)) { - db_set_s(NULL, MODNAME, fn, file); + db_set_s(0, MODNAME, fn, file); int index = SendDlgItemMessageA(hwnd, IDC_FILE_LIST, CB_ADDSTRING, 0, (LPARAM)file); SendDlgItemMessage(hwnd, IDC_FILE_LIST, CB_SETITEMDATA, index, (LPARAM)i); SendDlgItemMessage(hwnd, IDC_FILE_LIST, CB_SETCURSEL, index, 0); @@ -247,7 +247,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) while (!db_get_static(NULL, MODNAME, fn, tmp, _countof(tmp))) { char fn1[4]; mir_snprintf(fn1, "fn%d", i - 1); - db_set_s(NULL, MODNAME, fn1, tmp); + db_set_s(0, MODNAME, fn1, tmp); mir_snprintf(fn, "fn%d", ++i); } mir_snprintf(fn, "fn%d", --i); @@ -267,7 +267,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (!strncmp("http://", tmp, mir_strlen("http://")) || !strncmp("https://", tmp, mir_strlen("https://"))) { SetDlgItemTextA(hwnd, IDC_URL, tmp); mir_snprintf(fn, "fn%d_timer", index); - SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(db_get_w(NULL, MODNAME, fn, 60), tmp, 10)); + SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(db_get_w(0, MODNAME, fn, 60), tmp, 10)); } else { SetDlgItemText(hwnd, IDC_URL, L""); @@ -302,7 +302,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (!db_get_static(NULL, MODNAME, fn, string, _countof(string))) if (!strncmp("http://", string, mir_strlen("http://")) || !strncmp("https://", string, mir_strlen("https://"))) { mir_snprintf(fn, "fn%d_timer", i); - db_set_w(NULL, MODNAME, fn, (WORD)timer); + db_set_w(0, MODNAME, fn, (WORD)timer); } return TRUE; diff --git a/plugins/Non-IM Contact/src/main.cpp b/plugins/Non-IM Contact/src/main.cpp index 62bac3b7c5..bbefafd3a6 100644 --- a/plugins/Non-IM Contact/src/main.cpp +++ b/plugins/Non-IM Contact/src/main.cpp @@ -149,7 +149,7 @@ int CMPlugin::Load() mi.pszService = "LoadFilesDlg"; Menu_AddMainMenuItem(&mi); - if (db_get_b(NULL, MODNAME, "Beta", 0)) { + if (db_get_b(0, MODNAME, "Beta", 0)) { SET_UID(mi, 0x23051356, 0xad45, 0x4101, 0x8e, 0x11, 0xf6, 0x3a, 0xe8, 0xa3, 0xa5, 0x25); mi.position = 600090002; mi.name.a = LPGEN("&Export all Non-IM Contacts"); diff --git a/plugins/Non-IM Contact/src/namereplacing.cpp b/plugins/Non-IM Contact/src/namereplacing.cpp index cb1103260b..8e93072747 100644 --- a/plugins/Non-IM Contact/src/namereplacing.cpp +++ b/plugins/Non-IM Contact/src/namereplacing.cpp @@ -302,19 +302,19 @@ void checkStringForSaveN(CMStringA &str) switch (D[0]) { case '0': case 'b': - db_set_b(NULL, A, B, (BYTE)atoi(C)); + db_set_b(0, A, B, (BYTE)atoi(C)); break; case '1': case 'w': - db_set_w(NULL, A, B, (WORD)atoi(C)); + db_set_w(0, A, B, (WORD)atoi(C)); break; case '2': case 'd': - db_set_dw(NULL, A, B, (DWORD)atoi(C)); + db_set_dw(0, A, B, (DWORD)atoi(C)); break; case '3': case 's': - db_set_s(NULL, A, B, C); + db_set_s(0, A, B, C); break; } } diff --git a/plugins/Non-IM Contact/src/services.cpp b/plugins/Non-IM Contact/src/services.cpp index 395f323c98..4e70d79a4e 100644 --- a/plugins/Non-IM Contact/src/services.cpp +++ b/plugins/Non-IM Contact/src/services.cpp @@ -55,11 +55,11 @@ int SetLCStatus(WPARAM wParam, LPARAM) { int oldStatus = LCStatus; LCStatus = wParam; - db_set_w(NULL, MODNAME, "Status", (WORD)wParam); - db_set_w(NULL, MODNAME, "timerCount", 0); - if (LCStatus == ID_STATUS_OFFLINE || (LCStatus == ID_STATUS_AWAY && !db_get_b(NULL, MODNAME, "AwayAsStatus", 0)) || !db_get_w(NULL, MODNAME, "Timer", 1)) + db_set_w(0, MODNAME, "Status", (WORD)wParam); + db_set_w(0, MODNAME, "timerCount", 0); + if (LCStatus == ID_STATUS_OFFLINE || (LCStatus == ID_STATUS_AWAY && !db_get_b(0, MODNAME, "AwayAsStatus", 0)) || !db_get_w(0, MODNAME, "Timer", 1)) killTimer(); - else if (db_get_w(NULL, MODNAME, "Timer", 1)) + else if (db_get_w(0, MODNAME, "Timer", 1)) startTimer(TIMER); for (auto &hContact : Contacts(MODNAME)) { @@ -79,9 +79,9 @@ int SetLCStatus(WPARAM wParam, LPARAM) break; case ID_STATUS_AWAY: - if (db_get_b(NULL, MODNAME, "AwayAsStatus", 0) && (db_get_b(hContact, MODNAME, "AlwaysVisible", 0) || (db_get_w(hContact, MODNAME, "Icon", ID_STATUS_ONLINE) == ID_STATUS_AWAY))) + if (db_get_b(0, MODNAME, "AwayAsStatus", 0) && (db_get_b(hContact, MODNAME, "AlwaysVisible", 0) || (db_get_w(hContact, MODNAME, "Icon", ID_STATUS_ONLINE) == ID_STATUS_AWAY))) db_set_w(hContact, MODNAME, "Status", (WORD)db_get_w(hContact, MODNAME, "Icon", ID_STATUS_ONLINE)); - else if (!db_get_b(NULL, MODNAME, "AwayAsStatus", 0)) + else if (!db_get_b(0, MODNAME, "AwayAsStatus", 0)) db_set_w(hContact, MODNAME, "Status", (WORD)db_get_w(hContact, MODNAME, "Icon", ID_STATUS_ONLINE)); else db_set_w(hContact, MODNAME, "Status", ID_STATUS_OFFLINE); diff --git a/plugins/Non-IM Contact/src/stdafx.h b/plugins/Non-IM Contact/src/stdafx.h index 43d301a805..7df1c07b7b 100644 --- a/plugins/Non-IM Contact/src/stdafx.h +++ b/plugins/Non-IM Contact/src/stdafx.h @@ -58,7 +58,7 @@ struct DLGTEMPLATEEX #define MAX_STRING_LENGTH 10000 #define LINE_LENGTH 10000 #define msg(a,b) MessageBoxA(0,a,b,MB_OK); -#define TIMER (db_get_w(NULL, MODNAME, "Timer", 1) * 1000) +#define TIMER (db_get_w(0, MODNAME, "Timer", 1) * 1000) /* ERROR VALUES */ #define ERROR_NO_LINE_AFTER_VAR_F -1 #define ERROR_LINE_NOT_READ -2 diff --git a/plugins/Non-IM Contact/src/timer.cpp b/plugins/Non-IM Contact/src/timer.cpp index b076d9284f..ba658997d6 100644 --- a/plugins/Non-IM Contact/src/timer.cpp +++ b/plugins/Non-IM Contact/src/timer.cpp @@ -13,13 +13,13 @@ void timerFunc(void*) { char text[512], fn[16], szFileName[MAX_PATH], temp[MAX_PATH]; - int timerCount = db_get_w(NULL, MODNAME, "timerCount", 1) + 1; + int timerCount = db_get_w(0, MODNAME, "timerCount", 1) + 1; if (LCStatus == ID_STATUS_OFFLINE) { killTimer(); return; } - db_set_w(NULL, MODNAME, "timerCount", (WORD)timerCount); + db_set_w(0, MODNAME, "timerCount", (WORD)timerCount); /* update the web pages*/ for (int i = 0;; i++) { @@ -29,7 +29,7 @@ void timerFunc(void*) if (!strncmp("http://", text, mir_strlen("http://")) || !strncmp("https://", text, mir_strlen("https://"))) { mir_snprintf(fn, "fn%d_timer", i); - int timer = db_get_w(NULL, MODNAME, fn, 60); + int timer = db_get_w(0, MODNAME, fn, 60); if (timer && !(timerCount % timer)) { if (!InternetDownloadFile(text)) { mir_snprintf(szFileName, "%s\\plugins\\fn%d.html", getMimDir(temp), i); @@ -77,7 +77,7 @@ int startTimer(int interval) int killTimer() { if (timerId != 0) { - db_set_w(NULL, MODNAME, "timerCount", 0); + db_set_w(0, MODNAME, "timerCount", 0); KillTimer(nullptr, timerId); timerId = 0; } -- cgit v1.2.3