summaryrefslogtreecommitdiff
path: root/stopspam.cpp
diff options
context:
space:
mode:
authorSergey (Elzor) Bolhovskoy <elzor@foobar2000.ru>2010-04-08 19:46:22 +0600
committerSergey (Elzor) Bolhovskoy <elzor@foobar2000.ru>2010-04-08 19:46:22 +0600
commitc0245a95c2bbe2e83a5514e6652ce483a70122ee (patch)
tree1957eaacd6c0b825dd17759e35514f519b84d8ca /stopspam.cpp
parentb63effd23d033036b6b07c16680d26636289ab53 (diff)
Add more options for ICQ protocol, auto remove useless messages from contact
Diffstat (limited to 'stopspam.cpp')
-rw-r--r--stopspam.cpp41
1 files changed, 30 insertions, 11 deletions
diff --git a/stopspam.cpp b/stopspam.cpp
index 8ae8d47..ede14a6 100644
--- a/stopspam.cpp
+++ b/stopspam.cpp
@@ -81,7 +81,6 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l)
{
HANDLE hContact = (HANDLE)w;
DBEVENTINFO * dbei = (DBEVENTINFO*)l;
-
// if event is in protocol that is not despammed
if(!ProtoInList(dbei->szModule))
@@ -164,16 +163,35 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l)
// send congratulation
if(msg)
{
+ tstring prot=DBGetContactSettingStringPAN(NULL,dbei->szModule,"AM_BaseProto", _T(""));
+ // for notICQ protocols or disable auto auth. reqwest
+ if((Stricmp(_T("ICQ"),prot.c_str()))||(!gbAutoReqAuth))
+ {
#ifdef _UNICODE
- char * buf=mir_utf8encodeW(variables_parse(gbCongratulation, hContact).c_str());
- CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)buf);
- mir_free(buf);
+ char * buf=mir_utf8encodeW(variables_parse(gbCongratulation, hContact).c_str());
+ CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)buf);
+ mir_free(buf);
#else
- CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)GetCongratulation().c_str());
+ CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)GetCongratulation().c_str());
#endif
+ };
+ // Note: For ANSI can be not work
+ if(!Stricmp(_T("ICQ"),prot.c_str())){
+ // grand auth.
+ if(gbAutoAuth)
+ CallProtoService(dbei->szModule, "/GrantAuth", w, 0);
+ // add contact to server list and local group
+ if(gbAutoAddToServerList)
+ {
+ DBWriteContactSettingTString(hContact, "CList", "Group", gbAutoAuthGroup.c_str());
+ CallProtoService(dbei->szModule, "/AddServerContact", w, 0);
+ DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ };
+ // auto auth. reqwest with send congratulation
+ if(gbAutoReqAuth)
+ CallContactService(hContact,PSS_AUTHREQUEST,0, (LPARAM)variables_parse(gbCongratulation, hContact).c_str());
+ }
}
-
- // process the event
return 0;
}
@@ -225,10 +243,11 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l)
DBWriteContactSettingTString(hContact, "CList", "Group", gbSpammersGroup.c_str());
DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
- // save message from contact
- dbei->flags |= DBEF_READ;
- CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)dbei);
-
+ // save first message from contact
+ if (DBGetContactSettingDword(hContact, pluginName, "QuestionCount", 0)<2){
+ dbei->flags |= DBEF_READ;
+ CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)dbei);
+ };
// reject processing of the event
return 1;
}