diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2009-10-01 05:18:46 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2009-10-01 05:18:46 +0300 |
commit | 298b3e189486938208a4bf7d15d3aa1b841ef652 (patch) | |
tree | 1b8c4873613b181647c29b7efa8002b0c6975c6c /stopspam_mod/trunk/options.cpp | |
parent | 5f68bd0ddfd9578e00d0dba2b64c6db1f405bbc8 (diff) |
+ option to case insensitive answer checking
+ option to disable question in invisible mode
small options dialog redesign
Diffstat (limited to 'stopspam_mod/trunk/options.cpp')
-rw-r--r-- | stopspam_mod/trunk/options.cpp | 151 |
1 files changed, 99 insertions, 52 deletions
diff --git a/stopspam_mod/trunk/options.cpp b/stopspam_mod/trunk/options.cpp index d3db9b2..89bf80b 100644 --- a/stopspam_mod/trunk/options.cpp +++ b/stopspam_mod/trunk/options.cpp @@ -26,15 +26,8 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SendDlgItemMessage(hwnd, ID_INFTALKPROT, BM_SETCHECK, gbInfTalkProtection ? BST_CHECKED : BST_UNCHECKED, 0);
SendDlgItemMessage(hwnd, ID_ADDPERMANENT, BM_SETCHECK, gbAddPermanent ? BST_CHECKED : BST_UNCHECKED, 0);
SendDlgItemMessage(hwnd, ID_HANDLEAUTHREQ, BM_SETCHECK, gbHandleAuthReq ? BST_CHECKED : BST_UNCHECKED, 0);
- gbDosServiceExist?EnableWindow(GetDlgItem(hwnd, ID_DOS_INTEGRATION),1):EnableWindow(GetDlgItem(hwnd, ID_DOS_INTEGRATION),0);
- SendDlgItemMessage(hwnd, ID_DOS_INTEGRATION, BM_SETCHECK, gbDosServiceIntegration ? BST_CHECKED : BST_UNCHECKED, 0);
- SetDlgItemText(hwnd, ID_SPECIALGROUPNAME, gbSpammersGroup.c_str());
- SendDlgItemMessage(hwnd, ID_SPECIALGROUP, BM_SETCHECK, gbSpecialGroup ? BST_CHECKED : BST_UNCHECKED, 0);
SendDlgItemMessage(hwnd, ID_HIDECONTACTS, BM_SETCHECK, gbHideContacts ? BST_CHECKED : BST_UNCHECKED, 0);
SendDlgItemMessage(hwnd, ID_IGNORESPAMMERS, BM_SETCHECK, gbIgnoreContacts ? BST_CHECKED : BST_UNCHECKED, 0);
- SendDlgItemMessage(hwnd, ID_EXCLUDE, BM_SETCHECK, gbExclude ? BST_CHECKED : BST_UNCHECKED, 0);
- SendDlgItemMessage(hwnd, ID_REMOVE_TMP, BM_SETCHECK, gbDelExcluded ? BST_CHECKED : BST_UNCHECKED, 0);
-// SendDlgItemMessage(hwnd, ID_DEL_NO_IN_LIST, BM_SETCHECK, gbDelNotInList ? BST_CHECKED : BST_UNCHECKED, 0);
}
return TRUE;
case WM_COMMAND:{
@@ -65,55 +58,10 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) BST_CHECKED == SendDlgItemMessage(hwnd, ID_ADDPERMANENT, BM_GETCHECK, 0, 0));
DBWriteContactSettingByte(NULL, pluginName, "handleAuthReq", gbHandleAuthReq =
BST_CHECKED == SendDlgItemMessage(hwnd, ID_HANDLEAUTHREQ, BM_GETCHECK, 0, 0));
- DBWriteContactSettingByte(NULL, pluginName, "DOSIntegration", gbDosServiceIntegration =
- BST_CHECKED == SendDlgItemMessage(hwnd, ID_DOS_INTEGRATION, BM_GETCHECK, 0, 0));
-/* DBWriteContactSettingByte(NULL, pluginName, "DelNotInList", gbDelNotInList =
- BST_CHECKED == SendDlgItemMessage(hwnd, ID_DEL_NO_IN_LIST, BM_GETCHECK, 0, 0)); */
- {
- static tstring NewGroupName, CurrentGroupName;
- NewGroupName = GetDlgItemString(hwnd, ID_SPECIALGROUPNAME);
- CurrentGroupName = gbSpammersGroup = DBGetContactSettingStringPAN(NULL, pluginName, "SpammersGroup", _T("0"));
- if(wcscmp(CurrentGroupName.c_str(), NewGroupName.c_str()) != 0)
- {
- int GroupNumber = 0;
- BYTE GroupExist = 0;
- TCHAR szValue[96] = {0};
- char szNumber[32] = {0};
- extern int CreateCListGroup(TCHAR* szGroupName);
- strcpy(szNumber, "0");
- while(strcmp(DBGetContactSettingStringPAN_A(NULL, "CListGroups", szNumber, "0").c_str(), "0") != 0)
- {
-#if defined(_MSC_VER) && _MSC_VER >= 1300
- _itoa_s(GroupNumber, szNumber, sizeof(szNumber), 10);
-#else
- _itoa(GroupNumber, szNumber, 10);
-
-#endif
- wcscpy(szValue, DBGetContactSettingStringPAN(NULL, "CListGroups", szNumber, _T("0")).c_str());
- if(wcscmp(NewGroupName.c_str(), szValue + 1) == 0)
- {
- GroupExist = 1;
- break;
- }
- GroupNumber++;
- }
- DBWriteContactSettingTString(NULL,pluginName, "SpammersGroup", NewGroupName.c_str());
- gbSpammersGroup = DBGetContactSettingStringPAN(NULL,pluginName,"SpammersGroup", _T("Spammers"));
- if(!GroupExist && gbSpecialGroup)
- CreateCListGroup((TCHAR*)gbSpammersGroup.c_str());
- }
- }
- DBWriteContactSettingByte(NULL, pluginName, "SpecialGroup", gbSpecialGroup =
- BST_CHECKED == SendDlgItemMessage(hwnd, ID_SPECIALGROUP, BM_GETCHECK, 0, 0));
DBWriteContactSettingByte(NULL, pluginName, "HideContacts", gbHideContacts =
BST_CHECKED == SendDlgItemMessage(hwnd, ID_HIDECONTACTS, BM_GETCHECK, 0, 0));
DBWriteContactSettingByte(NULL, pluginName, "IgnoreContacts", gbIgnoreContacts =
BST_CHECKED == SendDlgItemMessage(hwnd, ID_IGNORESPAMMERS, BM_GETCHECK, 0, 0));
- DBWriteContactSettingByte(NULL, pluginName, "ExcludeContacts", gbExclude =
- BST_CHECKED == SendDlgItemMessage(hwnd, ID_EXCLUDE, BM_GETCHECK, 0, 0));
- DBWriteContactSettingByte(NULL, pluginName, "DelExcluded", gbDelExcluded =
- BST_CHECKED == SendDlgItemMessage(hwnd, ID_REMOVE_TMP, BM_GETCHECK, 0, 0));
-
}
return TRUE;
}
@@ -131,6 +79,7 @@ INT_PTR CALLBACK MessagesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_INITDIALOG:
{
TranslateDialogDefault(hwnd);
+ gbVarsServiceExist?EnableWindow(GetDlgItem(hwnd, IDC_VARS),1):EnableWindow(GetDlgItem(hwnd, IDC_VARS),0);
SetDlgItemText(hwnd, ID_QUESTION, gbQuestion.c_str());
SetDlgItemText(hwnd, ID_ANSWER, gbAnswer.c_str());
SetDlgItemText(hwnd, ID_CONGRATULATION, gbCongratulation.c_str());
@@ -302,6 +251,98 @@ INT_PTR CALLBACK ProtoDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return FALSE;
}
+INT_PTR CALLBACK AdvancedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+
+ switch(msg)
+ {
+ case WM_INITDIALOG:
+ {
+ TranslateDialogDefault(hwnd);
+ SendDlgItemMessage(hwnd, IDC_INVIS_DISABLE, BM_SETCHECK, gbInvisDisable ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendDlgItemMessage(hwnd, IDC_CASE_INSENSITIVE, BM_SETCHECK, gbCaseInsensitive ? BST_CHECKED : BST_UNCHECKED, 0);
+ gbDosServiceExist?EnableWindow(GetDlgItem(hwnd, ID_DOS_INTEGRATION),1):EnableWindow(GetDlgItem(hwnd, ID_DOS_INTEGRATION),0);
+ SendDlgItemMessage(hwnd, ID_DOS_INTEGRATION, BM_SETCHECK, gbDosServiceIntegration ? BST_CHECKED : BST_UNCHECKED, 0);
+ SetDlgItemText(hwnd, ID_SPECIALGROUPNAME, gbSpammersGroup.c_str());
+ SendDlgItemMessage(hwnd, ID_SPECIALGROUP, BM_SETCHECK, gbSpecialGroup ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendDlgItemMessage(hwnd, ID_EXCLUDE, BM_SETCHECK, gbExclude ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendDlgItemMessage(hwnd, ID_REMOVE_TMP, BM_SETCHECK, gbDelExcluded ? BST_CHECKED : BST_UNCHECKED, 0);
+ }
+ return TRUE;
+ case WM_COMMAND:{
+ switch (LOWORD(wParam))
+ {
+ case IDC_INVIS_DISABLE: case IDC_CASE_INSENSITIVE: case ID_DOS_INTEGRATION:
+ case ID_SPECIALGROUPNAME: case ID_SPECIALGROUP: case ID_EXCLUDE: case ID_REMOVE_TMP:
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ break;
+
+ }
+ }
+ break;
+ case WM_NOTIFY:
+ {
+ NMHDR* nmhdr = (NMHDR*)lParam;
+ switch (nmhdr->code)
+ {
+ case PSN_APPLY:
+ {
+ DBWriteContactSettingByte(NULL, pluginName, "CaseInsensitive", gbCaseInsensitive =
+ BST_CHECKED == SendDlgItemMessage(hwnd, IDC_CASE_INSENSITIVE, BM_GETCHECK, 0, 0));
+ DBWriteContactSettingByte(NULL, pluginName, "DisableInInvis", gbInvisDisable =
+ BST_CHECKED == SendDlgItemMessage(hwnd, IDC_INVIS_DISABLE, BM_GETCHECK, 0, 0));
+ DBWriteContactSettingByte(NULL, pluginName, "DOSIntegration", gbDosServiceIntegration =
+ BST_CHECKED == SendDlgItemMessage(hwnd, ID_DOS_INTEGRATION, BM_GETCHECK, 0, 0));
+ {
+ static tstring NewGroupName, CurrentGroupName;
+ NewGroupName = GetDlgItemString(hwnd, ID_SPECIALGROUPNAME);
+ CurrentGroupName = gbSpammersGroup = DBGetContactSettingStringPAN(NULL, pluginName, "SpammersGroup", _T("0"));
+ if(wcscmp(CurrentGroupName.c_str(), NewGroupName.c_str()) != 0)
+ {
+ int GroupNumber = 0;
+ BYTE GroupExist = 0;
+ TCHAR szValue[96] = {0};
+ char szNumber[32] = {0};
+ extern int CreateCListGroup(TCHAR* szGroupName);
+ strcpy(szNumber, "0");
+ while(strcmp(DBGetContactSettingStringPAN_A(NULL, "CListGroups", szNumber, "0").c_str(), "0") != 0)
+ {
+#if defined(_MSC_VER) && _MSC_VER >= 1300
+ _itoa_s(GroupNumber, szNumber, sizeof(szNumber), 10);
+#else
+ _itoa(GroupNumber, szNumber, 10);
+
+#endif
+ wcscpy(szValue, DBGetContactSettingStringPAN(NULL, "CListGroups", szNumber, _T("0")).c_str());
+ if(wcscmp(NewGroupName.c_str(), szValue + 1) == 0)
+ {
+ GroupExist = 1;
+ break;
+ }
+ GroupNumber++;
+ }
+ DBWriteContactSettingTString(NULL,pluginName, "SpammersGroup", NewGroupName.c_str());
+ gbSpammersGroup = DBGetContactSettingStringPAN(NULL,pluginName,"SpammersGroup", _T("Spammers"));
+ if(!GroupExist && gbSpecialGroup)
+ CreateCListGroup((TCHAR*)gbSpammersGroup.c_str());
+ }
+ }
+ DBWriteContactSettingByte(NULL, pluginName, "SpecialGroup", gbSpecialGroup =
+ BST_CHECKED == SendDlgItemMessage(hwnd, ID_SPECIALGROUP, BM_GETCHECK, 0, 0));
+ DBWriteContactSettingByte(NULL, pluginName, "ExcludeContacts", gbExclude =
+ BST_CHECKED == SendDlgItemMessage(hwnd, ID_EXCLUDE, BM_GETCHECK, 0, 0));
+ DBWriteContactSettingByte(NULL, pluginName, "DelExcluded", gbDelExcluded =
+ BST_CHECKED == SendDlgItemMessage(hwnd, ID_REMOVE_TMP, BM_GETCHECK, 0, 0));
+ }
+ return TRUE;
+ }
+ }
+ break;
+ }
+ return FALSE;
+}
+
+
HINSTANCE hInst;
MIRANDA_HOOK_EVENT(ME_OPT_INITIALISE, w, l)
{
@@ -329,6 +370,12 @@ MIRANDA_HOOK_EVENT(ME_OPT_INITIALISE, w, l) odp.pfnDlgProc = ProtoDlgProc;
CallService(MS_OPT_ADDPAGE, w, (LPARAM)&odp);
+ odp.ptszTab = _T("Advanced");
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_ADVANCED);
+ odp.pfnDlgProc = AdvancedDlgProc;
+ odp.flags = odp.flags|ODPF_EXPERTONLY;
+ CallService(MS_OPT_ADDPAGE, w, (LPARAM)&odp);
+
return 0;
}
|