From 9dbe78ee5c1ee95454d411aabb9ba87bad77fefe Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 23 Apr 2023 16:34:11 +0300 Subject: =?UTF-8?q?fixes=20#3499=20(StopSpamMod:=20=D1=83=D0=B4=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=D1=82=D1=8C=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=B9=D0=BA=D1=83=20"=D1=83=D0=B4=D0=B0=D0=BB=D1=8F=D1=82?= =?UTF-8?q?=D1=8C=20=D0=B2=D1=81=D0=B5=20=D0=B2=D1=80=D0=B5=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=BD=D1=8B=D0=B5=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B0=D0=BA?= =?UTF-8?q?=D1=82=D1=8B=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D0=B7=D0=B0=D0=BF=D1=83=D1=81=D0=BA=D0=B0")?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/StopSpamMod/res/stopspam.rc | 45 +++++++++++++++++++++-------------- plugins/StopSpamMod/src/init.cpp | 4 +--- plugins/StopSpamMod/src/options.cpp | 30 ++++++++++++++--------- plugins/StopSpamMod/src/resource.h | 5 ++-- plugins/StopSpamMod/src/stopspam.h | 1 - plugins/StopSpamMod/src/utilities.cpp | 38 ++--------------------------- plugins/StopSpamMod/src/version.h | 2 +- 7 files changed, 52 insertions(+), 73 deletions(-) (limited to 'plugins/StopSpamMod') diff --git a/plugins/StopSpamMod/res/stopspam.rc b/plugins/StopSpamMod/res/stopspam.rc index 950de7995c..37c856e0a2 100644 --- a/plugins/StopSpamMod/res/stopspam.rc +++ b/plugins/StopSpamMod/res/stopspam.rc @@ -13,7 +13,7 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// Русский (Россия) resources +// Russian (Russia) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT @@ -73,14 +73,14 @@ BEGIN CONTROL "Log spam to file",ID_LOGSPAMTOFILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,162,290,10 END -IDD_ADVANCED DIALOGEX 0, 0, 309, 219 +IDD_ADVANCED DIALOGEX 0, 0, 309, 191 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_SYSMENU FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN CONTROL "Case insensitive answer checking",IDC_CASE_INSENSITIVE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,66,279,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,55,279,10 CONTROL "Disable question in invisible mode",IDC_INVIS_DISABLE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,77,287,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,66,287,10 CONTROL "Exclude contacts which we sending something from spam check",ID_EXCLUDE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,33,287,8 CONTROL "Remove Excluded contacts after restart",ID_REMOVE_TMP, @@ -89,20 +89,18 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,16,196,10 EDITTEXT ID_SPECIALGROUPNAME,217,15,79,12,ES_AUTOHSCROLL CONTROL "Ignore URL in messages and auth requests",ID_IGNOREURL, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,100,287,10 - CONTROL "Add contact to server list",IDC_ADDTOSRVLST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,146,187,10 - EDITTEXT IDC_AUTOADDGROUP,210,144,76,14,ES_AUTOHSCROLL - GROUPBOX "After congratulation (ICQ only)",IDC_STATIC,15,135,278,51 - CONTROL "Automatically grant authorization",IDC_AUTOAUTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,158,263,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,77,287,10 + CONTROL "Add contact to server list",IDC_ADDTOSRVLST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,124,187,10 + EDITTEXT IDC_AUTOADDGROUP,210,122,76,14,ES_AUTOHSCROLL + GROUPBOX "After congratulation (ICQ only)",IDC_STATIC,15,113,278,51 + CONTROL "Automatically grant authorization",IDC_AUTOAUTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,136,263,10 CONTROL "Request authorization from contacts which pass StopSpam test",IDC_REQAUTH, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,170,267,10 - CONTROL "Remove all temporary contacts after restart",ID_REMOVE_TMP_ALL, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,55,287,8 - CONTROL "Use regex for answers checking",IDC_REGEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,111,287,10 - CONTROL "Log Spammers to system history",IDC_HISTORY_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,121,218,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,148,267,10 + CONTROL "Use regex for answers checking",IDC_REGEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,88,287,10 + CONTROL "Log Spammers to system history",IDC_HISTORY_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,99,218,10 CONTROL "Use math expression in question",IDC_MATH_QUESTION, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,188,129,10 - PUSHBUTTON "Details...",IDC_MATH_DETAILS,152,187,50,14 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,169,129,10 + PUSHBUTTON "Details...",IDC_MATH_DETAILS,152,168,50,14 END @@ -143,7 +141,7 @@ BEGIN RIGHTMARGIN, 302 VERTGUIDE, 15 TOPMARGIN, 7 - BOTTOMMARGIN, 212 + BOTTOMMARGIN, 182 HORZGUIDE, 11 END END @@ -175,7 +173,18 @@ END #endif // APSTUDIO_INVOKED -#endif // Русский (Россия) resources + +///////////////////////////////////////////////////////////////////////////// +// +// AFX_DIALOG_LAYOUT +// + +IDD_ADVANCED AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +#endif // Russian (Russia) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/plugins/StopSpamMod/src/init.cpp b/plugins/StopSpamMod/src/init.cpp index 45323d770b..c989aae78f 100644 --- a/plugins/StopSpamMod/src/init.cpp +++ b/plugins/StopSpamMod/src/init.cpp @@ -33,7 +33,6 @@ BOOL gbHideContacts = 1; BOOL gbIgnoreContacts = 0; BOOL gbExclude = 1; BOOL gbDelExcluded = 0; -BOOL gbDelAllTempory = 0; BOOL gbHistoryLog = 0; BOOL gbCaseInsensitive = 0; BOOL gbRegexMatch = 0; @@ -98,7 +97,6 @@ void InitVars() gbIgnoreContacts = g_plugin.getByte("IgnoreContacts", 0); gbExclude = g_plugin.getByte("ExcludeContacts", 1); gbDelExcluded = g_plugin.getByte("DelExcluded", 0); - gbDelAllTempory = g_plugin.getByte("DelAllTempory", 0); gbCaseInsensitive = g_plugin.getByte("CaseInsensitive", 0); gbRegexMatch = g_plugin.getByte("RegexMatch", 0); gbInvisDisable = g_plugin.getByte("DisableInInvis", 0); @@ -118,7 +116,7 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) gbVarsServiceExist = TRUE; InitVars(); - if(gbDelAllTempory || gbDelExcluded) + if(gbDelExcluded) mir_forkthread(&CleanThread); // Folders plugin support diff --git a/plugins/StopSpamMod/src/options.cpp b/plugins/StopSpamMod/src/options.cpp index b7f8fc1274..c610a4aa24 100644 --- a/plugins/StopSpamMod/src/options.cpp +++ b/plugins/StopSpamMod/src/options.cpp @@ -198,12 +198,27 @@ private: class COptAdvancedDlg : public CDlgBase { + CCtrlEdit edit_SPECIALGROUPNAME, edit_AUTOADDGROUP; + CCtrlCheck chk_INVIS_DISABLE, chk_CASE_INSENSITIVE, chk_SPECIALGROUP, chk_EXCLUDE, chk_REMOVE_TMP; + CCtrlCheck chk_IGNOREURL, chk_AUTOAUTH, chk_ADDTOSRVLST, chk_REQAUTH, chk_REGEX, chk_HISTORY_LOG, chk_MATH_QUESTION; + CCtrlButton btn_MATH_DETAILS; + public: COptAdvancedDlg() : CDlgBase(g_plugin, IDD_ADVANCED), - chk_INVIS_DISABLE(this, IDC_INVIS_DISABLE), chk_CASE_INSENSITIVE(this, IDC_CASE_INSENSITIVE), chk_SPECIALGROUP(this, ID_SPECIALGROUP), chk_EXCLUDE(this, ID_EXCLUDE), - chk_REMOVE_TMP(this, ID_REMOVE_TMP), chk_REMOVE_TMP_ALL(this, ID_REMOVE_TMP_ALL), chk_IGNOREURL(this, ID_IGNOREURL), chk_AUTOAUTH(this, IDC_AUTOAUTH), chk_ADDTOSRVLST(this, IDC_ADDTOSRVLST), - chk_REQAUTH(this, IDC_REQAUTH), chk_REGEX(this, IDC_REGEX), chk_HISTORY_LOG(this, IDC_HISTORY_LOG), chk_MATH_QUESTION(this, IDC_MATH_QUESTION), - edit_SPECIALGROUPNAME(this, ID_SPECIALGROUPNAME), edit_AUTOADDGROUP(this, IDC_AUTOADDGROUP), + chk_INVIS_DISABLE(this, IDC_INVIS_DISABLE), + chk_CASE_INSENSITIVE(this, IDC_CASE_INSENSITIVE), + chk_SPECIALGROUP(this, ID_SPECIALGROUP), + chk_EXCLUDE(this, ID_EXCLUDE), + chk_REMOVE_TMP(this, ID_REMOVE_TMP), + chk_IGNOREURL(this, ID_IGNOREURL), + chk_AUTOAUTH(this, IDC_AUTOAUTH), + chk_ADDTOSRVLST(this, IDC_ADDTOSRVLST), + chk_REQAUTH(this, IDC_REQAUTH), + chk_REGEX(this, IDC_REGEX), + chk_HISTORY_LOG(this, IDC_HISTORY_LOG), + chk_MATH_QUESTION(this, IDC_MATH_QUESTION), + edit_SPECIALGROUPNAME(this, ID_SPECIALGROUPNAME), + edit_AUTOADDGROUP(this, IDC_AUTOADDGROUP), btn_MATH_DETAILS(this, IDC_MATH_DETAILS) { btn_MATH_DETAILS.OnClick = Callback(this, &COptAdvancedDlg::onClick_MATH_DETAILS); @@ -216,7 +231,6 @@ public: chk_SPECIALGROUP.SetState(gbSpecialGroup); chk_EXCLUDE.SetState(gbExclude); chk_REMOVE_TMP.SetState(gbDelExcluded); - chk_REMOVE_TMP_ALL.SetState(gbDelAllTempory); chk_IGNOREURL.SetState(gbIgnoreURL); chk_AUTOAUTH.SetState(gbAutoAuth); chk_ADDTOSRVLST.SetState(gbAutoAddToServerList); @@ -246,7 +260,6 @@ public: g_plugin.setByte("SpecialGroup", gbSpecialGroup = chk_SPECIALGROUP.GetState()); g_plugin.setByte("ExcludeContacts", gbExclude = chk_EXCLUDE.GetState()); g_plugin.setByte("DelExcluded", gbDelExcluded = chk_REMOVE_TMP.GetState()); - g_plugin.setByte("DelAllTempory", gbDelAllTempory = chk_REMOVE_TMP_ALL.GetState()); g_plugin.setByte("IgnoreURL", gbIgnoreURL = chk_IGNOREURL.GetState()); g_plugin.setByte("AutoAuth", gbAutoAuth = chk_AUTOAUTH.GetState()); @@ -273,11 +286,6 @@ public: { MessageBox(m_hwnd, TranslateT("If math expression is turned on, you can use following expression in message text:\nXX+XX-X/X*X\neach X will be replaced by one random number and answer will be expression result.\nMessage must contain only one expression without spaces."), TranslateT("Info"), MB_OK); } - -private: - CCtrlCheck chk_INVIS_DISABLE, chk_CASE_INSENSITIVE, chk_SPECIALGROUP, chk_EXCLUDE, chk_REMOVE_TMP, chk_REMOVE_TMP_ALL, chk_IGNOREURL, chk_AUTOAUTH, chk_ADDTOSRVLST, chk_REQAUTH, chk_REGEX, chk_HISTORY_LOG, chk_MATH_QUESTION; - CCtrlEdit edit_SPECIALGROUPNAME, edit_AUTOADDGROUP; - CCtrlButton btn_MATH_DETAILS; }; int OnOptInit(WPARAM w, LPARAM l) diff --git a/plugins/StopSpamMod/src/resource.h b/plugins/StopSpamMod/src/resource.h index cf08fba600..1b375d16eb 100644 --- a/plugins/StopSpamMod/src/resource.h +++ b/plugins/StopSpamMod/src/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by stopspam.rc +// Used by W:\miranda-ng\plugins\StopSpamMod\res\stopspam.rc // #define IDD_MESSAGES 101 #define IDD_MAIN 103 @@ -46,7 +46,6 @@ #define IDC_AUTOAUTH 1025 #define IDC_REQAUTH 1026 #define IDC_LOGSPAMTOFILE 1027 -#define ID_REMOVE_TMP_ALL 1027 #define ID_LOGSPAMTOFILE 1027 #define IDC_REGEX 1028 #define IDC_CHECK1 1029 @@ -59,7 +58,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 104 +#define _APS_NEXT_RESOURCE_VALUE 105 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1032 #define _APS_NEXT_SYMED_VALUE 101 diff --git a/plugins/StopSpamMod/src/stopspam.h b/plugins/StopSpamMod/src/stopspam.h index 6285433209..7861eeda13 100644 --- a/plugins/StopSpamMod/src/stopspam.h +++ b/plugins/StopSpamMod/src/stopspam.h @@ -28,4 +28,3 @@ extern BOOL gbAutoAddToServerList; extern BOOL gbAutoReqAuth; extern wstring gbAutoAuthGroup; extern BOOL gbLogToFile; -extern BOOL gbDelAllTempory; diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index 7545d87ef7..b2f72ccc48 100644 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -236,36 +236,6 @@ void LogSpamToFile(MCONTACT hContact, wstring message) mir_cs clean_mutex; -void __cdecl CleanProtocolTmpThread(void *param) -{ - const char *szProto = (const char*)param; - - while (true) { - int status = Proto_GetStatus(szProto); - if (status > ID_STATUS_OFFLINE) - break; - Sleep(2000); - } - - std::list contacts; - for (auto &hContact : Contacts(szProto)) - if (!Contact::OnList(hContact) || (L"Not In List" == DBGetContactSettingStringPAN(hContact, "CList", "Group", L""))) - contacts.push_back(hContact); - - Sleep(5000); - { - mir_cslock lck(clean_mutex); - - std::list::iterator end = contacts.end(); - for (std::list::iterator i = contacts.begin(); i != end; ++i) { - LogSpamToFile(*i, L"Deleted"); - HistoryLogFunc(*i, "Deleted"); - db_delete_contact(*i); - } - } - mir_free(param); -} - void __cdecl CleanProtocolExclThread(void *param) { const char *szProto = (const char*)param; @@ -303,12 +273,8 @@ void __cdecl CleanThread(void*) protocols.push_back(pa->szModuleName); std::list::iterator end = protocols.end(); - for (std::list::iterator i = protocols.begin(); i != end; ++i) { - if (gbDelAllTempory) - mir_forkthread(CleanProtocolTmpThread, mir_strdup((*i).c_str())); - if (gbDelExcluded) - mir_forkthread(CleanProtocolExclThread, mir_strdup((*i).c_str())); - } + for (std::list::iterator i = protocols.begin(); i != end; ++i) + mir_forkthread(CleanProtocolExclThread, mir_strdup((*i).c_str())); } void HistoryLog(MCONTACT hContact, char *data, int event_type, int flags) diff --git a/plugins/StopSpamMod/src/version.h b/plugins/StopSpamMod/src/version.h index c2551e9567..ea6b75f7b9 100644 --- a/plugins/StopSpamMod/src/version.h +++ b/plugins/StopSpamMod/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 0 #define __RELEASE_NUM 2 -#define __BUILD_NUM 3 +#define __BUILD_NUM 4 #include -- cgit v1.2.3