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/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 +++++------ 7 files changed, 205 insertions(+), 205 deletions(-) (limited to 'plugins/WebView/src') 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); -- cgit v1.2.3