From 8bf6e5947ede1c48bf31e241d23ffd6fc728b683 Mon Sep 17 00:00:00 2001 From: sss Date: Sun, 15 Mar 2009 00:01:19 +0000 Subject: optimization, possible crash fixed git-svn-id: http://172.18.13.13/svn/mim_plugs@12 63852ff1-2cfd-40b9-8011-e561a9d89b1c --- stopspam_mod/trunk/stopspam.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'stopspam_mod/trunk/stopspam.cpp') diff --git a/stopspam_mod/trunk/stopspam.cpp b/stopspam_mod/trunk/stopspam.cpp index 9bcfd08..326d0ca 100644 --- a/stopspam_mod/trunk/stopspam.cpp +++ b/stopspam_mod/trunk/stopspam.cpp @@ -2,11 +2,11 @@ extern TCHAR const * defQuestion; -MIRANDA_HOOK_EVENT(ME_DB_CONTACT_ADDED, w, l) +/*MIRANDA_HOOK_EVENT(ME_DB_CONTACT_ADDED, w, l) { DBWriteContactSettingByte((HANDLE)w, "CList", "NotOnList", 1); return 0; -} +}*/ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) { @@ -22,13 +22,6 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) dbei.pBlob = new BYTE[dbei.cbBlob]; CallService(MS_DB_EVENT_GET, lParam, (LPARAM)&dbei); - if(DBGetContactSettingWord(hContact, dbei.szModule, "ServerId", 0)) - { - DBDeleteContactSetting(hContact, "CList", "NotOnList"); - delete dbei.pBlob; - return 0; - } - // if event is in protocol that is not despammed if(!ProtoInList(dbei.szModule)) { delete dbei.pBlob; @@ -91,12 +84,19 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) // if event is in protocol that is not despammed if(!ProtoInList(dbei->szModule)) { - DBDeleteContactSetting(hContact, "CList", "NotOnList"); + // DBDeleteContactSetting(hContact, "CList", "NotOnList"); // ...let the event go its way return 0; } //do not check excluded contact + if(DBGetContactSettingWord(hContact, dbei->szModule, "ServerId", 0)) + { + DBDeleteContactSetting(hContact, "CList", "NotOnList"); + return 0; + } + + if(gbDelNotInList) if(DBGetContactSettingStringPAN_A((HANDLE)w, "CList", "Group", "") == "Not In List") { @@ -113,13 +113,13 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) return 0; } // if event is not a message, or if the message has been read or sent... -/* else if(dbei->flags & DBEF_READ || dbei->eventType != EVENTTYPE_MESSAGE) + else if(dbei->flags & DBEF_READ || dbei->eventType != EVENTTYPE_MESSAGE || dbei->eventType != EVENTTYPE_FILE || dbei->eventType != EVENTTYPE_URL || dbei->eventType != EVENTTYPE_CONTACTS) // ...let the event go its way - return 0; */ - //we want block not only messages, i seen many types other eventtype flood + return 0; +/* //we want block not only messages, i seen many types other eventtype flood else if(dbei->flags & DBEF_READ) // ...let the event go its way - return 0; + return 0;*/ //mark contact which we trying to contact for exclude from check else if((dbei->flags & DBEF_SENT) && DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) && (!gbMaxQuestCount || DBGetContactSettingDword(hContact, pluginName, "QuestionCount", 0) < gbMaxQuestCount) && gbExclude) @@ -229,8 +229,11 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1); // save message from contact - dbei->flags |= DBEF_READ; - CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)dbei); + if(!gbIgnoreContacts) + { + dbei->flags |= DBEF_READ; + CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)dbei); + } // reject processing of the event return 1; -- cgit v1.2.3