From 2614e3d766e7d69407cf6f9f4ece54d8a8fbe13f Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Fri, 31 Jul 2015 18:36:43 +0000 Subject: Spamotron: common project git-svn-id: http://svn.miranda-ng.org/main/trunk@14769 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Spamotron/Spamotron.vcxproj | 41 +++++ plugins/Spamotron/Spamotron.vcxproj.filters | 4 + plugins/Spamotron/Spamotron_10.vcxproj | 204 ------------------------ plugins/Spamotron/Spamotron_10.vcxproj.filters | 68 -------- plugins/Spamotron/Spamotron_12.vcxproj | 210 ------------------------- plugins/Spamotron/Spamotron_12.vcxproj.filters | 68 -------- plugins/Spamotron/Spamotron_14.vcxproj | 210 ------------------------- plugins/Spamotron/Spamotron_14.vcxproj.filters | 68 -------- plugins/Spamotron/src/bayes.cpp | 2 +- plugins/Spamotron/src/common.h | 154 ------------------ plugins/Spamotron/src/options.cpp | 2 +- plugins/Spamotron/src/popups.cpp | 2 +- plugins/Spamotron/src/spamotron.cpp | 2 +- plugins/Spamotron/src/sqlite3/sqlite3.c | 1 - plugins/Spamotron/src/stdafx.cpp | 18 --- plugins/Spamotron/src/stdafx.cxx | 18 +++ plugins/Spamotron/src/stdafx.h | 152 ++++++++++++++++++ plugins/Spamotron/src/utils.cpp | 2 +- 18 files changed, 220 insertions(+), 1006 deletions(-) create mode 100644 plugins/Spamotron/Spamotron.vcxproj create mode 100644 plugins/Spamotron/Spamotron.vcxproj.filters delete mode 100644 plugins/Spamotron/Spamotron_10.vcxproj delete mode 100644 plugins/Spamotron/Spamotron_10.vcxproj.filters delete mode 100644 plugins/Spamotron/Spamotron_12.vcxproj delete mode 100644 plugins/Spamotron/Spamotron_12.vcxproj.filters delete mode 100644 plugins/Spamotron/Spamotron_14.vcxproj delete mode 100644 plugins/Spamotron/Spamotron_14.vcxproj.filters delete mode 100644 plugins/Spamotron/src/common.h delete mode 100644 plugins/Spamotron/src/stdafx.cpp create mode 100644 plugins/Spamotron/src/stdafx.cxx create mode 100644 plugins/Spamotron/src/stdafx.h (limited to 'plugins/Spamotron') diff --git a/plugins/Spamotron/Spamotron.vcxproj b/plugins/Spamotron/Spamotron.vcxproj new file mode 100644 index 0000000000..cd198c371d --- /dev/null +++ b/plugins/Spamotron/Spamotron.vcxproj @@ -0,0 +1,41 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {DBB261B4-E433-4DFF-8A5D-6C3B5B5F4FF4} + Spamotron + + + + + + + NotUsing + + + + + + + + {6124e997-426e-4a0b-9617-d6d577d5e7d7} + + + \ No newline at end of file diff --git a/plugins/Spamotron/Spamotron.vcxproj.filters b/plugins/Spamotron/Spamotron.vcxproj.filters new file mode 100644 index 0000000000..de5ad9f66c --- /dev/null +++ b/plugins/Spamotron/Spamotron.vcxproj.filters @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/plugins/Spamotron/Spamotron_10.vcxproj b/plugins/Spamotron/Spamotron_10.vcxproj deleted file mode 100644 index b76e1f6918..0000000000 --- a/plugins/Spamotron/Spamotron_10.vcxproj +++ /dev/null @@ -1,204 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {DBB261B4-E433-4DFF-8A5D-6C3B5B5F4FF4} - Spamotron - - - - DynamicLibrary - true - Unicode - - - DynamicLibrary - true - Unicode - - - DynamicLibrary - false - true - Unicode - - - DynamicLibrary - false - true - Unicode - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - true - - - - Level3 - Disabled - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - Use - common.h - - - true - $(ProfileDir)..\..\bin10\lib - $(IntDir)$(TargetName).lib - false - Windows - false - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - Level3 - Disabled - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - Use - common.h - - - true - $(ProfileDir)..\..\bin10\lib - $(IntDir)$(TargetName).lib - Windows - false - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - Level3 - Full - true - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - OnlyExplicitInline - Size - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - Use - common.h - - - true - true - true - $(ProfileDir)..\..\bin10\lib - $(IntDir)$(TargetName).lib - Windows - false - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - Level3 - Full - true - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - OnlyExplicitInline - Size - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - Use - common.h - - - true - true - true - $(ProfileDir)..\..\bin10\lib - $(IntDir)$(TargetName).lib - Windows - false - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - NotUsing - - - - - - - Create - - - - - - - - - - - - - - - - {6124e997-426e-4a0b-9617-d6d577d5e7d7} - - - - - - \ No newline at end of file diff --git a/plugins/Spamotron/Spamotron_10.vcxproj.filters b/plugins/Spamotron/Spamotron_10.vcxproj.filters deleted file mode 100644 index 00bebfea61..0000000000 --- a/plugins/Spamotron/Spamotron_10.vcxproj.filters +++ /dev/null @@ -1,68 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {219d5f59-e7c3-415c-a3af-539b7222082f} - - - {c2cd5aa5-923e-4b82-aa84-48bbdd5a2d47} - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files\sqlite3 - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files\sqlite3 - - - Header Files - - - - - Resource Files - - - Resource Files - - - \ No newline at end of file diff --git a/plugins/Spamotron/Spamotron_12.vcxproj b/plugins/Spamotron/Spamotron_12.vcxproj deleted file mode 100644 index 8122aa0771..0000000000 --- a/plugins/Spamotron/Spamotron_12.vcxproj +++ /dev/null @@ -1,210 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {DBB261B4-E433-4DFF-8A5D-6C3B5B5F4FF4} - Spamotron - - - - DynamicLibrary - true - Unicode - v120_xp - - - DynamicLibrary - true - Unicode - v120_xp - - - DynamicLibrary - false - true - Unicode - v120_xp - - - DynamicLibrary - false - true - Unicode - v120_xp - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - true - - - - Level3 - Disabled - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - Use - common.h - - - true - $(ProfileDir)..\..\bin12\lib - $(IntDir)$(TargetName).lib - false - Windows - false - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - Level3 - Disabled - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - Use - common.h - - - true - $(ProfileDir)..\..\bin12\lib - $(IntDir)$(TargetName).lib - Windows - false - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - Level3 - Full - true - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - OnlyExplicitInline - Size - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - Use - common.h - - - true - true - true - $(ProfileDir)..\..\bin12\lib - $(IntDir)$(TargetName).lib - /NODEFAULTLIB:LIBCMT %(AdditionalOptions) - Windows - false - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - Level3 - Full - true - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - OnlyExplicitInline - Size - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - Use - common.h - - - true - true - true - $(ProfileDir)..\..\bin12\lib - $(IntDir)$(TargetName).lib - /NODEFAULTLIB:LIBCMT %(AdditionalOptions) - Windows - false - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - NotUsing - - - - - - - Create - - - - - - - - - - - - - - - - {6124e997-426e-4a0b-9617-d6d577d5e7d7} - - - - - - \ No newline at end of file diff --git a/plugins/Spamotron/Spamotron_12.vcxproj.filters b/plugins/Spamotron/Spamotron_12.vcxproj.filters deleted file mode 100644 index 00bebfea61..0000000000 --- a/plugins/Spamotron/Spamotron_12.vcxproj.filters +++ /dev/null @@ -1,68 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {219d5f59-e7c3-415c-a3af-539b7222082f} - - - {c2cd5aa5-923e-4b82-aa84-48bbdd5a2d47} - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files\sqlite3 - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files\sqlite3 - - - Header Files - - - - - Resource Files - - - Resource Files - - - \ No newline at end of file diff --git a/plugins/Spamotron/Spamotron_14.vcxproj b/plugins/Spamotron/Spamotron_14.vcxproj deleted file mode 100644 index 1906c8e93c..0000000000 --- a/plugins/Spamotron/Spamotron_14.vcxproj +++ /dev/null @@ -1,210 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {DBB261B4-E433-4DFF-8A5D-6C3B5B5F4FF4} - Spamotron - - - - DynamicLibrary - true - Unicode - v140_xp - - - DynamicLibrary - true - Unicode - v140_xp - - - DynamicLibrary - false - true - Unicode - v140_xp - - - DynamicLibrary - false - true - Unicode - v140_xp - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - true - - - - Level3 - Disabled - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - Use - common.h - - - true - $(ProfileDir)..\..\bin14\lib - $(IntDir)$(TargetName).lib - false - Windows - false - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - Level3 - Disabled - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - Use - common.h - - - true - $(ProfileDir)..\..\bin14\lib - $(IntDir)$(TargetName).lib - Windows - false - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - Level3 - Full - true - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - OnlyExplicitInline - Size - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - Use - common.h - - - true - true - true - $(ProfileDir)..\..\bin14\lib - $(IntDir)$(TargetName).lib - /NODEFAULTLIB:LIBCMT %(AdditionalOptions) - Windows - false - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - Level3 - Full - true - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - OnlyExplicitInline - Size - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - Use - common.h - - - true - true - true - $(ProfileDir)..\..\bin14\lib - $(IntDir)$(TargetName).lib - /NODEFAULTLIB:LIBCMT %(AdditionalOptions) - Windows - false - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - NotUsing - - - - - - - Create - - - - - - - - - - - - - - - - {6124e997-426e-4a0b-9617-d6d577d5e7d7} - - - - - - \ No newline at end of file diff --git a/plugins/Spamotron/Spamotron_14.vcxproj.filters b/plugins/Spamotron/Spamotron_14.vcxproj.filters deleted file mode 100644 index 00bebfea61..0000000000 --- a/plugins/Spamotron/Spamotron_14.vcxproj.filters +++ /dev/null @@ -1,68 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {219d5f59-e7c3-415c-a3af-539b7222082f} - - - {c2cd5aa5-923e-4b82-aa84-48bbdd5a2d47} - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files\sqlite3 - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files\sqlite3 - - - Header Files - - - - - Resource Files - - - Resource Files - - - \ No newline at end of file diff --git a/plugins/Spamotron/src/bayes.cpp b/plugins/Spamotron/src/bayes.cpp index 1b79ccf76a..d62df44481 100644 --- a/plugins/Spamotron/src/bayes.cpp +++ b/plugins/Spamotron/src/bayes.cpp @@ -1,4 +1,4 @@ -#include "common.h" +#include "stdafx.h" #include "io.h" #define DELIMS " ,.;!?@-\\/+&\x0D\x0A" diff --git a/plugins/Spamotron/src/common.h b/plugins/Spamotron/src/common.h deleted file mode 100644 index acdc965c80..0000000000 --- a/plugins/Spamotron/src/common.h +++ /dev/null @@ -1,154 +0,0 @@ -#define _CRT_SECURE_NO_WARNINGS - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "m_folders.h" - -#include "..\..\libs\pcre16\src\pcre.h" - -#include "resource.h" -#include "version.h" - -#define PLUGIN_NAME "Spam-o-tron" - -#define SPAMOTRON_MODE_PLAIN 0 -#define SPAMOTRON_MODE_MATH 1 -#define SPAMOTRON_MODE_ROTATE 2 -#define SPAMOTRON_MODE_RANDOM 3 - -#define MAX_BUFFER_LENGTH 1024 - -#define _getCOptB(a,b,c) db_get_b(a, PLUGIN_NAME, b, c) -#define _setCOptB(a,b,c) db_set_b(a, PLUGIN_NAME, b, c) -#define _getCOptD(a,b,c) db_get_dw(a, PLUGIN_NAME, b, c) -#define _setCOptD(a,b,c) db_set_dw(a, PLUGIN_NAME, b, c) -#define _getOptB(a,b) _getCOptB(NULL, a, b) -#define _setOptB(a,b) _setCOptB(NULL, a, b) -#define _getOptD(a,b) _getCOptD(NULL, a, b) -#define _setOptD(a,b) _setCOptD(NULL, a, b) - -TCHAR* _getCOptS(TCHAR *buf, unsigned int buflen, MCONTACT hContact, const char* option, const TCHAR *def); -#define _getOptS(a,b,c,d) _getCOptS(a, b, NULL, c, d) -#define _setCOptTS(a,b,c) db_set_ts(a, PLUGIN_NAME, b, c) -#define _setCOptS(a,b,c) db_set_s(a, PLUGIN_NAME, b, c) -#define _setOptTS(a,b) _setCOptTS(NULL, a, b) - -#define defaultMode SPAMOTRON_MODE_PLAIN -#define defaultChallenge TranslateT("Spam-o-tron needs to verify you're not a bot. Reply with \"%response%\" without quotes.") -#define defaultChallengeMath TranslateT("Spam-o-tron needs to verify you're not a bot. Reply with a result of expression %mathexpr%.") -#define defaultResponse _T("no-spam") -#define defaultResponseCC TRUE -#define defaultSuccessResponse TranslateT("Verified.") -#define defaultAuthChallenge TranslateT("Spam-o-tron delayed authorization request. First reply with \"%response%\" without quotes.") -#define defaultAuthChallengeMath TranslateT("Spam-o-tron delayed authorization request. First reply with a result of expression %mathexpr%.") -#define defaultReplyOnSuccess TRUE -#define defaultReplyOnAuth TRUE -#define defaultReplyOnMsg TRUE -#define defaultApproveOnMsgOut TRUE -#define defaultApproveOnMsgIn FALSE -#define defaultAddPermanently FALSE -#define defaultHideUnverified TRUE -#define defaultKeepBlockedMsg TRUE -#define defaultMarkMsgUnreadOnApproval FALSE -#define defaultLogActions TRUE -#define defaultNotifyPopup FALSE -#define defaultDontReplySameMsg TRUE -#define defaultDontReplyMsg TRUE -#define defaultApproveOnMsgInWordlist _T("") -#define defaultDontReplyMsgWordlist _T("Spam-o-tron, StopSpam, Anti-Spam") -#define defaultMaxMsgContactCountPerDay 3 -#define defaultMaxSameMsgCountPerDay 2 - -#define defaultNotifyPopupBlocked TRUE -#define defaultNotifyPopupApproved TRUE -#define defaultNotifyPopupChallenge TRUE -#define defaultPopupDefaultColors FALSE -#define defaultPopupWindowsColors FALSE -#define defaultPopupDefaultTimeout TRUE -#define defaultPopupBlockedTimeout 2 -#define defaultPopupApprovedTimeout 2 -#define defaultPopupChallengeTimeout 2 -#define defaultPopupBlockedForeground RGB(0, 0, 0) -#define defaultPopupBlockedBackground RGB(240, 128, 128) -#define defaultPopupApprovedForeground RGB(0, 0, 0) -#define defaultPopupApprovedBackground RGB(128, 240, 128) -#define defaultPopupChallengeForeground RGB(0, 0, 0) -#define defaultPopupChallengeBackground RGB(180, 210, 240) - -#define _NOTIFYP _getOptB("NotifyPopup", defaultNotifyPopup) - -TCHAR* ReplaceVars(TCHAR *dst, unsigned int len); -TCHAR* ReplaceVarsNum(TCHAR *dst, unsigned int len, int num); -TCHAR* ReplaceVar(TCHAR *dst, unsigned int len, const TCHAR *var, const TCHAR *rvar); -int get_response_id(const TCHAR *strvar); -int get_response_num(const TCHAR *str); -TCHAR* get_response(TCHAR* dst, unsigned int dstlen, int num); - -TCHAR* _tcsstr_cc(TCHAR* str, TCHAR* strSearch, BOOL cc); -BOOL _isregex(TCHAR* strSearch); -BOOL _isvalidregex(TCHAR* strSearch); -BOOL _regmatch(TCHAR* str, TCHAR* strSearch); -BOOL Contains(TCHAR* dst, TCHAR* src); -BOOL isOneDay(DWORD timestamp1, DWORD timestamp2); -void MarkUnread(MCONTACT hContact); - -int ShowPopup(MCONTACT hContact, BYTE popupType, TCHAR *line1, TCHAR *line2); -int ShowPopupPreview(HWND optDlg, BYTE popupType, TCHAR *line1, TCHAR *line2); -int _notify(MCONTACT hContact, BYTE type, TCHAR *message, TCHAR *origmessage); -int LogToSystemHistory(char *message, char *origmessage); -#define POPUP_DEFAULT 0 -#define POPUP_BLOCKED 1 -#define POPUP_APPROVED 2 -#define POPUP_CHALLENGE 3 - -/* bayes.c */ - -#include "sqlite3\sqlite3.h" -extern sqlite3 *bayesdb; -#define BAYESDB_PATH "spamotron" -#define BAYESDB_FILENAME "bayes.db" -#define defaultBayesEnabled TRUE -#define defaultBayesBlockMsg FALSE -#define defaultBayesAutoApprove FALSE -#define defaultBayesAutolearnApproved TRUE -#define defaultBayesAutolearnAutoApproved FALSE -#define defaultBayesAutolearnNotApproved TRUE -#define defaultBayesAutolearnOutgoing FALSE -#define defaultBayesWaitApprove 2 -#define SCORE_C 0.0001 -#define defaultBayesSpamScore 9500 -#define defaultBayesHamScore 500 -#define HAM 0 -#define SPAM 1 - -int OpenBayes(); -int CheckBayes(); -void learn(int type, TCHAR *msg); -void learn_ham(TCHAR *msg); -void learn_spam(TCHAR *msg); -int get_token_count(int type); -int get_msg_count(int type); -double get_msg_score(TCHAR *msg); -void queue_message(MCONTACT hContact, DWORD msgtime, TCHAR *message); -void bayes_approve_contact(MCONTACT hContact); -void dequeue_messages(); - -#ifdef _DEBUG -extern sqlite3 *bayesdbg; -#define BAYESDBG_FILENAME "bayes.dbg" -#endif \ No newline at end of file diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp index 24183ba492..3e204e11d0 100644 --- a/plugins/Spamotron/src/options.cpp +++ b/plugins/Spamotron/src/options.cpp @@ -1,4 +1,4 @@ -#include "common.h" +#include "stdafx.h" TCHAR currentResponse[256] = {0}; diff --git a/plugins/Spamotron/src/popups.cpp b/plugins/Spamotron/src/popups.cpp index 9a5d8b889f..46289ac9af 100644 --- a/plugins/Spamotron/src/popups.cpp +++ b/plugins/Spamotron/src/popups.cpp @@ -1,4 +1,4 @@ -#include "common.h" +#include "stdafx.h" extern BOOL _saveDlgItemInt(HWND hDialog, int controlID, char* option); diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index c0d76a9a9f..0528c44033 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -1,4 +1,4 @@ -#include "common.h" +#include "stdafx.h" CLIST_INTERFACE *pcli; HINSTANCE hInst; diff --git a/plugins/Spamotron/src/sqlite3/sqlite3.c b/plugins/Spamotron/src/sqlite3/sqlite3.c index d9b165f088..074cdf9ba1 100644 --- a/plugins/Spamotron/src/sqlite3/sqlite3.c +++ b/plugins/Spamotron/src/sqlite3/sqlite3.c @@ -19,7 +19,6 @@ ** ** This amalgamation was generated on 2009-04-15 12:44:27 UTC. */ -#define _CRT_SECURE_NO_WARNINGS #define SQLITE_CORE 1 #define SQLITE_AMALGAMATION 1 diff --git a/plugins/Spamotron/src/stdafx.cpp b/plugins/Spamotron/src/stdafx.cpp deleted file mode 100644 index c5fe5abaad..0000000000 --- a/plugins/Spamotron/src/stdafx.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright (C) 2012-15 Miranda NG project (http://miranda-ng.org) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation version 2 -of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include "common.h" \ No newline at end of file diff --git a/plugins/Spamotron/src/stdafx.cxx b/plugins/Spamotron/src/stdafx.cxx new file mode 100644 index 0000000000..6fb37564b7 --- /dev/null +++ b/plugins/Spamotron/src/stdafx.cxx @@ -0,0 +1,18 @@ +/* +Copyright (C) 2012-15 Miranda NG project (http://miranda-ng.org) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation version 2 +of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#include "stdafx.h" \ No newline at end of file diff --git a/plugins/Spamotron/src/stdafx.h b/plugins/Spamotron/src/stdafx.h new file mode 100644 index 0000000000..f580427752 --- /dev/null +++ b/plugins/Spamotron/src/stdafx.h @@ -0,0 +1,152 @@ +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "m_folders.h" + +#include "..\..\libs\pcre16\src\pcre.h" + +#include "resource.h" +#include "version.h" + +#define PLUGIN_NAME "Spam-o-tron" + +#define SPAMOTRON_MODE_PLAIN 0 +#define SPAMOTRON_MODE_MATH 1 +#define SPAMOTRON_MODE_ROTATE 2 +#define SPAMOTRON_MODE_RANDOM 3 + +#define MAX_BUFFER_LENGTH 1024 + +#define _getCOptB(a,b,c) db_get_b(a, PLUGIN_NAME, b, c) +#define _setCOptB(a,b,c) db_set_b(a, PLUGIN_NAME, b, c) +#define _getCOptD(a,b,c) db_get_dw(a, PLUGIN_NAME, b, c) +#define _setCOptD(a,b,c) db_set_dw(a, PLUGIN_NAME, b, c) +#define _getOptB(a,b) _getCOptB(NULL, a, b) +#define _setOptB(a,b) _setCOptB(NULL, a, b) +#define _getOptD(a,b) _getCOptD(NULL, a, b) +#define _setOptD(a,b) _setCOptD(NULL, a, b) + +TCHAR* _getCOptS(TCHAR *buf, unsigned int buflen, MCONTACT hContact, const char* option, const TCHAR *def); +#define _getOptS(a,b,c,d) _getCOptS(a, b, NULL, c, d) +#define _setCOptTS(a,b,c) db_set_ts(a, PLUGIN_NAME, b, c) +#define _setCOptS(a,b,c) db_set_s(a, PLUGIN_NAME, b, c) +#define _setOptTS(a,b) _setCOptTS(NULL, a, b) + +#define defaultMode SPAMOTRON_MODE_PLAIN +#define defaultChallenge TranslateT("Spam-o-tron needs to verify you're not a bot. Reply with \"%response%\" without quotes.") +#define defaultChallengeMath TranslateT("Spam-o-tron needs to verify you're not a bot. Reply with a result of expression %mathexpr%.") +#define defaultResponse _T("no-spam") +#define defaultResponseCC TRUE +#define defaultSuccessResponse TranslateT("Verified.") +#define defaultAuthChallenge TranslateT("Spam-o-tron delayed authorization request. First reply with \"%response%\" without quotes.") +#define defaultAuthChallengeMath TranslateT("Spam-o-tron delayed authorization request. First reply with a result of expression %mathexpr%.") +#define defaultReplyOnSuccess TRUE +#define defaultReplyOnAuth TRUE +#define defaultReplyOnMsg TRUE +#define defaultApproveOnMsgOut TRUE +#define defaultApproveOnMsgIn FALSE +#define defaultAddPermanently FALSE +#define defaultHideUnverified TRUE +#define defaultKeepBlockedMsg TRUE +#define defaultMarkMsgUnreadOnApproval FALSE +#define defaultLogActions TRUE +#define defaultNotifyPopup FALSE +#define defaultDontReplySameMsg TRUE +#define defaultDontReplyMsg TRUE +#define defaultApproveOnMsgInWordlist _T("") +#define defaultDontReplyMsgWordlist _T("Spam-o-tron, StopSpam, Anti-Spam") +#define defaultMaxMsgContactCountPerDay 3 +#define defaultMaxSameMsgCountPerDay 2 + +#define defaultNotifyPopupBlocked TRUE +#define defaultNotifyPopupApproved TRUE +#define defaultNotifyPopupChallenge TRUE +#define defaultPopupDefaultColors FALSE +#define defaultPopupWindowsColors FALSE +#define defaultPopupDefaultTimeout TRUE +#define defaultPopupBlockedTimeout 2 +#define defaultPopupApprovedTimeout 2 +#define defaultPopupChallengeTimeout 2 +#define defaultPopupBlockedForeground RGB(0, 0, 0) +#define defaultPopupBlockedBackground RGB(240, 128, 128) +#define defaultPopupApprovedForeground RGB(0, 0, 0) +#define defaultPopupApprovedBackground RGB(128, 240, 128) +#define defaultPopupChallengeForeground RGB(0, 0, 0) +#define defaultPopupChallengeBackground RGB(180, 210, 240) + +#define _NOTIFYP _getOptB("NotifyPopup", defaultNotifyPopup) + +TCHAR* ReplaceVars(TCHAR *dst, unsigned int len); +TCHAR* ReplaceVarsNum(TCHAR *dst, unsigned int len, int num); +TCHAR* ReplaceVar(TCHAR *dst, unsigned int len, const TCHAR *var, const TCHAR *rvar); +int get_response_id(const TCHAR *strvar); +int get_response_num(const TCHAR *str); +TCHAR* get_response(TCHAR* dst, unsigned int dstlen, int num); + +TCHAR* _tcsstr_cc(TCHAR* str, TCHAR* strSearch, BOOL cc); +BOOL _isregex(TCHAR* strSearch); +BOOL _isvalidregex(TCHAR* strSearch); +BOOL _regmatch(TCHAR* str, TCHAR* strSearch); +BOOL Contains(TCHAR* dst, TCHAR* src); +BOOL isOneDay(DWORD timestamp1, DWORD timestamp2); +void MarkUnread(MCONTACT hContact); + +int ShowPopup(MCONTACT hContact, BYTE popupType, TCHAR *line1, TCHAR *line2); +int ShowPopupPreview(HWND optDlg, BYTE popupType, TCHAR *line1, TCHAR *line2); +int _notify(MCONTACT hContact, BYTE type, TCHAR *message, TCHAR *origmessage); +int LogToSystemHistory(char *message, char *origmessage); +#define POPUP_DEFAULT 0 +#define POPUP_BLOCKED 1 +#define POPUP_APPROVED 2 +#define POPUP_CHALLENGE 3 + +/* bayes.c */ + +#include "sqlite3\sqlite3.h" +extern sqlite3 *bayesdb; +#define BAYESDB_PATH "spamotron" +#define BAYESDB_FILENAME "bayes.db" +#define defaultBayesEnabled TRUE +#define defaultBayesBlockMsg FALSE +#define defaultBayesAutoApprove FALSE +#define defaultBayesAutolearnApproved TRUE +#define defaultBayesAutolearnAutoApproved FALSE +#define defaultBayesAutolearnNotApproved TRUE +#define defaultBayesAutolearnOutgoing FALSE +#define defaultBayesWaitApprove 2 +#define SCORE_C 0.0001 +#define defaultBayesSpamScore 9500 +#define defaultBayesHamScore 500 +#define HAM 0 +#define SPAM 1 + +int OpenBayes(); +int CheckBayes(); +void learn(int type, TCHAR *msg); +void learn_ham(TCHAR *msg); +void learn_spam(TCHAR *msg); +int get_token_count(int type); +int get_msg_count(int type); +double get_msg_score(TCHAR *msg); +void queue_message(MCONTACT hContact, DWORD msgtime, TCHAR *message); +void bayes_approve_contact(MCONTACT hContact); +void dequeue_messages(); + +#ifdef _DEBUG +extern sqlite3 *bayesdbg; +#define BAYESDBG_FILENAME "bayes.dbg" +#endif \ No newline at end of file diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp index 98e1fa2901..c4512e7be8 100644 --- a/plugins/Spamotron/src/utils.cpp +++ b/plugins/Spamotron/src/utils.cpp @@ -1,4 +1,4 @@ -#include "common.h" +#include "stdafx.h" #include -- cgit v1.2.3