summaryrefslogtreecommitdiff
path: root/stopspam.cpp
diff options
context:
space:
mode:
authorSergey (Elzor) Bolhovskoy <elzor@foobar2000.ru>2010-04-20 18:27:02 +0600
committerSergey (Elzor) Bolhovskoy <elzor@foobar2000.ru>2010-04-20 18:27:02 +0600
commit4171b515e6478dfb70b21dcc255c4eb719bd4c89 (patch)
tree86fa9b6cbbc5bf1422fc1216f948a4a3abe3b196 /stopspam.cpp
parent20dbac49450a6e1593c413dae34ef6e7fcb04a01 (diff)
URL blocking work for ANSI events, test for URL content are optimized
Diffstat (limited to 'stopspam.cpp')
-rw-r--r--stopspam.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/stopspam.cpp b/stopspam.cpp
index 07aee1e..e0ee3f6 100644
--- a/stopspam.cpp
+++ b/stopspam.cpp
@@ -49,13 +49,8 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam)
DBWriteContactSettingTString(hcntct, "CList", "Group", gbSpammersGroup.c_str());
BYTE msg = 1;
if(gbIgnoreURL){
- TCHAR* EventText = ReqGetText(&dbei); //work only UTF, else return NULL
- if(EventText&&_tcslen(EventText) > 0)
- if(Stristr(EventText, _T("http")) || Stristr(EventText, _T("www")) || Stristr(EventText, _T(".ru")) || Stristr(EventText, _T(".com")) || Stristr(EventText, _T(".de")) || Stristr(EventText, _T(".cz")) || Stristr(EventText, _T(".org")) || Stristr(EventText, _T(".net")) || Stristr(EventText, _T(".su")))
- {
- mir_free(EventText);
- msg=0;
- };
+ TCHAR* EventText = ReqGetText(&dbei); //else return NULL
+ msg=!IsUrlContains(EventText);
mir_free(EventText);
};
if(gbInvisDisable)
@@ -202,13 +197,11 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l)
}
return 0;
}
-
- if(gbIgnoreURL)
- if((message.find_first_of(_T("http"),0) != std::string::npos) || (message.find_first_of(_T("www"),0) != std::string::npos) || (message.find_first_of(_T(".ru"),0) != std::string::npos) || (message.find_first_of(_T(".com"),0) != std::string::npos) || (message.find_first_of(_T(".de"),0) != std::string::npos) || (message.find_first_of(_T(".cz"),0) != std::string::npos) || (message.find_first_of(_T(".org"),0) != std::string::npos) || (message.find_first_of(_T(".net"),0) != std::string::npos) || (message.find_first_of(_T(".su"),0) != std::string::npos))
- ;
+ // URL contains check
+ msg=(msg&&gbIgnoreURL)?(!IsUrlContains((TCHAR *) message.c_str())):msg;
// if message message does not contain infintite talk protection prefix
// and question count for this contact is less then maximum
- else if(msg)
+ if(msg)
{
if((!gbInfTalkProtection || tstring::npos==message.find(_T("StopSpam automatic message:\r\n")))
&& (!gbMaxQuestCount || DBGetContactSettingDword(hContact, pluginName, "QuestionCount", 0) < gbMaxQuestCount))