From f9842d5d09edeb40f296e9f09be9cc22ac810d41 Mon Sep 17 00:00:00 2001 From: dartraiden Date: Wed, 19 Oct 2022 23:10:42 +0300 Subject: Rename WhatsAppWeb to WhatsApp --- protocols/WhatsApp/src/options.cpp | 68 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 protocols/WhatsApp/src/options.cpp (limited to 'protocols/WhatsApp/src/options.cpp') 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 +{ + CCtrlCheck chkHideChats; + CCtrlEdit edtGroup, edtNick; + ptrW m_wszOldGroup; + +public: + COptionsDlg(WhatsAppProto *ppro, int iDlgID, bool bFullDlg) : + CProtoDlgBase(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; +} -- cgit v1.2.3