summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@list.ru>2009-10-08 10:42:43 +0300
committerGluzskiy Alexandr <sss123next@list.ru>2009-10-08 10:42:43 +0300
commit7b3818d042772e56dd0f2a59a99baf464d415f29 (patch)
treec6738a6a7e9fd9be1810ea10310b31bcc432e780
parent87b995d5072d116917c2cb571e0f10554e0f434d (diff)
fixed invis mode
-rw-r--r--stopspam_mod/trunk/stopspam.cpp100
1 files changed, 50 insertions, 50 deletions
diff --git a/stopspam_mod/trunk/stopspam.cpp b/stopspam_mod/trunk/stopspam.cpp
index 035d3d9..e3cdae7 100644
--- a/stopspam_mod/trunk/stopspam.cpp
+++ b/stopspam_mod/trunk/stopspam.cpp
@@ -61,20 +61,16 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam)
if(gbSpecialGroup)
DBWriteContactSettingTString(hcntct, "CList", "Group", gbSpammersGroup.c_str());
- BYTE msg = 0;
- if(!gbInvisDisable)
- msg = 1;
- else if(gbInvisDisable)
+ BYTE msg = 1;
+ if(gbInvisDisable)
{
- if(CallProtoService(dbei.szModule, PS_GETSTATUS, 0, 0) != ID_STATUS_INVISIBLE)
- msg = 1;
- else if(DBGetContactSettingWord(hContact,dbei.szModule,"ApparentMode",0) != ID_STATUS_OFFLINE)
- msg = 1;
+ if(CallProtoService(dbei.szModule, PS_GETSTATUS, 0, 0) == ID_STATUS_INVISIBLE)
+ msg = 0;
+ else if(DBGetContactSettingWord(hContact,dbei.szModule,"ApparentMode",0) == ID_STATUS_OFFLINE)
+ msg = 0; //is it useful ?
}
if(msg)
- {
int a = CallService(allowService.c_str(), (WPARAM)hDbEvent, (LPARAM)(variables_parse(gbAuthRepl, hcntct).c_str()));
- }
//CallProtoService(dbei.szModule,PS_AUTHDENY,(WPARAM)hDbEvent,(LPARAM)GetAuthRepl().c_str());
delete dbei.pBlob;
@@ -168,7 +164,16 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l)
// if message contains right answer...
// if( tstring::npos!=message.find(gbAnswer) )
- int Answered = 0;
+// int Answered = 0;
+ BYTE msg = 1;
+ if(gbInvisDisable)
+ {
+ if(CallProtoService(dbei->szModule, PS_GETSTATUS, 0, 0) == ID_STATUS_INVISIBLE)
+ msg = 0;
+ else if(DBGetContactSettingWord(hContact,dbei->szModule,"ApparentMode",0) == ID_STATUS_OFFLINE)
+ msg = 0; //is it useful ?
+ }
+
if(gbCaseInsensitive?(!stricmp(message.c_str(), (variables_parse(gbAnswer, hContact).c_str()))):( !_tcscmp(message.c_str(), (variables_parse(gbAnswer, hContact).c_str()))))
{
// unhide contact
@@ -182,63 +187,58 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l)
DBDeleteContactSetting(hContact, "CList", "NotOnList");
// send congratulation
+ if(msg)
+ {
#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
+ }
// process the event
return 0;
}
- BYTE msg = 0;
- if(!gbInvisDisable)
- msg = 1;
- else if(gbInvisDisable)
- {
- if(CallProtoService(dbei->szModule, PS_GETSTATUS, 0, 0) != ID_STATUS_INVISIBLE)
- msg = 1;
- else if(DBGetContactSettingWord(hContact,dbei->szModule,"ApparentMode",0) != ID_STATUS_OFFLINE)
- msg = 1;
- }
-
// if message message does not contain infintite talk protection prefix
// and question count for this contact is less then maximum
- if((!gbInfTalkProtection || tstring::npos==message.find(_T("StopSpam automatic message:\r\n")))
- && (!gbMaxQuestCount || DBGetContactSettingDword(hContact, pluginName, "QuestionCount", 0) < gbMaxQuestCount) && msg)
+ if(msg)
{
- // send question
- tstring q = _T("StopSpam automatic message:\r\n") + variables_parse(gbQuestion, hContact);
+ if((!gbInfTalkProtection || tstring::npos==message.find(_T("StopSpam automatic message:\r\n")))
+ && (!gbMaxQuestCount || DBGetContactSettingDword(hContact, pluginName, "QuestionCount", 0) < gbMaxQuestCount))
+ {
+ // send question
+ tstring q = _T("StopSpam automatic message:\r\n") + variables_parse(gbQuestion, hContact);
#ifdef _UNICODE
- char * buf=mir_utf8encodeW(q.c_str());
- CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)buf);
- mir_free(buf);
+ char * buf=mir_utf8encodeW(q.c_str());
+ CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)buf);
+ mir_free(buf);
#else
- CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)q.c_str());
+ CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)q.c_str());
#endif
-
- // increment question count
- DWORD questCount = DBGetContactSettingDword(hContact, pluginName, "QuestionCount", 0);
- DBWriteContactSettingDword(hContact, pluginName, "QuestionCount", questCount + 1);
- }
- else
- {
- if (gbDosServiceExist)
+
+ // increment question count
+ DWORD questCount = DBGetContactSettingDword(hContact, pluginName, "QuestionCount", 0);
+ DBWriteContactSettingDword(hContact, pluginName, "QuestionCount", questCount + 1);
+ }
+ else
{
- if(gbDosServiceIntegration)
+ if (gbDosServiceExist)
{
- int i;
- i = rand()%255*13;
- CallService(MS_DOS_SERVICE, (WPARAM)hContact, (LPARAM)i);
+ if(gbDosServiceIntegration)
+ {
+ int i;
+ i = rand()%255*13;
+ CallService(MS_DOS_SERVICE, (WPARAM)hContact, (LPARAM)i);
+ }
+ }
+ if(gbIgnoreContacts)
+ {
+ DBWriteContactSettingDword(hContact, "Ignore", "Mask1", 0x0000007F);
}
- }
- if(gbIgnoreContacts)
- {
- DBWriteContactSettingDword(hContact, "Ignore", "Mask1", 0x0000007F);
}
}
if(gbHideContacts)