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/XSoundNotify/src/dialog.cpp | 18 +++++++++--------- plugins/XSoundNotify/src/options.cpp | 12 ++++++------ plugins/XSoundNotify/src/xsn_main.cpp | 8 ++++---- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'plugins/XSoundNotify/src') 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