From 2aa59179945482dee30935c991f9317dfbf31946 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 17 May 2018 18:23:34 +0300 Subject: Tipper, StopSpamMod, StopSpam, StatusManager, StatusChange, StartupSilence, StartPosition, SplashScreen, SpellChecker, Spamotron => CMPlugin --- plugins/StopSpamMod/src/init.cpp | 26 +++++++++++--------------- plugins/StopSpamMod/src/options.cpp | 8 ++++---- plugins/StopSpamMod/src/stdafx.h | 9 +++++++-- 3 files changed, 22 insertions(+), 21 deletions(-) (limited to 'plugins/StopSpamMod/src') diff --git a/plugins/StopSpamMod/src/init.cpp b/plugins/StopSpamMod/src/init.cpp index 93f2ce40f1..58b8a765b6 100755 --- a/plugins/StopSpamMod/src/init.cpp +++ b/plugins/StopSpamMod/src/init.cpp @@ -17,7 +17,10 @@ #include "stdafx.h" -HINSTANCE hInst; +CMPlugin g_plugin; +int hLangpack = 0; + +HANDLE hEventFilter = nullptr, hOptInitialise = nullptr, hSettingChanged = nullptr; BOOL gbDosServiceExist = 0; BOOL gbVarsServiceExist = 0; @@ -43,7 +46,7 @@ BOOL gbAutoAddToServerList=0; BOOL gbAutoReqAuth=1; BOOL gbMathExpression = 0; -HANDLE hStopSpamLogDirH=nullptr; +HANDLE hStopSpamLogDirH = nullptr; wstring gbSpammersGroup = L"Spammers"; wstring gbAutoAuthGroup = L"NotSpammers"; @@ -76,6 +79,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) return &pluginInfoEx; } +///////////////////////////////////////////////////////////////////////////////////////// + extern wstring DBGetContactSettingStringPAN(MCONTACT hContact, char const * szModule, char const * szSetting, wstring errorValue); void InitVars() @@ -107,15 +112,13 @@ void InitVars() gbLogToFile = db_get_b(NULL, pluginName, "LogSpamToFile", 0); gbHistoryLog = db_get_b(NULL, pluginName, "HistoryLog", 0); gbMathExpression = db_get_b(NULL, pluginName, "MathExpression", 0); - } static int OnSystemModulesLoaded(WPARAM, LPARAM) { -/* if (ServiceExists(MS_DOS_SERVICE)) - gbDosServiceExist = TRUE; */ if (ServiceExists(MS_VARS_FORMATSTRING)) gbVarsServiceExist = TRUE; + InitVars(); if(gbDelAllTempory || gbDelExcluded) mir_forkthread(&CleanThread); @@ -125,16 +128,7 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) return 0; } -HANDLE hEventFilter = nullptr, hOptInitialise = nullptr, hSettingChanged = nullptr; - - -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) -{ - hInst = hinstDLL; - return TRUE; -} - -int hLangpack = 0; +///////////////////////////////////////////////////////////////////////////////////////// extern "C" int __declspec(dllexport) Load() { @@ -158,6 +152,8 @@ extern "C" int __declspec(dllexport) Load() return 0; } +///////////////////////////////////////////////////////////////////////////////////////// + extern "C" int __declspec(dllexport) Unload(void) { return 0; diff --git a/plugins/StopSpamMod/src/options.cpp b/plugins/StopSpamMod/src/options.cpp index 7d7e6f5770..be0a7421e6 100755 --- a/plugins/StopSpamMod/src/options.cpp +++ b/plugins/StopSpamMod/src/options.cpp @@ -26,7 +26,7 @@ const wchar_t *defAuthReply = LPGENW("StopSpam: send a message and reply to an a class COptMainDlg : public CDlgBase { public: - COptMainDlg() : CDlgBase(hInst, IDD_MAIN), + COptMainDlg() : CDlgBase(g_plugin.getInst(), IDD_MAIN), chk_INFTALKPROT(this, ID_INFTALKPROT), chk_ADDPERMANENT(this, ID_ADDPERMANENT), chk_HANDLEAUTHREQ(this, ID_HANDLEAUTHREQ), chk_HIDECONTACTS(this, ID_HIDECONTACTS), chk_IGNORESPAMMERS(this, ID_IGNORESPAMMERS), chk_LOGSPAMTOFILE(this, ID_LOGSPAMTOFILE), ctrl_DESCRIPTION(this, ID_DESCRIPTION), edit_MAXQUESTCOUNT(this, ID_MAXQUESTCOUNT) @@ -64,7 +64,7 @@ private: class COptMessagesDlg : public CDlgBase { public: - COptMessagesDlg() : CDlgBase(hInst, IDD_MESSAGES), + COptMessagesDlg() : CDlgBase(g_plugin.getInst(), IDD_MESSAGES), edit_QUESTION(this, ID_QUESTION), edit_ANSWER(this, ID_ANSWER), edit_CONGRATULATION(this, ID_CONGRATULATION), edit_AUTHREPL(this, ID_AUTHREPL), btn_RESTOREDEFAULTS(this, ID_RESTOREDEFAULTS), btn_VARS(this, IDC_VARS) { @@ -114,7 +114,7 @@ private: class COptProtoDlg : public CDlgBase { public: - COptProtoDlg() : CDlgBase(hInst, IDD_PROTO), + COptProtoDlg() : CDlgBase(g_plugin.getInst(), IDD_PROTO), list_USEDPROTO(this, ID_USEDPROTO), list_ALLPROTO(this, ID_ALLPROTO), btn_ADD(this, ID_ADD), btn_REMOVE(this, ID_REMOVE), btn_ADDALL(this, ID_ADDALL), btn_REMOVEALL(this, ID_REMOVEALL) { @@ -184,7 +184,7 @@ private: class COptAdvancedDlg : public CDlgBase { public: - COptAdvancedDlg() : CDlgBase(hInst, IDD_ADVANCED), + COptAdvancedDlg() : CDlgBase(g_plugin.getInst(), 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), diff --git a/plugins/StopSpamMod/src/stdafx.h b/plugins/StopSpamMod/src/stdafx.h index c10b806397..1ff0aa6958 100755 --- a/plugins/StopSpamMod/src/stdafx.h +++ b/plugins/StopSpamMod/src/stdafx.h @@ -6,7 +6,6 @@ using namespace std; #include #include -#define __NO_CMPLUGIN_NEEDED #include #include #include @@ -36,7 +35,13 @@ using namespace std; #include "resource.h" #include "utilities.h" -extern HINSTANCE hInst; +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN(pluginName) + {} +}; + extern HANDLE hStopSpamLogDirH; int OnDbContactSettingChanged(WPARAM w, LPARAM l); -- cgit v1.2.3