diff options
Diffstat (limited to 'protocols/MRA/src')
-rw-r--r-- | protocols/MRA/src/Mra.cpp | 12 | ||||
-rw-r--r-- | protocols/MRA/src/Mra.h | 1 | ||||
-rw-r--r-- | protocols/MRA/src/MraAntiSpam.cpp | 428 | ||||
-rw-r--r-- | protocols/MRA/src/MraAntiSpam.h | 16 | ||||
-rw-r--r-- | protocols/MRA/src/MraConstans.h | 10 | ||||
-rw-r--r-- | protocols/MRA/src/MraProto.h | 6 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_options.cpp | 11 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_proto.cpp | 6 | ||||
-rw-r--r-- | protocols/MRA/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/MRA/src/resource.h | 12 | ||||
-rw-r--r-- | protocols/MRA/src/version.h | 2 |
11 files changed, 5 insertions, 501 deletions
diff --git a/protocols/MRA/src/Mra.cpp b/protocols/MRA/src/Mra.cpp index ff4cdf4909..cb410b03f6 100644 --- a/protocols/MRA/src/Mra.cpp +++ b/protocols/MRA/src/Mra.cpp @@ -137,20 +137,12 @@ extern "C" __declspec(dllexport) int Unload(void) static int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- MraAntiSpamLoadBadWordsW();
-
- InterlockedExchange((volatile LONG*)&masMraSettings.dwGlobalPluginRunning, TRUE);
-
- DebugPrintCRLFW(L"OnModulesLoaded - DONE");
+ masMraSettings.dwGlobalPluginRunning = TRUE;
return 0;
}
int OnPreShutdown(WPARAM wParam, LPARAM lParam)
{
- InterlockedExchange((volatile LONG*)&masMraSettings.dwGlobalPluginRunning, FALSE);
-
- MraAntiSpamFreeBadWords();
-
- DebugPrintCRLFW(L"OnPreShutdown - DONE");
+ masMraSettings.dwGlobalPluginRunning = FALSE;
return 0;
}
diff --git a/protocols/MRA/src/Mra.h b/protocols/MRA/src/Mra.h index 538d28d2bc..673d1d29c4 100644 --- a/protocols/MRA/src/Mra.h +++ b/protocols/MRA/src/Mra.h @@ -192,7 +192,6 @@ extern GUI_DISPLAY_ITEM gdiExtraStatusIconsItems[]; #include "MraAvatars.h"
#include "MraIcons.h"
#include "MraSelectEMail.h"
-#include "MraAntiSpam.h"
#include "MraMPop.h"
#include "MraChat.h"
diff --git a/protocols/MRA/src/MraAntiSpam.cpp b/protocols/MRA/src/MraAntiSpam.cpp deleted file mode 100644 index 7508570bc3..0000000000 --- a/protocols/MRA/src/MraAntiSpam.cpp +++ /dev/null @@ -1,428 +0,0 @@ -// started: 19.12.2006
-
-#include "Mra.h"
-#include "MraAntiSpam.h"
-#include "MraRTFMsg.h"
-
-struct MRA_ANTISPAM_BAD_WORD
-{
- LPWSTR lpwszBadWord;
- DWORD dwBadWordLen;
-};
-
-static MRA_ANTISPAM_BAD_WORD *pmabwBadWords = NULL;
-static size_t dwBadWordsCount = 0;
-
-#define MRA_ANTISPAM_PREALLOC_COUNT 256
-
-size_t MraAntiSpamLoadBadWordsW()
-{
- DBVARIANT dbv = {0};
- size_t i = 0, dwValueSize, dwAllocatedItemsCount = MRA_ANTISPAM_PREALLOC_COUNT;
-
- if (pmabwBadWords || dwBadWordsCount)
- MraAntiSpamFreeBadWords();
-
- pmabwBadWords = (MRA_ANTISPAM_BAD_WORD*)mir_calloc((sizeof(MRA_ANTISPAM_BAD_WORD)*dwAllocatedItemsCount));
-
- for (i = 0;TRUE;i++) {
- char szSettingName[MAX_PATH];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "AntiSpamBadWord %lu", i);
- if (db_get_ws(NULL, "MRA", szSettingName, &dbv))
- break;
-
- if (dwAllocatedItemsCount == i) {
- dwAllocatedItemsCount += MRA_ANTISPAM_PREALLOC_COUNT;
- pmabwBadWords = (MRA_ANTISPAM_BAD_WORD*)mir_realloc(pmabwBadWords, (sizeof(MRA_ANTISPAM_BAD_WORD)*dwAllocatedItemsCount));
- if (pmabwBadWords == NULL)
- break;
- }
-
- dwValueSize = lstrlenW(dbv.pwszVal);
- pmabwBadWords[i].lpwszBadWord = (LPWSTR)mir_calloc((dwValueSize*sizeof(WCHAR)));
- if (pmabwBadWords[i].lpwszBadWord) {
- memmove(pmabwBadWords[i].lpwszBadWord, dbv.pwszVal, (dwValueSize*sizeof(WCHAR)));
- CharLowerBuffW(pmabwBadWords[i].lpwszBadWord, DWORD(dwValueSize));
- pmabwBadWords[i].dwBadWordLen = DWORD(dwValueSize);
- }
- db_free(&dbv);
-
- if (pmabwBadWords[i].lpwszBadWord == NULL)
- break;
- }
- dwBadWordsCount = i;
-
- return 0;
-}
-
-
-void MraAntiSpamFreeBadWords()
-{
- for (size_t i = 0; i < dwBadWordsCount; i++)
- mir_free(pmabwBadWords[i].lpwszBadWord);
-
- mir_free(pmabwBadWords);
- dwBadWordsCount = 0;
-}
-
-static WORD wMraAntiSpamControlsList[] = {
- IDC_CHK_TEMP_CONTACTS, IDC_CLN_NON_ALPHNUM, IDC_MAX_LANG_CHANGES, IDC_SHOWPOPUP, IDC_WRITETOSYSTEMHISTORY, IDC_SEND_SPAM_REPORT_TO_SERVER,
- IDC_BAD_WORDS_LIST, IDC_EDIT_BAD_WORD, IDC_BUTTON_ADD, IDC_BUTTONREMOVE, IDC_BUTTON_DEFAULT };
-
-void MraAntiSpamEnableControls(HWND hWndDlg, BOOL bEnabled)
-{
- EnableControlsArray(hWndDlg, (WORD*)&wMraAntiSpamControlsList, SIZEOF(wMraAntiSpamControlsList), bEnabled);
- EnableWindow(GetDlgItem(hWndDlg, IDC_DELETE_SPAMBOT_CONTACT), (bEnabled && IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_CHK_TEMP_CONTACTS)));
-}
-
-INT_PTR CALLBACK MraAntiSpamDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- CMraProto *ppro = (CMraProto*)GetWindowLongPtr(hWndDlg, GWLP_USERDATA);
-
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hWndDlg);
- SetWindowLongPtr(hWndDlg, GWLP_USERDATA, lParam);
- ppro = (CMraProto*)lParam;
-
- CHECK_DLG_BUTTON(hWndDlg, IDC_ENABLE, ppro->getByte("AntiSpamEnable", MRA_ANTISPAM_DEFAULT_ENABLE));
- CHECK_DLG_BUTTON(hWndDlg, IDC_CHK_TEMP_CONTACTS, ppro->getByte("AntiSpamCheckTempContacts", MRA_ANTISPAM_DEFAULT_CHK_TEMP_CONTACTS));
- CHECK_DLG_BUTTON(hWndDlg, IDC_DELETE_SPAMBOT_CONTACT, ppro->getByte("AntiSpamDeteleSpamBotContacts", MRA_ANTISPAM_DEFAULT_DELETE_SPAMBOT_CONTACT));
- CHECK_DLG_BUTTON(hWndDlg, IDC_CLN_NON_ALPHNUM, ppro->getByte("AntiSpamCleanNonAlphaNumeric", MRA_ANTISPAM_DEFAULT_CLN_NON_ALPHNUM));
- SetDlgItemInt(hWndDlg, IDC_MAX_LANG_CHANGES, ppro->getDword("AntiSpamMaxLangChanges", MRA_ANTISPAM_DEFAULT_MAX_LNG_CHANGES), FALSE);
- CHECK_DLG_BUTTON(hWndDlg, IDC_SHOWPOPUP, ppro->getByte("AntiSpamShowPopUp", MRA_ANTISPAM_DEFAULT_SHOWPOP));
- CHECK_DLG_BUTTON(hWndDlg, IDC_WRITETOSYSTEMHISTORY, ppro->getByte("AntiSpamWriteToSystemHistory", MRA_ANTISPAM_DEFAULT_WRITETOSYSTEMHISTORY));
- CHECK_DLG_BUTTON(hWndDlg, IDC_SEND_SPAM_REPORT_TO_SERVER, ppro->getByte("AntiSpamSendSpamReportToSrv", MRA_ANTISPAM_DEFAULT_SEND_SPAM_REPORT_TO_SERVER));
- {
- // fill list
- char szSettingName[MAX_PATH];
- CMStringW wszBuff;
-
- SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BAD_WORDS_LIST, LB_RESETCONTENT, 0, 0);
- SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BAD_WORDS_LIST, LB_INITSTORAGE, (WPARAM)1024, (LPARAM)32768);
- for (size_t i = 0; TRUE; i++) {
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "AntiSpamBadWord %lu", i);
- if (ppro->mraGetStringW(NULL, szSettingName, wszBuff)) {
- if (SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BAD_WORDS_LIST, LB_FINDSTRING, -1, (LPARAM)wszBuff.c_str()) == LB_ERR)
- SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BAD_WORDS_LIST, LB_ADDSTRING, 0, (LPARAM)wszBuff.c_str());
- }
- else break;
- }
- }
-
- MraAntiSpamEnableControls(hWndDlg, IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_ENABLE));
- return TRUE;
-
- case WM_COMMAND:
- if (LOWORD(wParam) == IDC_ENABLE)
- MraAntiSpamEnableControls(hWndDlg, IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_ENABLE));
-
- if (LOWORD(wParam) == IDC_CHK_TEMP_CONTACTS)
- EnableWindow(GetDlgItem(hWndDlg, IDC_DELETE_SPAMBOT_CONTACT), IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_CHK_TEMP_CONTACTS));
-
- if (LOWORD(wParam) == IDC_BUTTON_ADD) {
- WCHAR szBadWord[MAX_PATH];
-
- if (GET_DLG_ITEM_TEXT(hWndDlg, IDC_EDIT_BAD_WORD, szBadWord, SIZEOF(szBadWord))) {
- SET_DLG_ITEM_TEXTW(hWndDlg, IDC_EDIT_BAD_WORD, L"");
- if (SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BAD_WORDS_LIST, LB_FINDSTRING, -1, (LPARAM)szBadWord) == LB_ERR) SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BAD_WORDS_LIST, LB_ADDSTRING, 0, (LPARAM)szBadWord);
- }
- }
-
- if (LOWORD(wParam) == IDC_BUTTONREMOVE)
- SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BAD_WORDS_LIST, LB_DELETESTRING, SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BAD_WORDS_LIST, LB_GETCURSEL, 0, 0), 0);
-
- if (LOWORD(wParam) == IDC_BUTTON_DEFAULT) {
- MraAntiSpamResetBadWordsList();
-
- char szSettingName[MAX_PATH];
- CMStringW wszBuff;
-
- SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BAD_WORDS_LIST, LB_RESETCONTENT, 0, 0);
- SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BAD_WORDS_LIST, LB_INITSTORAGE, (WPARAM)1024, (LPARAM)32768);
- for (size_t i = 0;TRUE;i++) {
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "AntiSpamBadWord %lu", i);
- if (ppro->mraGetStringW(NULL, szSettingName, wszBuff)) {
- if (SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BAD_WORDS_LIST, LB_FINDSTRING, -1, (LPARAM)wszBuff.c_str()) == LB_ERR)
- SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BAD_WORDS_LIST, LB_ADDSTRING, 0, (LPARAM)wszBuff.c_str());
- }
- else break;
- }
- MraAntiSpamLoadBadWordsW();
- }
-
- if ((LOWORD(wParam) == IDC_EDIT_BAD_WORD) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0;
- SendMessage(GetParent(hWndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- {
- char szSettingName[MAX_PATH];
- WCHAR szBadWord[MAX_PATH];
- size_t i, dwCount;
-
- ppro->setByte("AntiSpamEnable", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_ENABLE));
- ppro->setByte("AntiSpamCheckTempContacts", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_CHK_TEMP_CONTACTS));
- ppro->setByte("AntiSpamDeteleSpamBotContacts", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_DELETE_SPAMBOT_CONTACT));
- ppro->setByte("AntiSpamCleanNonAlphaNumeric", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_CLN_NON_ALPHNUM));
- ppro->setDword("AntiSpamMaxLangChanges", (DWORD)GetDlgItemInt(hWndDlg, IDC_MAX_LANG_CHANGES, NULL, FALSE));
- ppro->setByte("AntiSpamShowPopUp", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_SHOWPOPUP));
- ppro->setByte("AntiSpamWriteToSystemHistory", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_WRITETOSYSTEMHISTORY));
- ppro->setByte("AntiSpamSendSpamReportToSrv", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_SEND_SPAM_REPORT_TO_SERVER));
-
- dwCount = SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BAD_WORDS_LIST, LB_GETCOUNT, 0, 0);
- for (i = 0; i < dwCount; i++) {
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "AntiSpamBadWord %lu", i);
- SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_BAD_WORDS_LIST, LB_GETTEXT, i, (LPARAM)szBadWord);
- ppro->mraSetStringW(NULL, szSettingName, szBadWord);
- }
-
- dwCount = ((i*2)+1024);
- for (; i < dwCount; i++) {
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "AntiSpamBadWord %lu", i);
- ppro->delSetting(szSettingName);
- }
-
- MraAntiSpamLoadBadWordsW();
- }
- return TRUE;
- }
- break;
- }
- return FALSE;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-static LPWSTR lpwszBadWords[] =
-{
- // web words
- L"@", L"http://", L"ftp://", L"www", L"wap.", L".com", L".org", L".info", L".net", L".ua", L".uz", L".to", L".biz", L".vu", L".ru", L"mailto:", L"ICQ", L"SKYPE",
-
- // spam words
- L"sex", L"seks", L"sekc", L"xxx", L"phorno", L"video", L"photo", L"SMS", L"WMZ", L"WMR", L"narod", L"ucoz", L"ref", L"Agent", L"+7", L"495", L"$", L"spam", L"URL", L"%2E",
-
- // spam words rus
- L"прода", L"цена", L"деньги", L"денег", L"секс", L"лесби", L"лезби", L"анал", L"порн", L"эротич", L"видео", L"фильм", L"кино", L"муз", L"фотки", L"фото", L"СМС", L"аськ", L"база", L"сайт", L"проект", L"рассылк", L"обьявлен", L"реклам", L"услуг", L"оплат", L"заказ", L"пиши", L"звони", L"работ", L"зараб", L"зайди", L"загляни", L"посети", L"посмотр", L"погляд", L"точка", L"тчк", L"спам", L"ссылк", L"майл", L"агент", L"супер", L"лох", L"регистрац", L"троян", L"вирус", L"взлом",
-
- // executable
- L".ade", L".adp", L".bas", L".bat", L".chm", L".cmd", L".com", L".cpl", L".crt", L".exe", L".hlp", L".hta", L".inf", L".ins", L".isp", L".js", L".jse", L".lnk", L".mdb", L".mde", L".msc", L".msi", L".msp", L".mst", L".pcd", L".pif", L".reg", L".scr", L".sct", L".shs", L".shb", L".url", L".vb", L".vbe", L".vbs", L".wsc", L".wsf", L".wsh",
-
- // archives
- L".zip", L".rar", L".cab", L".arj", L".tar", L".gz", L".zoo", L".lzh", L".jar", L".ace", L".z", L".iso", L".bz2", L".uue", L".gzip",
-
- NULL
-};
-
-void MraAntiSpamResetBadWordsList()
-{
- char szSettingName[MAX_PATH];
- size_t i, dwMax;
-
- for (i = 0; lpwszBadWords[i]; i++) {
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "AntiSpamBadWord %lu", i);
- db_set_ws(NULL, "MRA", szSettingName, lpwszBadWords[i]);
- }
-
- dwMax = (i+1024);
- for (; i < dwMax; i++) {
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "AntiSpamBadWord %lu", i);
- db_unset(NULL, "MRA", szSettingName);
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-static WCHAR lpwszExceptedChars[] = L"\r\n .,<>//?;:'\"\\][}{`-=~!@#$%^&*()_+№1234567890";
-
-BOOL MraAntiSpamIsCharExcepted(WCHAR wcTestChar)
-{
- for (size_t i = 0; i < SIZEOF(lpwszExceptedChars); i++)
- if (lpwszExceptedChars[i] == wcTestChar)
- return TRUE;
-
- return FALSE;
-}
-
-size_t MraAntiSpamCalcLangChanges(const CMStringW &wszMessage)
-{
- size_t dwRet = 0;
-
- if (!wszMessage.IsEmpty()) {
- WCHAR wcPrevChar = 0;
- for (size_t i = 1; i < wszMessage.GetLength(); i++) {
- if (MraAntiSpamIsCharExcepted(wszMessage[i]) == FALSE) {
- if (wcPrevChar)
- if ( (max(wcPrevChar, wszMessage[i])-min(wcPrevChar, wszMessage[i])) > 255)
- dwRet++;
-
- wcPrevChar = wszMessage[i];
- }
- }
- }
-
- return dwRet;
-}
-
-size_t MraAntiSpamCleanNonAlphaNumeric(LPWSTR lpwszMessage, size_t dwMessageSize)
-{
- size_t dwRet = 0;
-
- if (lpwszMessage && dwMessageSize) {
- LPWSTR lpwszCurWritePos = lpwszMessage;
- for (size_t i = 0;i<dwMessageSize;i++)
- if (IsCharAlphaNumeric(lpwszMessage[i]))
- *lpwszCurWritePos++ = lpwszMessage[i];
-
- *lpwszCurWritePos = 0;
- dwRet = lpwszCurWritePos - lpwszMessage;
- }
- return dwRet;
-}
-
-
-bool MraAntiSpamTestMessageForBadWordsW(const CMStringW &wszMessage)
-{
- if (!wszMessage.IsEmpty())
- for (size_t i = 0; i < dwBadWordsCount; i++)
- if ( wcsstr(wszMessage, pmabwBadWords[i].lpwszBadWord))
- return true;
-
- return false;
-}
-
-bool CMraProto::MraAntiSpamHasMessageBadWordsW(const CMStringW &wszMessage)
-{
- bool bRet = false;
-
- if (!wszMessage.IsEmpty()) {
- CMStringW wszMessageConverted = wszMessage;
- wszMessageConverted.MakeLower();
-
- // 1 проход: считаем колличество переключений языка
- size_t dwtm = getDword("AntiSpamMaxLangChanges", MRA_ANTISPAM_DEFAULT_MAX_LNG_CHANGES);
- if (dwtm)
- if (dwtm <= MraAntiSpamCalcLangChanges(wszMessageConverted))
- bRet = true;
-
- // 2 проход: ищем плохие слова
- if (bRet == false)
- bRet = MraAntiSpamTestMessageForBadWordsW(wszMessageConverted);
-
- // 3 проход: оставляем только буквы + цифры и снова ищем плохие слова
- if (bRet == false)
- if (getByte("AntiSpamCleanNonAlphaNumeric", MRA_ANTISPAM_DEFAULT_ENABLE)) {
- MraAntiSpamCleanNonAlphaNumeric(wszMessageConverted.GetBuffer(), wszMessageConverted.GetLength());
- bRet = MraAntiSpamTestMessageForBadWordsW(wszMessageConverted);
- }
- }
- return bRet;
-}
-
-DWORD CMraProto::MraAntiSpamReceivedMessageW(const CMStringA &szEmail, DWORD dwMessageFlags, const CMStringW &wszMessage)
-{
- DWORD dwRet = MESSAGE_NOT_SPAM;;
-
- if ((dwMessageFlags&(MESSAGE_FLAG_SYSTEM|MESSAGE_FLAG_CONTACT|MESSAGE_FLAG_NOTIFY|MESSAGE_FLAG_SMS|MESSAGE_SMS_DELIVERY_REPORT|MESSAGE_FLAG_ALARM|MESSAGE_FLAG_MULTICHAT)) == 0)
- if (getByte("AntiSpamEnable", MRA_ANTISPAM_DEFAULT_ENABLE))
- if (IsEMailChatAgent(szEmail) == FALSE) { // enabled, message must be checked
- BOOL bCheckMessage = TRUE;
- dwRet = MESSAGE_SPAM;
- HANDLE hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL);
- if (hContact) {
- DWORD dwID, dwGroupID, dwContactFlag, dwContactSeverFlags;
- GetContactBasicInfoW(hContact, &dwID, &dwGroupID, &dwContactFlag, &dwContactSeverFlags, NULL, NULL, NULL, NULL);
-
- // not temp contact, OK
- if ((dwID != -1 && db_get_b(hContact, "CList", "NotOnList", 0) == 0) || dwGroupID == -2) {
- bCheckMessage = FALSE;
- dwRet = MESSAGE_NOT_SPAM;
- }
- else { // temp contact
- if (getByte("AntiSpamCheckTempContacts", MRA_ANTISPAM_DEFAULT_CHK_TEMP_CONTACTS) == FALSE ||
- (((dwMessageFlags&MESSAGE_FLAG_AUTHORIZE) && getByte("AutoAuthGrandNewUsers", MRA_DEFAULT_AUTO_AUTH_GRAND_NEW_USERS) && getByte("AutoAuthGrandNewUsersDisableSPAMCheck", MRA_DEFAULT_AUTO_AUTH_GRAND_NEW_USERS_DISABLE_SPAM_CHECK))))
- {// проверка временного контакта
- bCheckMessage = FALSE;
- dwRet = MESSAGE_NOT_SPAM;
- }
- }
- }
-
- if (bCheckMessage)
- if (MraAntiSpamHasMessageBadWordsW(wszMessage) == FALSE)
- dwRet = MESSAGE_NOT_SPAM;
-
- if (dwRet == MESSAGE_SPAM) {
- BOOL bAntiSpamShowPopup, bAntiSpamWriteToSystemHistory, bAntiSpamDeteleSpamBotContacts;
-
- bAntiSpamShowPopup = (BOOL)getByte("AntiSpamShowPopUp", MRA_ANTISPAM_DEFAULT_SHOWPOP);
- bAntiSpamWriteToSystemHistory = (BOOL)getByte("AntiSpamWriteToSystemHistory", MRA_ANTISPAM_DEFAULT_WRITETOSYSTEMHISTORY);
- bAntiSpamDeteleSpamBotContacts = (BOOL)getByte("AntiSpamDeteleSpamBotContacts", MRA_ANTISPAM_DEFAULT_DELETE_SPAMBOT_CONTACT);
-
- if (bAntiSpamShowPopup || bAntiSpamWriteToSystemHistory) {
- WCHAR wszBuff[MRA_MAXLENOFMESSAGE*2];
- size_t dwDBMessageSize;
-
- char szTmp[MAX_PATH];
- memmove(szTmp, szEmail, szEmail.GetLength());
- *((WORD*)(szTmp+szEmail.GetLength())) = 0;
-
- dwDBMessageSize = mir_sntprintf(wszBuff, SIZEOF(wszBuff), L"%s: %S\r\n", TranslateW(L"Spam bot blocked"), szEmail);
- DWORD dwMessageSize = wszMessage.GetLength();
- if (dwMessageSize > (SIZEOF(wszBuff)-(dwDBMessageSize+sizeof(DWORD))))
- dwMessageSize = (SIZEOF(wszBuff)-(dwDBMessageSize+sizeof(DWORD)));
- memmove(wszBuff+dwDBMessageSize, wszMessage, (dwMessageSize*sizeof(WCHAR)));
- dwDBMessageSize += dwMessageSize;
- *((DWORD*)(wszBuff+dwDBMessageSize)) = 0;
- dwDBMessageSize += sizeof(DWORD);
-
- if (bAntiSpamShowPopup)
- MraPopupShowFromAgentW(MRA_POPUP_TYPE_INFORMATION, 0, wszBuff);
-
- if (bAntiSpamWriteToSystemHistory) {
- CHAR szBuff[MRA_MAXLENOFMESSAGE*2];
- WideCharToMultiByte(CP_UTF8, 0, wszBuff, DWORD(dwDBMessageSize), szBuff, SIZEOF(szBuff), NULL, NULL);
-
- DBEVENTINFO dbei = { sizeof(dbei) };
- dbei.szModule = m_szModuleName;
- dbei.timestamp = _time32(NULL);
- dbei.flags = (DBEF_READ|DBEF_UTF);
- dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.cbBlob = DWORD(dwDBMessageSize*sizeof(WCHAR));
- dbei.pBlob = (PBYTE)szBuff;
- db_event_add(NULL, &dbei);
- }
-
- if (hContact && bAntiSpamDeteleSpamBotContacts) {
- dwDBMessageSize = mir_sntprintf(wszBuff, SIZEOF(wszBuff), L"%s: %S", TranslateW(L"Spam bot contact deleted"), szEmail);
-
- if (bAntiSpamShowPopup)
- MraPopupShowFromAgentW(MRA_POPUP_TYPE_INFORMATION, 0, wszBuff);
-
- if (bAntiSpamWriteToSystemHistory) {
- (*((DWORD*)(wszBuff+dwDBMessageSize))) = 0;
- dwDBMessageSize += sizeof(DWORD);
-
- CHAR szBuff[MRA_MAXLENOFMESSAGE*2];
- WideCharToMultiByte(CP_UTF8, 0, wszBuff, DWORD(dwDBMessageSize), szBuff, SIZEOF(szBuff), NULL, NULL);
-
- DBEVENTINFO dbei = { sizeof(dbei) };
- dbei.szModule = m_szModuleName;
- dbei.timestamp = _time32(NULL);
- dbei.flags = (DBEF_READ|DBEF_UTF);
- dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.cbBlob = DWORD(dwDBMessageSize*sizeof(WCHAR));
- dbei.pBlob = (PBYTE)szBuff;
- db_event_add(NULL, &dbei);
- }
- }
- }
-
- if (hContact && bAntiSpamDeteleSpamBotContacts)
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
- }
- }
- return dwRet;
-}
diff --git a/protocols/MRA/src/MraAntiSpam.h b/protocols/MRA/src/MraAntiSpam.h deleted file mode 100644 index 7549e308c3..0000000000 --- a/protocols/MRA/src/MraAntiSpam.h +++ /dev/null @@ -1,16 +0,0 @@ -#if !defined(AFX_MRA_ANTISPAM_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_)
-#define AFX_MRA_ANTISPAM_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_
-
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-size_t MraAntiSpamLoadBadWordsW();
-void MraAntiSpamFreeBadWords();
-
-INT_PTR CALLBACK MraAntiSpamDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
-void MraAntiSpamResetBadWordsList();
-
-#endif // !defined(AFX_MRA_ANTISPAM_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_)
diff --git a/protocols/MRA/src/MraConstans.h b/protocols/MRA/src/MraConstans.h index 021294e93a..00c6bb6f0f 100644 --- a/protocols/MRA/src/MraConstans.h +++ b/protocols/MRA/src/MraConstans.h @@ -166,7 +166,6 @@ static const LPSTR lpcszMailRuDomains[] = #define MRA_DEFAULT_AUTO_AUTH_REQ_ON_LOGON FALSE
#define MRA_DEFAULT_AUTO_AUTH_GRAND_IN_CLIST FALSE
#define MRA_DEFAULT_AUTO_AUTH_GRAND_NEW_USERS FALSE
-#define MRA_DEFAULT_AUTO_AUTH_GRAND_NEW_USERS_DISABLE_SPAM_CHECK FALSE
#define MRA_DEFAULT_SLOW_SEND TRUE
#define MRA_DEFAULT_CVT_SMILES_TO_TAGS TRUE
#define MRA_DEFAULT_MIRVER_RAW FALSE // hidden option
@@ -193,15 +192,6 @@ static const LPSTR lpcszMailRuDomains[] = #define MRA_DEFAULT_TRAYICON_NEW_MAIL_NOTIFY FALSE
#define MRA_DEFAULT_TRAYICON_NEW_MAIL_CLK_TO_INBOX FALSE
-#define MRA_ANTISPAM_DEFAULT_ENABLE TRUE
-#define MRA_ANTISPAM_DEFAULT_CHK_TEMP_CONTACTS TRUE
-#define MRA_ANTISPAM_DEFAULT_DELETE_SPAMBOT_CONTACT FALSE
-#define MRA_ANTISPAM_DEFAULT_CLN_NON_ALPHNUM TRUE
-#define MRA_ANTISPAM_DEFAULT_MAX_LNG_CHANGES 5
-#define MRA_ANTISPAM_DEFAULT_SHOWPOP TRUE
-#define MRA_ANTISPAM_DEFAULT_WRITETOSYSTEMHISTORY TRUE
-#define MRA_ANTISPAM_DEFAULT_SEND_SPAM_REPORT_TO_SERVER TRUE
-
#define MRA_AVT_DEFAULT_ENABLE TRUE
#define MRA_AVT_DEFAULT_WRK_THREAD_COUNTS 4 // hidden
#define MRA_AVT_DEFAULT_SERVER "obraz.foto.mail.ru"
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index ddf7117766..a152547caf 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -286,12 +286,6 @@ struct CMraProto : public PROTO<CMraProto> void SetExtraIcons(HANDLE hContact);
- #define MESSAGE_NOT_SPAM 1
- #define MESSAGE_SPAM 2
-
- DWORD MraAntiSpamReceivedMessageW(const CMStringA &szEmail, DWORD dwMessageFlags, const CMStringW &wszMessage);
- bool MraAntiSpamHasMessageBadWordsW(const CMStringW &wszMessage);
-
void InitMainMenu();
void InitContactMenu();
void CListCreateMenu(LONG lPosition, LONG lPopupPosition, HICON hMainIcon, LPSTR pszContactOwner, BOOL bIsStatus, const struct GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount, HGENMENU *hResult);
diff --git a/protocols/MRA/src/Mra_options.cpp b/protocols/MRA/src/Mra_options.cpp index e4ae3f5eab..2c0e46a329 100644 --- a/protocols/MRA/src/Mra_options.cpp +++ b/protocols/MRA/src/Mra_options.cpp @@ -127,8 +127,6 @@ INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, L CHECK_DLG_BUTTON(hWndDlg, IDC_AUTO_AUTH_REQ_ON_LOGON, ppro->getByte("AutoAuthRequestOnLogon", MRA_DEFAULT_AUTO_AUTH_REQ_ON_LOGON));
CHECK_DLG_BUTTON(hWndDlg, IDC_AUTO_AUTH_GRAND_IN_CLIST, ppro->getByte("AutoAuthGrandUsersInCList", MRA_DEFAULT_AUTO_AUTH_GRAND_IN_CLIST));
CHECK_DLG_BUTTON(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS, ppro->getByte("AutoAuthGrandNewUsers", MRA_DEFAULT_AUTO_AUTH_GRAND_NEW_USERS));
- CHECK_DLG_BUTTON(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS_DISABLE_SPAM_CHECK, ppro->getByte("AutoAuthGrandNewUsersDisableSPAMCheck", MRA_DEFAULT_AUTO_AUTH_GRAND_NEW_USERS_DISABLE_SPAM_CHECK));
- EnableWindow(GetDlgItem(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS_DISABLE_SPAM_CHECK), IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS));
CHECK_DLG_BUTTON(hWndDlg, IDC_SLOWSEND, ppro->getByte("SlowSend", MRA_DEFAULT_SLOW_SEND));
CHECK_DLG_BUTTON(hWndDlg, IDC_INCREMENTAL_NEW_MAIL_NOTIFY, ppro->getByte("IncrementalNewMailNotify", MRA_DEFAULT_INC_NEW_MAIL_NOTIFY));
@@ -151,9 +149,6 @@ INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, L SET_DLG_ITEM_TEXTA(hWndDlg, IDC_SERVER, MRA_DEFAULT_SERVER);
SetDlgItemInt(hWndDlg, IDC_SERVERPORT, MRA_DEFAULT_SERVER_PORT, FALSE);
break;
- case IDC_AUTO_AUTH_GRAND_NEW_USERS:
- EnableWindow(GetDlgItem(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS_DISABLE_SPAM_CHECK), IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS));
- break;
case IDC_TRAYICON_NEW_MAIL_NOTIFY:
EnableWindow(GetDlgItem(hWndDlg, IDC_TRAYICON_NEW_MAIL_NOTIFY_CLICK_TO_INBOX), IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_TRAYICON_NEW_MAIL_NOTIFY));
break;
@@ -201,7 +196,6 @@ INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, L ppro->setByte("AutoAuthRequestOnLogon", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_AUTO_AUTH_REQ_ON_LOGON));
ppro->setByte("AutoAuthGrandUsersInCList", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_AUTO_AUTH_GRAND_IN_CLIST));
ppro->setByte("AutoAuthGrandNewUsers", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS));
- ppro->setByte("AutoAuthGrandNewUsersDisableSPAMCheck", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS_DISABLE_SPAM_CHECK));
ppro->setByte("SlowSend", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_SLOWSEND));
ppro->setByte("IncrementalNewMailNotify", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_INCREMENTAL_NEW_MAIL_NOTIFY));
@@ -238,11 +232,6 @@ int CMraProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = DlgProcOptsConnections;
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Anti-spam");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ANTISPAM);
- odp.pfnDlgProc = MraAntiSpamDlgProcOpts;
- Options_AddPage(wParam, &odp);
-
odp.ptszTab = LPGENT("Files");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FILES);
odp.pfnDlgProc = MraFilesQueueDlgProcOpts;
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index c2991d9244..38dc8ee104 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -5,7 +5,7 @@ DWORD CMraProto::StartConnect()
{
- if ( !InterlockedExchangeAdd((volatile LONG*)&masMraSettings.dwGlobalPluginRunning, 0))
+ if (!masMraSettings.dwGlobalPluginRunning)
return ERROR_OPERATION_ABORTED;
// поток ещё/уже не работал, поставили статус что работает и запускаем
@@ -1711,10 +1711,6 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, CMStringA & Netlib_Logf(m_hNetlibUser, "Processing message: %08X, from '%s', text '%S'\n", dwFlags, plpsFrom.c_str(), wszMessage.c_str());
// processing
- if (dwRetErrorCode == NO_ERROR)
- if (MraAntiSpamReceivedMessageW(plpsFrom, dwFlags, wszMessage) != MESSAGE_NOT_SPAM)
- return ERROR_ACCESS_DENIED;
-
if (dwFlags & (MESSAGE_FLAG_SMS | MESSAGE_SMS_DELIVERY_REPORT)) {// SMS //if (IsPhone(plpsFrom->lpszData, plpsFrom->dwSize))
INTERNET_TIME itTime;
InternetTimeGetCurrentTime(&itTime);
diff --git a/protocols/MRA/src/proto.h b/protocols/MRA/src/proto.h index 9e6cab5050..9bcce264ef 100644 --- a/protocols/MRA/src/proto.h +++ b/protocols/MRA/src/proto.h @@ -61,7 +61,7 @@ mrim_packet_header_t; #define MESSAGE_SMS_DELIVERY_REPORT 0x00002000
#define MESSAGE_FLAG_ALARM 0x00004000
#define MESSAGE_FLAG_FLASH 0x00008000
- #define MESSAGE_FLAG_SPAMF_SPAM 0x00020000 // чтобы пожаловатся на спам - вернуть назад с этим флагом ;клиенту игнорировать, ставится в момент обработки сообщения при передаче внутри кластера
+ #define MESSAGE_FLAG_SPAMF_SPAM 0x00020000 // report spam back to the server
#define MESSAGE_FLAG_MULTICHAT 0x00400000 //
#define MULTICHAT_MESSAGE 0 // received message (s->c)
#define MULTICHAT_GET_MEMBERS 1 // request members list from server (c->s)
diff --git a/protocols/MRA/src/resource.h b/protocols/MRA/src/resource.h index 103ca8e88b..a7a0affabb 100644 --- a/protocols/MRA/src/resource.h +++ b/protocols/MRA/src/resource.h @@ -28,7 +28,6 @@ #define IDD_MRAACCOUNT 129
#define IDI_ICON1 130
#define IDI_MRA_ALARM 130
-#define IDD_OPT_ANTISPAM 131
#define IDI_MRA_VIDEO 132
#define IDI_MRA_ANSWERS 133
#define IDI_MRA_WORLD 134
@@ -53,28 +52,22 @@ #define IDC_AUTO_ADD_CONTACTS_TO_SERVER 1009
#define IDC_FILE_SEND_NOOUTCONNECTIONONSEND 1010
#define IDC_AUTO_AUTH_REQ_ON_LOGON 1010
-#define IDC_SHOWPOPUP 1010
#define IDC_KEEPALIVE 1011
#define IDC_FILE_SEND_NOOUTCONNECTIONONRECEIVE 1011
#define IDC_LIST_EMAILS 1011
#define IDC_TRAYICON_NEW_MAIL_NOTIFY 1011
-#define IDC_WRITETOSYSTEMHISTORY 1011
#define IDC_FILE_SEND_IGNORYADDITIONALPORTS 1012
#define IDC_RTF_RECEIVE_ENABLE 1012
-#define IDC_CHK_TEMP_CONTACTS 1012
#define IDC_DELETE_SPAMBOT_CONTACT 1013
#define IDC_RTF_SEND_SMART 1013
#define IDC_COMBO_PHONE 1014
#define IDC_TRAYICON_NEW_MAIL_NOTIFY_CLICK_TO_INBOX 1014
#define IDC_FILE_SEND_ENABLE_DIRECT_CONN 1014
-#define IDC_SEND_SPAM_REPORT_TO_SERVER 1014
#define IDC_EDIT_TEXT 1015
#define IDC_FILE_SEND_ENABLE_MRIMPROXY_CONS 1015
#define IDC_AUTO_AUTH_GRAND_IN_CLIST 1015
-#define IDC_CLN_NON_ALPHNUM 1015
#define IDC_AUTO_AUTH_GRAND_NEW_USERS 1016
#define IDC_OPTIONSTAB 1017
-#define IDC_AUTO_AUTH_GRAND_NEW_USERS_DISABLE_SPAM_CHECK 1017
#define IDC_NEW_ACCOUNT_LINK 1018
#define IDC_LOOKUPLINK 1019
#define IDC_PASSWORD 1020
@@ -90,10 +83,6 @@ #define IDC_PREVIEW 1029
#define IDC_USE_KEEPALIVE_CONN 1030
#define IDC_BUTTON_FONT 1031
-#define IDC_BAD_WORDS_LIST 1032
-#define IDC_EDIT_BAD_WORD 1033
-#define IDC_BUTTON_ADD 1034
-#define IDC_BUTTONREMOVE 1035
#define IDC_EMAIL_USER 1048
#define IDC_EMAIL_DOMAIN 1049
#define IDC_NICK 1053
@@ -105,7 +94,6 @@ #define IDC_CITY 1064
#define IDC_XTITLE 1065
#define IDC_XMSG 1066
-#define IDC_MAX_LANG_CHANGES 1071
#define IDC_USER_BLOG_STATUS_MSG 1072
#define IDC_MSG_TO_SEND 1073
#define IDC_CHK_NOTIFY 1074
diff --git a/protocols/MRA/src/version.h b/protocols/MRA/src/version.h index 85381a098d..30cb871352 100644 --- a/protocols/MRA/src/version.h +++ b/protocols/MRA/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 2
#define __MINOR_VERSION 1
#define __RELEASE_NUM 0
-#define __BUILD_NUM 3
+#define __BUILD_NUM 4
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
|