diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2009-10-02 19:05:46 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2009-10-02 19:05:46 +0300 |
commit | 87b995d5072d116917c2cb571e0f10554e0f434d (patch) | |
tree | dac85a1f0fcafb528028869d170f01c36d008a0e /stopspam_mod/trunk/stopspam.cpp | |
parent | e7d448befc6088ef7b7f6223a006edba18995c39 (diff) |
another logic fix
Diffstat (limited to 'stopspam_mod/trunk/stopspam.cpp')
-rw-r--r-- | stopspam_mod/trunk/stopspam.cpp | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/stopspam_mod/trunk/stopspam.cpp b/stopspam_mod/trunk/stopspam.cpp index 596e986..035d3d9 100644 --- a/stopspam_mod/trunk/stopspam.cpp +++ b/stopspam_mod/trunk/stopspam.cpp @@ -61,9 +61,20 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) if(gbSpecialGroup)
DBWriteContactSettingTString(hcntct, "CList", "Group", gbSpammersGroup.c_str());
- if(!gbInvisDisable || ((gbInvisDisable && (DBGetContactSettingWord(hContact,dbei.szModule,"ApparentMode",0) != ID_STATUS_OFFLINE)) ||
- (gbInvisDisable && (CallProtoService(dbei.szModule, PS_GETSTATUS, 0, 0) != ID_STATUS_INVISIBLE))))
- int a = CallService(allowService.c_str(), (WPARAM)hDbEvent, (LPARAM)(variables_parse(gbAuthRepl, hcntct).c_str()));
+ 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(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;
@@ -183,29 +194,36 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) 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))
+ && (!gbMaxQuestCount || DBGetContactSettingDword(hContact, pluginName, "QuestionCount", 0) < gbMaxQuestCount) && msg)
{
- if(!gbInvisDisable || ((gbInvisDisable && (DBGetContactSettingWord(hContact,dbei->szModule,"ApparentMode",0) != ID_STATUS_OFFLINE)) ||
- (gbInvisDisable && (CallProtoService(dbei->szModule, PS_GETSTATUS, 0, 0) != ID_STATUS_INVISIBLE))))
- {
- // send question
- tstring q = _T("StopSpam automatic message:\r\n") + variables_parse(gbQuestion, hContact);
+ // 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);
- }
+
+ // increment question count
+ DWORD questCount = DBGetContactSettingDword(hContact, pluginName, "QuestionCount", 0);
+ DBWriteContactSettingDword(hContact, pluginName, "QuestionCount", questCount + 1);
}
else
{
|