summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@gmail.com>2010-02-15 06:41:36 +0300
committerGluzskiy Alexandr <sss123next@gmail.com>2010-02-15 06:41:36 +0300
commit02b8498fdb1d06aa8b6f136e2914000d05f29dc2 (patch)
tree3ecb953f29318f5ba9e12fa3e2b6df1fc74e4881
parenta5f8c514a5d7da4cd7049d2439182f51d7c1c195 (diff)
added option for block auth requests with URL (may not work)
-rw-r--r--init.cpp2
-rw-r--r--options.cpp5
-rw-r--r--resource.h1
-rw-r--r--stopspam.cpp27
-rw-r--r--stopspam.h1
-rw-r--r--stopspam.rc2
6 files changed, 36 insertions, 2 deletions
diff --git a/init.cpp b/init.cpp
index ab1bf4f..a1e8499 100644
--- a/init.cpp
+++ b/init.cpp
@@ -17,6 +17,7 @@ BOOL gbDelExcluded = 0;
BOOL gbDosServiceIntegration = 0;
BOOL gbCaseInsensitive = 0;
BOOL gbInvisDisable = 0;
+BOOL gbIgnoreURL = 1;
//BOOL gbDelNotInList = 0;
tstring gbSpammersGroup = _T("Spammers");
tstring gbQuestion;
@@ -142,6 +143,7 @@ void InitVars()
gbDelExcluded = DBGetContactSettingByte(NULL, pluginName, "DelExcluded", 0);
gbCaseInsensitive = DBGetContactSettingByte(NULL, pluginName, "CaseInsensitive", 0);
gbInvisDisable = DBGetContactSettingByte(NULL, pluginName, "DisableInInvis", 0);
+ gbIgnoreURL = DBGetContactSettingByte(NULL, pluginName, "IgnoreURL", 0);
// gbDelNotInList = DBGetContactSettingByte(NULL, pluginName, "DelNotInList", 0);
}
diff --git a/options.cpp b/options.cpp
index 8928988..9ef6bcc 100644
--- a/options.cpp
+++ b/options.cpp
@@ -268,13 +268,14 @@ INT_PTR CALLBACK AdvancedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
SendDlgItemMessage(hwnd, ID_SPECIALGROUP, BM_SETCHECK, gbSpecialGroup ? BST_CHECKED : BST_UNCHECKED, 0);
SendDlgItemMessage(hwnd, ID_EXCLUDE, BM_SETCHECK, gbExclude ? BST_CHECKED : BST_UNCHECKED, 0);
SendDlgItemMessage(hwnd, ID_REMOVE_TMP, BM_SETCHECK, gbDelExcluded ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendDlgItemMessage(hwnd, ID_IGNOREURL, BM_SETCHECK, gbIgnoreURL ? BST_CHECKED : BST_UNCHECKED, 0);
}
return TRUE;
case WM_COMMAND:{
switch (LOWORD(wParam))
{
case IDC_INVIS_DISABLE: case IDC_CASE_INSENSITIVE: case ID_DOS_INTEGRATION:
- case ID_SPECIALGROUPNAME: case ID_SPECIALGROUP: case ID_EXCLUDE: case ID_REMOVE_TMP:
+ case ID_SPECIALGROUPNAME: case ID_SPECIALGROUP: case ID_EXCLUDE: case ID_REMOVE_TMP: case ID_IGNOREURL:
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
break;
@@ -334,6 +335,8 @@ INT_PTR CALLBACK AdvancedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
BST_CHECKED == SendDlgItemMessage(hwnd, ID_EXCLUDE, BM_GETCHECK, 0, 0));
DBWriteContactSettingByte(NULL, pluginName, "DelExcluded", gbDelExcluded =
BST_CHECKED == SendDlgItemMessage(hwnd, ID_REMOVE_TMP, BM_GETCHECK, 0, 0));
+ DBWriteContactSettingByte(NULL, pluginName, "IgnoreURL", gbIgnoreURL =
+ BST_CHECKED == SendDlgItemMessage(hwnd, ID_IGNOREURL, BM_GETCHECK, 0, 0));
}
return TRUE;
}
diff --git a/resource.h b/resource.h
index aece698..ad7dab5 100644
--- a/resource.h
+++ b/resource.h
@@ -40,6 +40,7 @@
#define ID_EXCLUDE 1021
#define ID_ADDPERMANENT3 1022
#define ID_DEL_NO_IN_LIST 1022
+#define ID_IGNOREURL 1023
// Next default values for new objects
//
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()));
diff --git a/stopspam.h b/stopspam.h
index 2d9777e..fd76f99 100644
--- a/stopspam.h
+++ b/stopspam.h
@@ -14,6 +14,7 @@ extern BOOL gbDosServiceIntegration;
extern BOOL gbDelNotInList;
extern BOOL gbCaseInsensitive;
extern BOOL gbInvisDisable;
+extern BOOL gbIgnoreURL;
extern tstring gbSpammersGroup;
extern tstring gbQuestion;
extern tstring gbAnswer;
diff --git a/stopspam.rc b/stopspam.rc
index 32e5e0a..f92195d 100644
--- a/stopspam.rc
+++ b/stopspam.rc
@@ -91,6 +91,8 @@ BEGIN
CONTROL "Add contacts to specified group:",ID_SPECIALGROUP,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,16,134,10
EDITTEXT ID_SPECIALGROUPNAME,159,15,79,12,ES_AUTOHSCROLL
+ CONTROL "Ignore Authorization requests with URL",ID_IGNOREURL,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,89,270,10
END