summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/options.cpp
diff options
context:
space:
mode:
authordartraiden <wowemuh@gmail.com>2022-10-19 23:10:42 +0300
committerdartraiden <wowemuh@gmail.com>2022-10-19 23:10:42 +0300
commitf9842d5d09edeb40f296e9f09be9cc22ac810d41 (patch)
treea9dd970b81922851986e1611ad9e013894d711d0 /protocols/WhatsApp/src/options.cpp
parentf56f50c2dcbd452868520a58c9ae811108545c0e (diff)
Rename WhatsAppWeb to WhatsApp
Diffstat (limited to 'protocols/WhatsApp/src/options.cpp')
-rw-r--r--protocols/WhatsApp/src/options.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/protocols/WhatsApp/src/options.cpp b/protocols/WhatsApp/src/options.cpp
new file mode 100644
index 0000000000..0b9aaef264
--- /dev/null
+++ b/protocols/WhatsApp/src/options.cpp
@@ -0,0 +1,68 @@
+/*
+
+WhatsApp plugin for Miranda NG
+Copyright © 2019-22 George Hazan
+
+*/
+
+#include "stdafx.h"
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+class COptionsDlg : public CProtoDlgBase<WhatsAppProto>
+{
+ CCtrlCheck chkHideChats;
+ CCtrlEdit edtGroup, edtNick;
+ ptrW m_wszOldGroup;
+
+public:
+ COptionsDlg(WhatsAppProto *ppro, int iDlgID, bool bFullDlg) :
+ CProtoDlgBase<WhatsAppProto>(ppro, iDlgID),
+ chkHideChats(this, IDC_HIDECHATS),
+ edtNick(this, IDC_NICK),
+ edtGroup(this, IDC_DEFGROUP),
+ m_wszOldGroup(mir_wstrdup(ppro->m_wszDefaultGroup))
+ {
+ CreateLink(edtNick, ppro->m_wszNick);
+ CreateLink(edtGroup, ppro->m_wszDefaultGroup);
+
+ if (bFullDlg)
+ CreateLink(chkHideChats, ppro->m_bHideGroupchats);
+ }
+
+ bool OnApply() override
+ {
+ if (mir_wstrlen(m_proto->m_wszNick)) {
+ SetFocus(edtNick.GetHwnd());
+ return false;
+ }
+
+ if (mir_wstrcmp(m_proto->m_wszDefaultGroup, m_wszOldGroup))
+ Clist_GroupCreate(0, m_proto->m_wszDefaultGroup);
+ return true;
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+INT_PTR WhatsAppProto::SvcCreateAccMgrUI(WPARAM, LPARAM hwndParent)
+{
+ auto *pDlg = new COptionsDlg(this, IDD_ACCMGRUI, false);
+ pDlg->SetParent((HWND)hwndParent);
+ pDlg->Create();
+ return (INT_PTR)pDlg->GetHwnd();
+}
+
+int WhatsAppProto::OnOptionsInit(WPARAM wParam, LPARAM)
+{
+ OPTIONSDIALOGPAGE odp = {};
+ odp.szTitle.w = m_tszUserName;
+ odp.flags = ODPF_UNICODE;
+ odp.szGroup.w = LPGENW("Network");
+
+ odp.position = 1;
+ odp.szTab.w = LPGENW("Account");
+ odp.pDialog = new COptionsDlg(this, IDD_OPTIONS, true);
+ g_plugin.addOptions(wParam, &odp);
+ return 0;
+}