summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-12-09 22:07:43 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-12-09 22:07:43 +0300
commit15d04b366b37563254f914a41db97646730514b9 (patch)
tree2536d46b4c4a92338943002ffcd9e29995859748
parentd0d6aef247ab3baf68c4ad4b2689283c1b36b0f4 (diff)
fixes #1059 (StopSpam: account selection do not accessible for screen readers)
-rw-r--r--plugins/StopSpamPlus/res/stopspam.rc2
-rw-r--r--plugins/StopSpamPlus/src/events.cpp39
-rw-r--r--plugins/StopSpamPlus/src/opt_proto.cpp135
-rw-r--r--plugins/StopSpamPlus/src/options.cpp283
-rw-r--r--plugins/StopSpamPlus/src/stdafx.h12
-rw-r--r--plugins/StopSpamPlus/src/utils.cpp5
6 files changed, 193 insertions, 283 deletions
diff --git a/plugins/StopSpamPlus/res/stopspam.rc b/plugins/StopSpamPlus/res/stopspam.rc
index 5e856d1571..7ee8a32c79 100644
--- a/plugins/StopSpamPlus/res/stopspam.rc
+++ b/plugins/StopSpamPlus/res/stopspam.rc
@@ -49,7 +49,7 @@ EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
LTEXT "Disable protection for following accounts:",IDC_STATIC,24,7,216,11
- CONTROL "",IDC_PROTO,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | TVS_NONEVENHEIGHT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,24,22,216,166
+ CONTROL "",IDC_PROTO,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,24,22,216,166
END
IDD_MAIN DIALOGEX 0, 0, 309, 189
diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp
index 6b5c95a53c..f7ac53c6bb 100644
--- a/plugins/StopSpamPlus/src/events.cpp
+++ b/plugins/StopSpamPlus/src/events.cpp
@@ -1,8 +1,10 @@
#include "stdafx.h"
-int OnDbEventAdded(WPARAM wParam, LPARAM lParam)
+char const *answeredSetting = "Answered";
+char const *questCountSetting = "QuestionCount";
+
+int OnDbEventAdded(WPARAM, LPARAM lParam)
{
- UNREFERENCED_PARAMETER(wParam);
MEVENT hDbEvent = (MEVENT)lParam;
DBEVENTINFO dbei = {};
@@ -84,7 +86,7 @@ int OnDbEventFilterAdd(WPARAM w, LPARAM l)
tstring message;
- if (dbei->flags & DBEF_UTF){
+ if (dbei->flags & DBEF_UTF) {
WCHAR* msg_u = mir_utf8decodeW((char*)dbei->pBlob);
message = msg_u;
mir_free(msg_u);
@@ -133,9 +135,7 @@ int OnDbEventFilterAdd(WPARAM w, LPARAM l)
// if message message does not contain infintite talk protection prefix
// and question count for this contact is less then maximum
const wchar_t *pwszPrefix = TranslateT("StopSpam automatic message:\r\n");
- if ((!plSets->InfTalkProtection.Get() || tstring::npos == message.find(pwszPrefix))
- && (!plSets->MaxQuestCount.Get() || db_get_dw(hContact, pluginName, questCountSetting, 0) < plSets->MaxQuestCount.Get()))
- {
+ if ((!plSets->InfTalkProtection.Get() || tstring::npos == message.find(pwszPrefix)) && (!plSets->MaxQuestCount.Get() || db_get_dw(hContact, pluginName, questCountSetting, 0) < plSets->MaxQuestCount.Get())) {
// send question
tstring q = pwszPrefix + variables_parse((tstring)(plSets->Question), hContact);
@@ -162,33 +162,6 @@ int OnDbEventFilterAdd(WPARAM w, LPARAM l)
return 1;
}
-int OnOptInit(WPARAM w, LPARAM l)
-{
- UNREFERENCED_PARAMETER(l);
-
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.szGroup.a = LPGEN("Message sessions");
- odp.szTitle.a = pluginName;
- odp.position = -1;
- odp.hInstance = hInst;
-
- odp.szTab.a = LPGEN("General");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_MAIN);
- odp.pfnDlgProc = MainDlgProc;
- Options_AddPage(w, &odp);
-
- odp.szTab.a = LPGEN("Messages");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_MESSAGES);
- odp.pfnDlgProc = MessagesDlgProc;
- Options_AddPage(w, &odp);
-
- odp.szTab.a = LPGEN("Accounts");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_PROTO);
- odp.pfnDlgProc = ProtoDlgProc;
- Options_AddPage(w, &odp);
- return 0;
-}
-
int OnDbContactSettingchanged(WPARAM hContact, LPARAM l)
{
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)l;
diff --git a/plugins/StopSpamPlus/src/opt_proto.cpp b/plugins/StopSpamPlus/src/opt_proto.cpp
deleted file mode 100644
index 90592d4047..0000000000
--- a/plugins/StopSpamPlus/src/opt_proto.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-#include "stdafx.h"
-
-struct ProtocolData
-{
- char *RealName;
- int show, enabled;
-};
-
-int IsProtoIM(const PROTOACCOUNT *pa)
-{
- return !pa->bIsVirtual;
-}
-
-int FillTree(HWND hwnd)
-{
- ProtocolData *PD;
-
- TVINSERTSTRUCT tvis;
- tvis.hParent = nullptr;
- tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
-
- TreeView_DeleteAllItems(hwnd);
-
- int n;
- PROTOACCOUNT** pa;
- Proto_EnumAccounts(&n, &pa);
-
- for (int i = 0; i < n; i++) {
- if (Proto_IsAccountEnabled(pa[i])) {
- PD = (ProtocolData*)mir_alloc(sizeof(ProtocolData));
- PD->RealName = pa[i]->szModuleName;
- PD->enabled = IsProtoIM(pa[i]);
- PD->show = PD->enabled ? (plSets->ProtoDisabled(PD->RealName) ? 1 : 0) : 100;
-
- tvis.item.lParam = (LPARAM)PD;
- tvis.item.pszText = pa[i]->tszAccountName;
- tvis.item.iImage = tvis.item.iSelectedImage = PD->show;
- TreeView_InsertItem(hwnd, &tvis);
- }
- }
-
- return 0;
-}
-
-INT_PTR CALLBACK ProtoDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lParam)
-{
- HWND hwndProto = GetDlgItem(hwnd, IDC_PROTO);
-
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwnd);
-
- SetWindowLongPtr(hwndProto, GWL_STYLE, GetWindowLongPtr(hwndProto, GWL_STYLE) | TVS_NOHSCROLL);
- {
- HIMAGELIST himlCheckBoxes = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 2, 2);
- HICON Icon;
- Icon = (HICON)Skin_LoadIcon(SKINICON_OTHER_NOTICK);
- ImageList_AddIcon(himlCheckBoxes, Icon);
- IcoLib_ReleaseIcon(Icon);
- Icon = (HICON)Skin_LoadIcon(SKINICON_OTHER_TICK);
- ImageList_AddIcon(himlCheckBoxes, Icon);
- IcoLib_ReleaseIcon(Icon);
-
- TreeView_SetImageList(hwndProto, himlCheckBoxes, TVSIL_NORMAL);
- }
-
- FillTree(hwndProto);
- return TRUE;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- if (((LPNMHDR)lParam)->code == PSN_APPLY) {
-
- std::ostringstream out;
-
- TVITEM tvi;
- tvi.hItem = TreeView_GetRoot(hwndProto);
- tvi.mask = TVIF_PARAM | TVIF_HANDLE;
-
- while (tvi.hItem != nullptr) {
- TreeView_GetItem(hwndProto, &tvi);
-
- if (tvi.lParam != 0) {
- ProtocolData* ppd = (ProtocolData*)tvi.lParam;
- if (ppd->enabled && ppd->show)
- out << ppd->RealName << " ";
- }
-
- tvi.hItem = TreeView_GetNextSibling(hwndProto, tvi.hItem);
- }
-
- plSets->DisabledProtoList = out.str();
- }
- break;
-
- case IDC_PROTO:
- switch (((LPNMHDR)lParam)->code) {
- case TVN_DELETEITEM:
- {
- NMTREEVIEWA * pnmtv = (NMTREEVIEWA *)lParam;
- if (pnmtv && pnmtv->itemOld.lParam)
- mir_free((ProtocolData*)pnmtv->itemOld.lParam);
- }
- break;
-
- case NM_CLICK:
- TVHITTESTINFO hti;
- hti.pt.x = (short)LOWORD(GetMessagePos());
- hti.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
- if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) {
- if (hti.flags & TVHT_ONITEMICON) {
- TVITEMA tvi;
- tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- tvi.hItem = hti.hItem;
- TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
-
- ProtocolData *pData = (ProtocolData*)tvi.lParam;
- if (pData->enabled) {
- tvi.iImage = tvi.iSelectedImage = !tvi.iImage;
- pData->show = tvi.iImage;
- TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
- SendMessage(GetParent(hwnd), PSM_CHANGED, (WPARAM)hwnd, 0);
- }
- }
- }
- }
- break;
- }
- break;
- }
- return FALSE;
-}
diff --git a/plugins/StopSpamPlus/src/options.cpp b/plugins/StopSpamPlus/src/options.cpp
index af9f587e4c..78ba677301 100644
--- a/plugins/StopSpamPlus/src/options.cpp
+++ b/plugins/StopSpamPlus/src/options.cpp
@@ -2,113 +2,196 @@
const wchar_t pluginDescription[] = LPGENW("No more spam! Robots can't go! Only human beings invited!\r\n\r\nThis plugin works pretty simple:\r\nWhile messages from users on your contact list go as there is no any anti-spam software, messages from unknown users are not delivered to you. But also they are not ignored, this plugin replies with a simple question, and if user gives the right answer, plugin adds him to your contact list so that he can contact you.");
-char const *answeredSetting = "Answered";
-char const *questCountSetting = "QuestionCount";
+class COptMainDlg : public CDlgBase
+{
+ CCtrlEdit edtCount;
+ CCtrlCheck chk1, chk2, chk3, chk4, chk5, chk6;
+
+public:
+ COptMainDlg() :
+ CDlgBase(hInst, IDD_MAIN),
+ edtCount(this, ID_MAXQUESTCOUNT),
+ chk1(this, ID_INFTALKPROT),
+ chk2(this, ID_ADDPERMANENT),
+ chk3(this, ID_HANDLEAUTHREQ),
+ chk4(this, ID_NOTCASESENS),
+ chk5(this, ID_REMOVE_TMP_ALL),
+ chk6(this, ID_HISTORY_LOG)
+ {}
+
+ virtual void OnInitDialog() override
+ {
+ SetDlgItemText(m_hwnd, ID_DESCRIPTION, TranslateW(pluginDescription));
-INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+ edtCount.SetInt(plSets->MaxQuestCount.Get());
+ chk1.SetState(plSets->InfTalkProtection.Get());
+ chk2.SetState(plSets->AddPermanent.Get());
+ chk3.SetState(plSets->HandleAuthReq.Get());
+ chk4.SetState(plSets->AnswNotCaseSens.Get());
+ chk5.SetState(plSets->RemTmpAll.Get());
+ chk6.SetState(plSets->HistLog.Get());
+ }
+
+ virtual void OnApply() override
+ {
+ plSets->MaxQuestCount = edtCount.GetInt();
+ plSets->InfTalkProtection = chk1.GetState();
+ plSets->AddPermanent = chk2.GetState();
+ plSets->HandleAuthReq = chk3.GetState();
+ plSets->AnswNotCaseSens = chk4.GetState();
+ plSets->RemTmpAll = chk5.GetState();
+ plSets->HistLog = chk6.GetState();
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+class COptMessageDlg : public CDlgBase
{
- switch (msg) {
- case WM_INITDIALOG:
- SetDlgItemText(hwnd, ID_DESCRIPTION, TranslateW(pluginDescription));
- TranslateDialogDefault(hwnd);
- SetDlgItemInt(hwnd, ID_MAXQUESTCOUNT, plSets->MaxQuestCount.Get(), FALSE);
- CheckDlgButton(hwnd, ID_INFTALKPROT, plSets->InfTalkProtection.Get() ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, ID_ADDPERMANENT, plSets->AddPermanent.Get() ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, ID_HANDLEAUTHREQ, plSets->HandleAuthReq.Get() ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, ID_NOTCASESENS, plSets->AnswNotCaseSens.Get() ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, ID_REMOVE_TMP_ALL, plSets->RemTmpAll.Get() ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, ID_HISTORY_LOG, plSets->HistLog.Get() ? BST_CHECKED : BST_UNCHECKED);
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case ID_MAXQUESTCOUNT:
- if (EN_CHANGE != HIWORD(wParam) || (HWND)lParam != GetFocus())
- return FALSE;
- break;
-
- case ID_DESCRIPTION:
- return FALSE;
- }
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- break;
-
- case WM_NOTIFY:
- NMHDR* nmhdr = (NMHDR*)lParam;
- switch (nmhdr->code) {
- case PSN_APPLY:
- plSets->MaxQuestCount = GetDlgItemInt(hwnd, ID_MAXQUESTCOUNT, nullptr, FALSE);
- plSets->InfTalkProtection = (BST_CHECKED == IsDlgButtonChecked(hwnd, ID_INFTALKPROT));
- plSets->AddPermanent = (BST_CHECKED == IsDlgButtonChecked(hwnd, ID_ADDPERMANENT));
- plSets->HandleAuthReq = (BST_CHECKED == IsDlgButtonChecked(hwnd, ID_HANDLEAUTHREQ));
- plSets->AnswNotCaseSens = (BST_CHECKED == IsDlgButtonChecked(hwnd, ID_NOTCASESENS));
- plSets->RemTmpAll = (BST_CHECKED == IsDlgButtonChecked(hwnd, ID_REMOVE_TMP_ALL));
- plSets->HistLog = (BST_CHECKED == IsDlgButtonChecked(hwnd, ID_HISTORY_LOG));
- return TRUE;
- }
- break;
+ CCtrlButton btnHelp, btnRestore;
+ CCtrlEdit edtQuestion, edtAnswer, edtCongrat, edtReply, edtDivider;
+
+public:
+ COptMessageDlg() :
+ CDlgBase(hInst, IDD_MESSAGES),
+ btnHelp(this, IDC_VARS),
+ btnRestore(this, ID_RESTOREDEFAULTS),
+ edtQuestion(this, ID_QUESTION),
+ edtAnswer(this, ID_ANSWER),
+ edtCongrat(this, ID_CONGRATULATION),
+ edtReply(this, ID_AUTHREPL),
+ edtDivider(this, ID_DIVIDER)
+ {
+ btnHelp.OnClick = Callback(this, &COptMessageDlg::onHelp);
+ btnRestore.OnClick = Callback(this, &COptMessageDlg::onRestore);
}
- return FALSE;
-}
-INT_PTR CALLBACK MessagesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+ virtual void OnInitDialog() override
+ {
+ edtQuestion.SetText(plSets->Question.Get().c_str());
+ edtAnswer.SetText(plSets->Answer.Get().c_str());
+ edtCongrat.SetText(plSets->Congratulation.Get().c_str());
+ edtReply.SetText(plSets->AuthRepl.Get().c_str());
+ edtDivider.SetText(plSets->AnswSplitString.Get().c_str());
+ variables_skin_helpbutton(m_hwnd, IDC_VARS);
+ btnHelp.Enable(ServiceExists(MS_VARS_FORMATSTRING));
+ }
+
+ virtual void OnApply() override
+ {
+ plSets->Question = ptrW(edtQuestion.GetText()).get();
+ plSets->Answer = ptrW(edtAnswer.GetText()).get();
+ plSets->AuthRepl = ptrW(edtCongrat.GetText()).get();
+ plSets->Congratulation = ptrW(edtReply.GetText()).get();
+ plSets->AnswSplitString = ptrW(edtDivider.GetText()).get();
+ }
+
+ void onHelp(CCtrlButton*)
+ {
+ variables_showhelp(m_hwnd, WM_COMMAND, VHF_FULLDLG | VHF_SETLASTSUBJECT, nullptr, nullptr);
+ }
+
+ void onRestore(CCtrlButton*)
+ {
+ edtQuestion.SetText(plSets->Question.GetDefault().c_str());
+ edtAnswer.SetText(plSets->Answer.GetDefault().c_str());
+ edtCongrat.SetText(plSets->Congratulation.GetDefault().c_str());
+ edtReply.SetText(plSets->AuthRepl.GetDefault().c_str());
+ edtDivider.SetText(plSets->AnswSplitString.GetDefault().c_str());
+ NotifyChange();
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+class COptAccountDlg : public CDlgBase
{
+ CCtrlListView m_accounts;
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwnd);
- SetDlgItemString(hwnd, ID_QUESTION, plSets->Question.Get());
- SetDlgItemString(hwnd, ID_ANSWER, plSets->Answer.Get());
- SetDlgItemString(hwnd, ID_CONGRATULATION, plSets->Congratulation.Get());
- SetDlgItemString(hwnd, ID_AUTHREPL, plSets->AuthRepl.Get());
- SetDlgItemString(hwnd, ID_DIVIDER, plSets->AnswSplitString.Get());
- variables_skin_helpbutton(hwnd, IDC_VARS);
- ServiceExists(MS_VARS_FORMATSTRING) ? EnableWindow(GetDlgItem(hwnd, IDC_VARS), 1) : EnableWindow(GetDlgItem(hwnd, IDC_VARS), 0);
- return TRUE;
-
- case WM_COMMAND:
- {
- switch (LOWORD(wParam)) {
- case ID_QUESTION:
- case ID_ANSWER:
- case ID_AUTHREPL:
- case ID_CONGRATULATION:
- case ID_DIVIDER:
- if (EN_CHANGE != HIWORD(wParam) || (HWND)lParam != GetFocus())
- return FALSE;
- break;
-
- case ID_RESTOREDEFAULTS:
- SetDlgItemString(hwnd, ID_QUESTION, plSets->Question.GetDefault());
- SetDlgItemString(hwnd, ID_ANSWER, plSets->Answer.GetDefault());
- SetDlgItemString(hwnd, ID_CONGRATULATION, plSets->Congratulation.GetDefault());
- SetDlgItemString(hwnd, ID_AUTHREPL, plSets->AuthRepl.GetDefault());
- SetDlgItemString(hwnd, ID_DIVIDER, plSets->AnswSplitString.GetDefault());
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- return TRUE;
-
- case IDC_VARS:
- variables_showhelp(hwnd, msg, VHF_FULLDLG | VHF_SETLASTSUBJECT, nullptr, nullptr);
- return TRUE;
- }
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+public:
+ COptAccountDlg() :
+ CDlgBase(hInst, IDD_PROTO),
+ m_accounts(this, IDC_PROTO)
+ {
+ m_accounts.OnItemChanged = Callback(this, &COptAccountDlg::list_OnItemChanged);
+ }
+
+ virtual void OnInitDialog() override
+ {
+ m_accounts.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES);
+ m_accounts.DeleteAllItems();
+
+ LVCOLUMN lvc = {};
+ lvc.mask = LVCF_WIDTH;
+ lvc.fmt = LVCFMT_IMAGE | LVCFMT_LEFT;
+ lvc.cx = 250;
+ m_accounts.InsertColumn(0, &lvc);
+
+ LVITEM item = { 0 };
+ item.mask = LVIF_TEXT | LVIF_PARAM;
+ item.iItem = 1000;
+
+ int n;
+ PROTOACCOUNT **pa;
+ Proto_EnumAccounts(&n, &pa);
+
+ for (int i = 0; i < n; i++) {
+ PROTOACCOUNT *p = pa[i];
+ if (!Proto_IsAccountEnabled(p) || p->bIsVirtual)
+ continue;
+
+ item.lParam = (LPARAM)p->szModuleName;
+ item.pszText = p->tszAccountName;
+ int idx = m_accounts.InsertItem(&item);
+ m_accounts.SetCheckState(idx, !plSets->ProtoDisabled(p->szModuleName));
}
- break;
-
- case WM_NOTIFY:
- NMHDR* nmhdr = (NMHDR*)lParam;
- switch (nmhdr->code) {
- case PSN_APPLY:
- {
- plSets->Question = GetDlgItemString(hwnd, ID_QUESTION);
- plSets->Answer = GetDlgItemString(hwnd, ID_ANSWER);
- plSets->AuthRepl = GetDlgItemString(hwnd, ID_AUTHREPL);
- plSets->Congratulation = GetDlgItemString(hwnd, ID_CONGRATULATION);
- plSets->AnswSplitString = GetDlgItemString(hwnd, ID_DIVIDER);
- }
- return TRUE;
+ }
+
+ virtual void OnApply() override
+ {
+ std::ostringstream out;
+
+ LVITEM item;
+ item.mask = LVIF_PARAM;
+
+ for (int i = 0; i < m_accounts.GetItemCount(); i++) {
+ item.iItem = i;
+ if (!m_accounts.GetItem(&item))
+ continue;
+
+ if (m_accounts.GetCheckState(i) != 0)
+ out << (char*)item.lParam << " ";
}
- break;
+
+ plSets->DisabledProtoList = out.str();
}
- return FALSE;
+
+ void list_OnItemChanged(CCtrlListView::TEventInfo*)
+ {
+ if (m_initialized)
+ NotifyChange();
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// options initializer
+
+int OnOptInit(WPARAM w, LPARAM)
+{
+ OPTIONSDIALOGPAGE odp = { 0 };
+ odp.szGroup.a = LPGEN("Message sessions");
+ odp.szTitle.a = pluginName;
+
+ odp.szTab.a = LPGEN("General");
+ odp.pDialog = new COptMainDlg();
+ Options_AddPage(w, &odp);
+
+ odp.szTab.a = LPGEN("Messages");
+ odp.pDialog = new COptMessageDlg();
+ Options_AddPage(w, &odp);
+
+ odp.szTab.a = LPGEN("Accounts");
+ odp.pDialog = new COptAccountDlg();
+ Options_AddPage(w, &odp);
+ return 0;
}
diff --git a/plugins/StopSpamPlus/src/stdafx.h b/plugins/StopSpamPlus/src/stdafx.h
index 4b25fba17b..c1a8802b21 100644
--- a/plugins/StopSpamPlus/src/stdafx.h
+++ b/plugins/StopSpamPlus/src/stdafx.h
@@ -17,11 +17,11 @@
#include <m_icolib.h>
#include <m_skin.h>
#include <m_clist.h>
+#include <m_gui.h>
#include <m_stopspam.h>
#include <m_variables.h>
-
typedef std::wstring tstring;
#define PREF_TCHAR2 PREF_UTF
@@ -32,16 +32,10 @@ typedef std::wstring tstring;
#define pluginName LPGEN("StopSpam")
extern char const *answeredSetting;
-extern char const *questCountSetting;
-extern HINSTANCE hInst;
-//options
-INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK MessagesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK ProtoDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+extern HINSTANCE hInst;
-//utils
-void SetDlgItemString(HWND hwndDlg, UINT idItem, std::wstring const &str);
+// utils
tstring &GetDlgItemString(HWND hwnd, int id);
bool IsExistMyMessage(MCONTACT hContact);
tstring variables_parse(tstring const &tstrFormat, MCONTACT hContact);
diff --git a/plugins/StopSpamPlus/src/utils.cpp b/plugins/StopSpamPlus/src/utils.cpp
index b542d91469..f2aea2b380 100644
--- a/plugins/StopSpamPlus/src/utils.cpp
+++ b/plugins/StopSpamPlus/src/utils.cpp
@@ -31,11 +31,6 @@ bool IsExistMyMessage(MCONTACT hContact)
return false;
}
-void SetDlgItemString(HWND hwndDlg, UINT idItem, std::wstring const &str)
-{
- SetDlgItemTextW(hwndDlg, idItem, str.c_str());
-}
-
tstring variables_parse(tstring const &tstrFormat, MCONTACT hContact)
{
if (ServiceExists(MS_VARS_FORMATSTRING)) {