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/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 +- 6 files changed, 25 insertions(+), 55 deletions(-) (limited to 'plugins/StopSpamMod/src') 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