/* "Spam Filter"-Plugin for Miranda IM Copyright 2003-2006 Heiko Herkenrath 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; either version 2 of the License, or (at your option) any later version. 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 ("SpamFilter-License.txt"); if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef SF_COMMON_H__ #define SF_COMMON_H__ 1 #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // -- Includes: CRT (C Runtime Library) //#include // generic Ansi/Unicode functions #include // unicode functions #include // for mir_snprintf() etc. #include // for forkthread() #include // for time() // -- Includes: WinAPI #define _WIN32_WINNT 0x0501 //#define WINVER 0x0502 #define _WIN32_IE 0x0500 // for SHFileOperation #include #include #include #include // -- Include: MirandaAPI //#define NOWIN2K #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#define VARIABLES_NOHELPER #include #include #include #include #include #include #include #include "m_trigger.h" #include #include // -- Includes: Header #include "m_spamfilter.h" #include "forkthread.h" #include "path.h" #include "stringlist.h" #include "string.h" #include "regexp.h" #include "utilities.h" #include "spamdefinitions.h" #include "spamcheckdata.h" #include "popup.h" #include "logfile.h" #include "contact.h" #include "dlg.h" #include "options.h" #include "services.h" #include "spamcheck.h" #include "variables.h" #include "folders.h" #include "trigger.h" #include "extraimg.h" #include "menuitems.h" #include "version.h" #include "resource.h" #include struct MM_INTERFACE memoryManagerInterface; struct UTF8_INTERFACE utfi; // -- Includes: Utilities #if defined(_DEBUG) // Memory leak and invalid access detection //#define _CRTDBG_MAP_ALLOC #include //#define new new(_NORMAL_BLOCK, __FILE__, __LINE__) // Check database setting type (m_database.h) //#define DBCHECKSETTINGS #else // Prevent C Runtime Library (CRT) /* #pragma comment(linker,"/ENTRY:DllMain") #pragma comment(linker,"/NODEFAULTLIB") */ #endif // Debug Functions #include "Utilities/DebugHelper.h" // -- Variables: Plugin HINSTANCE hInstance; PLUGINLINK* pluginLink; // -- Variables: Window Handles HWND hwndSpamFilterOpt; HWND hwndAdvertismentFilter; HWND hwndRobotFilter; HWND hwndDislikedMessagesFilter; HWND hwndSpamDefinitionsInfo; HWND hwndSpammersInfo; // -- Variables: Message Types List CRITICAL_SECTION csMsgTypes; unsigned int uMsgTypesCount; // protected by csMsgTypes MESSAGETYPEDESC* pamtdMsgTypes; // protected by csMsgTypes // -- Defines: General #define DEFAULT_LOGFILE TranslateT("Spam.xml") #define DEFAULT_ADVERTISMENT_SOUNDFILE _T("filtered1.wav") // Sound files must not be translated and must be lower case #define DEFAULT_DISLIKEDMESSAGE_SOUNDFILE _T("filtered2.wav") #define DEFAULT_ROBOT_SOUNDFILE _T("filtered3.wav") #define SOUNDS_SUBDIRECTORY _T("Sounds") // Dirs must have no backslash at the end! #define DOCS_SUBDIRECTORY _T("Docs") #define LOGS_SUBDIRECTORY _T("Logs") #define DATA_SUBDIRECTORY _T("Spam Filter") #define RANDOM_ANSWER_LENGTH 8 #define MAX_INT_LENGTH 15 // or just 10 #define MS_CONTACTS_SEND "ContactsTransfer/SendContacts" #define MS_CONTACTS_RECEIVE "ContactsTransfer/ReceiveContacts" // -- Defines: Default Settings #define DEFAULT_SETTING_BEHAVIOUR 1 // 1 = Mark message read or 2 = Delete message #define DEFAULT_SETTING_POPUP FALSE #define DEFAULT_SETTING_LOGGING FALSE #define DEFAULT_SETTING_AUTOADDSPAMMERS TRUE #define DEFAULT_SETTING_ALLOWEDSPAMMESSAGES 3 // 0 to x #define DEFAULT_SETTING_HIDEFROMCLIST TRUE #define DEFAULT_SETTING_MOVETOGROUP FALSE #define DEFAULT_SETTING_MOVETOGROUPNAME TranslateT("Spammers") #define DEFAULT_SETTING_SETSPAMMERFLAGS 0 // flags can be SCASF_NO_REMOVE_HISTORY, SCASF_NO_DENY_AUTHREQUESTS, SCASF_NO_NOTIFY #define DEFAULT_SETTING_ADVERTISMENTFILTER TRUE #define DEFAULT_SETTING_ADVERTISMENT_DEFAULTBADWORDS TRUE #define DEFAULT_SETTING_ADVERTISMENT_FORMATING TRUE #define DEFAULT_SETTING_ADVERTISMENT_URL FALSE #define DEFAULT_SETTING_ADVERTISMENT_PHONENUMBERS FALSE #define DEFAULT_SETTING_ADVERTISMENT_CAPITALIZED FALSE #define DEFAULT_SETTING_ADVERTISMENT_EMPTY TRUE #define DEFAULT_SETTING_ADVERTISMENT_DEFAULTSPAMMERS TRUE #define DEFAULT_SETTING_ADVERTISMENT_MULTIPLEMESSAGES TRUE #define DEFAULT_SETTING_ADVERTISMENT_TEASERMESSAGES TRUE #define DEFAULT_SETTING_ADVERTISMENT_ALLOWEDBADWORDS 3 // 0 to x #define DEFAULT_SETTING_ADVERTISMENT_ALLOWEDGOODWORDS 0 // 0 to x #define DEFAULT_SETTING_ADVERTISMENT_ALLOWEDFORMATEDWORDS 1 // 0 to x #define DEFAULT_SETTING_DISLIKEDMESSAGEFILTER FALSE #define DEFAULT_SETTING_DISLIKEDMESSAGE_HOAXTEXTS TRUE #define DEFAULT_SETTING_DISLIKEDMESSAGE_MULTIPLEMESSAGES TRUE #define DEFAULT_SETTING_DISLIKEDMESSAGE_NOTIFYSENDER FALSE #define DEFAULT_SETTING_DISLIKEDMESSAGE_ADDTOHISTORY TRUE #define DEFAULT_SETTING_DISLIKEDMESSAGE_RETURNMESSAGE TranslateT("Hello %sender%,\r\nI don't like such messages. Please don't send them to me anymore.\r\nThanks.\r\n\r\n(Automated message)") #define DEFAULT_SETTING_ROBOTFILTER FALSE #define DEFAULT_SETTING_ROBOT_INSTRUCTION TranslateT("Hello %sender%,\r\nPlease reply \"%securitycode%\" if you want to contact me. If you don't reply correctly your messages will be ignored. Sorry for the inconvenience.\r\nThis spam check guarantees that you are a real person.\r\nYou have %triesleft% tries left.\r\nThanks in advance!\r\n\r\n(Automated message)") #define DEFAULT_SETTING_ROBOT_CONFIRMATION TranslateT("Thank you for your help!\r\nAll your previous messages were delivered. New messages do now reach me directly without an additional spam check.\r\n\r\n(Automated message)") #define DEFAULT_SETTING_ROBOT_ADDTOHISTORY TRUE #define DEFAULT_SETTING_ROBOT_HIDEUSERS TRUE // -- Defines: Database #define DB_MODULE_NAME "SpamFilter" #define DB_MODULE_NAME_PRESPAMMERS "SpamFilterAutoIgnore" #define DB_MODULE_NAME_MSGTYPES "SpamFilterMsgTypes" #define DB_SETTING_FIRSTRUNDONE "FirstRunDone" #define DB_SETTING_POPUP "PopupActivated" #define DB_SETTING_BEHAVIOUR "FilterBehaviour" #define DB_SETTING_AUTOADDSPAMMERS "AutoIgnoreSpammers" #define DB_SETTING_ALLOWEDSPAMMESSAGES "AllowedSpamMsgs" #define DB_SETTING_MOVETOGROUP "MoveToGroup" #define DB_SETTING_HIDEFROMCLIST "HideFromCList" #define DB_SETTING_MOVETOGROUPNAME "MoveToGroupName" #define DB_SETTING_LOGGING "LoggingActivated" #define DB_SETTING_LOGFILE "LogFile" #define DB_SETTING_ADVERTISMENTFILTER "AFActivated" #define DB_SETTING_ADVERTISMENT_DEFAULTBADWORDS "AFDefaultBadWordsCheck" #define DB_SETTING_ADVERTISMENT_CUSTOMIZEDBADWORDS "AFCustomizedBadWordsCheck" #define DB_SETTING_ADVERTISMENT_CUSTOMIZEDGOODWORDS "AFGoodWordsCheck" #define DB_SETTING_ADVERTISMENT_FORMATING "AFDifferentFormatingCheck" #define DB_SETTING_ADVERTISMENT_URL "AFMsgContainsUrlCheck" #define DB_SETTING_ADVERTISMENT_PHONENUMBERS "AFMsgContainsPhoneNumbersCheck" #define DB_SETTING_ADVERTISMENT_CAPITALIZED "AFCapitalizedMsgsCheck" #define DB_SETTING_ADVERTISMENT_EMPTY "AFEmptyMsgsCheck" #define DB_SETTING_ADVERTISMENT_DEFAULTSPAMMERS "AFDefaultSpammersCheck" #define DB_SETTING_ADVERTISMENT_MULTIPLEMESSAGES "AFMultipleMsgsCheck" #define DB_SETTING_ADVERTISMENT_LASTMESSAGE "AFLastFilteredMsg" #define DB_SETTING_ADVERTISMENT_TEASERMESSAGES "AFTeaserMsgCheck" #define DB_SETTING_ADVERTISMENT_ALLOWEDBADWORDS "AFAllowedBadWords" #define DB_SETTING_ADVERTISMENT_ALLOWEDGOODWORDS "AFAllowedGoodWords" #define DB_SETTING_ADVERTISMENT_ALLOWEDFORMATEDWORDS "AFAllowedFormatedWords" #define DB_SETTING_ADVERTISMENT_DIALOGPOSITION "AFConfigureDialog_" #define DB_SETTING_DISLIKEDMESSAGEFILTER "DFActivated" #define DB_SETTING_DISLIKEDMESSAGE_CUSTOMIZEDWORDS "DFIndicatingWordsCheck" #define DB_SETTING_DISLIKEDMESSAGE_HOAXTEXTS "DFHoaxTextsCheck" #define DB_SETTING_DISLIKEDMESSAGE_MULTIPLEMESSAGES "DFMultipleMsgsCheck" #define DB_SETTING_DISLIKEDMESSAGE_LASTMESSAGE "DFLastFilteredMsg" #define DB_SETTING_DISLIKEDMESSAGE_LASTSENDER "DFLastFilteredSender" #define DB_SETTING_DISLIKEDMESSAGE_NOTIFYSENDER "DFNotifySender" #define DB_SETTING_DISLIKEDMESSAGE_RETURNMESSAGE "DFNotifySenderMsg" #define DB_SETTING_DISLIKEDMESSAGE_ADDTOHISTORY "DFAddReplyToHistory" #define DB_SETTING_DISLIKEDMESSAGE_DIALOGPOSITION "DFConfigureDialog_" #define DB_SETTING_ROBOTFILTER "RFActivated" #define DB_SETTING_ROBOT_INSTRUCTION "RFInstructionMsg" #define DB_SETTING_ROBOT_CONFIRMATION "RFConfirmationMsg" #define DB_SETTING_ROBOT_ADDTOHISTORY "RFAddMsgsToHistory" #define DB_SETTING_ROBOT_DIALOGPOSITION "RFConfigureDialog_" #define DB_SETTING_ROBOT_ANSWER "RFCorrectAnswer" #define DB_SETTING_ROBOT_HIDEUSERS "RFHideUntilConfirmed" #define DB_SETTING_SPAMDEF_DIALOGPOSITION "SpamDefinitionsDlg_" #define DB_SETTING_SPAMMERS_DIALOGPOSITION "SpammersDlg_" // Per contact settings #define DB_SETTING_ROBOT_TESTPASSED "RFTestPassed" #define DB_SETTING_ISSPAMMER "IsSpammer" // Sounds #define DB_SOUND_ADVERTISMENT_SETTING DB_MODULE_NAME"_AdvertismentFiltered" #define DB_SOUND_DISLIKEDMESSAGE_SETTING DB_MODULE_NAME"_DislikedMessageFiltered" #define DB_SOUND_ROBOT_SETTING DB_MODULE_NAME"_RobotFiltered" // Icons #define DB_ICON_SPAMLAYER_SETTING DB_MODULE_NAME"_SpamLayer" #define DB_ICON_SPAMMANUALLY_SETTING DB_MODULE_NAME"_SpamManually" #define DB_ICON_ISSPAMMER_SETTING DB_MODULE_NAME"_IsSpammer" // Colors #define DB_COLOR_POPUPBACKGROUND_SETTING DB_MODULE_NAME"_PopupBackground" #define DB_COLOR_POPUPTEXT_SETTING DB_MODULE_NAME"_PopupText" #endif // SF_COMMON_H__