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/QuickReplies/src/events.cpp | 6 +++--- plugins/QuickReplies/src/options.cpp | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'plugins/QuickReplies/src') diff --git a/plugins/QuickReplies/src/events.cpp b/plugins/QuickReplies/src/events.cpp index 74870255db..5865a6298c 100644 --- a/plugins/QuickReplies/src/events.cpp +++ b/plugins/QuickReplies/src/events.cpp @@ -63,7 +63,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) char key[64]; mir_snprintf(key, "RepliesCount_%x", iNumber); - int count = db_get_w(NULL, MODULENAME, key, 0); + int count = g_plugin.getWord(key, 0); if (count == 0 || cbcd->flags & BBCF_RIGHTBUTTON) { mir_snprintf(buttonName, "%s %x", Translate("Button"), iNumber + 1); @@ -76,7 +76,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) LIST replyList(1); for (int i = 0; i < count; i++) { mir_snprintf(key, "Reply_%x_%x", iNumber, i); - ptrW value(db_get_wsa(NULL, MODULENAME, key)); + ptrW value(g_plugin.getWStringA(key)); if (value == nullptr) replyList.insert(mir_wstrdup(L"")); else @@ -94,7 +94,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) CallService(MS_MSG_SENDMESSAGEW, cbcd->hContact, (LPARAM)replyList[index - 1]); mir_snprintf(key, "ImmediatelySend_%x", iNumber); - if (db_get_b(NULL, MODULENAME, key, 1) || cbcd->flags & BBCF_CONTROLPRESSED) + if (g_plugin.getByte(key, 1) || cbcd->flags & BBCF_CONTROLPRESSED) SendMessage(cbcd->hwndFrom, WM_COMMAND, IDOK, 0); } } diff --git a/plugins/QuickReplies/src/options.cpp b/plugins/QuickReplies/src/options.cpp index 170bfba27e..f64a5e0391 100644 --- a/plugins/QuickReplies/src/options.cpp +++ b/plugins/QuickReplies/src/options.cpp @@ -69,14 +69,14 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR mir_subclassWindow(GetDlgItem(hwndDlg, IDC_REPLIES), MessageEditSubclassProc); mir_snprintf(key, "ImmediatelySend_%x", iNumber); - CheckDlgButton(hwndDlg, IDC_IMMEDIATELY, db_get_w(NULL, MODULENAME, key, 1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_IMMEDIATELY, g_plugin.getWord(key, 1) ? BST_CHECKED : BST_UNCHECKED); mir_snprintf(key, "RepliesCount_%x", iNumber); - count = db_get_w(NULL, MODULENAME, key, 0); + count = g_plugin.getWord(key, 0); for (int i = 0; i < count; i++) { mir_snprintf(key, "Reply_%x_%x", iNumber, i); - wchar_t *value = db_get_wsa(NULL, MODULENAME, key); + wchar_t *value = g_plugin.getWStringA(key); if (value) { replies.Append(value); replies.Append(L"\r\n"); @@ -113,11 +113,11 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR wchar_t *tszReplies; mir_snprintf(key, "RepliesCount_%x", iNumber); - count = db_get_b(NULL, MODULENAME, key, 0); + count = g_plugin.getByte(key, 0); for (int i = 0; i < count; i++) { mir_snprintf(key, "Reply_%x_%x", iNumber, i); - db_unset(NULL, MODULENAME, key); + g_plugin.delSetting(key); } int length = SendDlgItemMessage(hwndDlg, IDC_REPLIES, WM_GETTEXTLENGTH, 0, 0); @@ -133,17 +133,17 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR int pos = -1, prev = 0; while ((pos = replies.Find(L"\r\n", prev)) != -1) { mir_snprintf(key, "Reply_%x_%x", iNumber, count++); - db_set_ws(NULL, MODULENAME, key, replies.Mid(prev, pos - prev).GetBuffer()); + g_plugin.setWString(key, replies.Mid(prev, pos - prev).GetBuffer()); prev = pos + 2; } } mir_free(tszReplies); mir_snprintf(key, "RepliesCount_%x", iNumber); - db_set_w(NULL, MODULENAME, key, count); + g_plugin.setWord(key, count); mir_snprintf(key, "ImmediatelySend_%x", iNumber); - db_set_b(NULL, MODULENAME, key, IsDlgButtonChecked(hwndDlg, IDC_IMMEDIATELY)); + g_plugin.setByte(key, IsDlgButtonChecked(hwndDlg, IDC_IMMEDIATELY)); return TRUE; } -- cgit v1.2.3