summaryrefslogtreecommitdiff
path: root/plugins/Scriver/src/chat_options.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-12-08 18:35:02 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-12-08 18:35:02 +0300
commit0b084cff5bb71a140d5181caa452a95b74ac8103 (patch)
treeb0394812fbed52040485f90a1815892ad4f565fa /plugins/Scriver/src/chat_options.cpp
parent7f1f391faf93d216bfe651131a95d70961f8ffa2 (diff)
chats:
- Chat_GetGroup & Chat_SetGroup functions added to stop the zoo with chat default group name; - fixes #1655 (custom chat group name doesn't work in Discord)
Diffstat (limited to 'plugins/Scriver/src/chat_options.cpp')
-rw-r--r--plugins/Scriver/src/chat_options.cpp25
1 files changed, 5 insertions, 20 deletions
diff --git a/plugins/Scriver/src/chat_options.cpp b/plugins/Scriver/src/chat_options.cpp
index d128a7d832..fdf53a98f9 100644
--- a/plugins/Scriver/src/chat_options.cpp
+++ b/plugins/Scriver/src/chat_options.cpp
@@ -221,16 +221,6 @@ static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM p
return 0;
}
-static void InitSetting(wchar_t **ppPointer, char *pszSetting, wchar_t *pszDefault)
-{
- DBVARIANT dbv;
- if (!db_get_ws(0, CHAT_MODULE, pszSetting, &dbv)) {
- replaceStrW(*ppPointer, dbv.pwszVal);
- db_free(&dbv);
- }
- else replaceStrW(*ppPointer, pszDefault);
-}
-
#define OPT_FIXHEADINGS (WM_USER+1)
INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -248,12 +238,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading1, branch1, _countof(branch1), 0);
FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading4, branch4, _countof(branch4), 0x1000);
SendMessage(hwndDlg, OPT_FIXHEADINGS, 0, 0);
- {
- wchar_t* pszGroup = nullptr;
- InitSetting(&pszGroup, "AddToGroup", L"Chat rooms");
- SetDlgItemText(hwndDlg, IDC_CHAT_GROUP, pszGroup);
- mir_free(pszGroup);
- }
+ SetDlgItemText(hwndDlg, IDC_CHAT_GROUP, ptrW(Chat_GetGroup()));
break;
case OPT_FIXHEADINGS:
@@ -316,11 +301,11 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
case PSN_APPLY:
int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_GROUP));
if (iLen > 0) {
- ptrA pszText((char*)mir_alloc(iLen + 1));
- GetDlgItemTextA(hwndDlg, IDC_CHAT_GROUP, pszText, iLen + 1);
- db_set_s(0, CHAT_MODULE, "AddToGroup", pszText);
+ ptrW pszText((wchar_t*)mir_alloc(sizeof(wchar_t)*(iLen + 1)));
+ GetDlgItemTextW(hwndDlg, IDC_CHAT_GROUP, pszText, iLen + 1);
+ Chat_SetGroup(pszText);
}
- else db_set_s(0, CHAT_MODULE, "AddToGroup", "");
+ else Chat_SetGroup(nullptr);
iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0);
if (iLen > 0)