From 02b8498fdb1d06aa8b6f136e2914000d05f29dc2 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 15 Feb 2010 06:41:36 +0300 Subject: added option for block auth requests with URL (may not work) --- stopspam.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'stopspam.cpp') diff --git a/stopspam.cpp b/stopspam.cpp index a0c821b..0e20c2a 100644 --- a/stopspam.cpp +++ b/stopspam.cpp @@ -27,7 +27,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) } // event is an auth request - if(gbHandleAuthReq) + if(gbHandleAuthReq || gbIgnoreURL) { if(!(dbei.flags & DBEF_SENT) && !(dbei.flags & DBEF_READ) && dbei.eventType == EVENTTYPE_AUTHREQUEST) { @@ -69,6 +69,31 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) else if(DBGetContactSettingWord(hContact,dbei.szModule,"ApparentMode",0) == ID_STATUS_OFFLINE) msg = 0; //is it useful ? } + if(gbIgnoreURL) + { + tstring message; + if(dbei.flags & DBEF_UTF) + { + WCHAR* msg_u; + char* msg_a = mir_strdup(( char* )dbei.pBlob ); + mir_utf8decode( msg_a, &msg_u ); +#ifdef _UNICODE + message = msg_u; +#else + message = mir_u2a(msg_u); +#endif + } + else + { +#ifdef _UNICODE + message = mir_a2u((char*)(dbei.pBlob)); +#else + message = (char*)(dbei.pBlob); +#endif + } + if(!Stricmp(message.c_str(), _T("http:")) || !Stricmp(message.c_str(), _T("www")) || !Stricmp(message.c_str(), _T(".ru")) || !Stricmp(message.c_str(), _T(".com")) || !Stricmp(message.c_str(), _T(".de")) || !Stricmp(message.c_str(), _T(".cz")) || !Stricmp(message.c_str(), _T(".org")) || !Stricmp(message.c_str(), _T(".net")) || !Stricmp(message.c_str(), _T(".su"))) + return 1; + } if(msg) int a = CallService(allowService.c_str(), (WPARAM)hDbEvent, (LPARAM)(variables_parse(gbAuthRepl, hcntct).c_str())); -- cgit v1.2.3