summaryrefslogtreecommitdiff
path: root/plugins/StopSpamMod/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-09-27 23:43:06 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-09-27 23:43:06 +0300
commite441a31e9f912fc8e9244d16560565559b1924d2 (patch)
treee9d47703f0e56bb5745e7e4e842d14ce989fe86d /plugins/StopSpamMod/src
parent91811190c158e4ff97cc94ef93415c12ddf738ed (diff)
end of manual experiments with CList/NotOnList
Diffstat (limited to 'plugins/StopSpamMod/src')
-rwxr-xr-xplugins/StopSpamMod/src/stopspam.cpp14
-rwxr-xr-xplugins/StopSpamMod/src/utilities.cpp4
2 files changed, 9 insertions, 9 deletions
diff --git a/plugins/StopSpamMod/src/stopspam.cpp b/plugins/StopSpamMod/src/stopspam.cpp
index bab6eb4db1..b32afb3e90 100755
--- a/plugins/StopSpamMod/src/stopspam.cpp
+++ b/plugins/StopSpamMod/src/stopspam.cpp
@@ -37,7 +37,7 @@ int OnDbEventAdded(WPARAM hContact, LPARAM hDbEvent)
MCONTACT hcntct = DbGetAuthEventContact(&dbei);
// if request is from unknown or not marked Answered contact
- int a = db_get_b(hcntct, "CList", "NotOnList", 0);
+ int a = !Contact_OnList(hcntct);
int b = !g_plugin.getByte(hcntct, "Answered");
if (a && b) {
@@ -85,7 +85,7 @@ int OnDbEventFilterAdd(WPARAM hContact, LPARAM l)
return 0;
if (g_plugin.getByte(hContact, "Excluded")) {
- if (!db_get_b(hContact, "CList", "NotOnList", 0))
+ if (Contact_OnList(hContact))
g_plugin.delSetting(hContact, "Excluded");
return 0;
}
@@ -95,14 +95,14 @@ int OnDbEventFilterAdd(WPARAM hContact, LPARAM l)
return 0; // ...let the event go its way
// mark contact which we trying to contact for exclude from check
- if ((dbei->flags & DBEF_SENT) && db_get_b(hContact, "CList", "NotOnList", 0)
+ if ((dbei->flags & DBEF_SENT) && !Contact_OnList(hContact)
&& (!gbMaxQuestCount || g_plugin.getDword(hContact, "QuestionCount") < gbMaxQuestCount) && gbExclude) {
g_plugin.setByte(hContact, "Excluded", 1);
return 0;
}
// if message is from known or marked Answered contact
- if (!db_get_b(hContact, "CList", "NotOnList", 0))
+ if (Contact_OnList(hContact))
return 0; // ...let the event go its way
// if message is corrupted or empty it cannot be an answer.
@@ -165,7 +165,7 @@ int OnDbEventFilterAdd(WPARAM hContact, LPARAM l)
//add contact permanently
if (gbAddPermanent) //do not use this )
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
// send congratulation
if (bSendMsg) {
@@ -184,7 +184,7 @@ int OnDbEventFilterAdd(WPARAM hContact, LPARAM l)
// add contact to server list and local group
if (gbAutoAddToServerList) {
Clist_SetGroup(hContact, gbAutoAuthGroup.c_str());
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
}
// auto auth. request with send congratulation
@@ -273,7 +273,7 @@ int OnDbEventFilterAdd(WPARAM hContact, LPARAM l)
Contact_Hide(hContact);
if (gbSpecialGroup)
Clist_SetGroup(hContact, gbSpammersGroup.c_str());
- db_set_b(hContact, "CList", "NotOnList", 1);
+ Contact_RemoveFromList(hContact);
// save first message from contact
if (g_plugin.getDword(hContact, "QuestionCount") < 2) {
diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp
index df98a7efbb..d8dd94c673 100755
--- a/plugins/StopSpamMod/src/utilities.cpp
+++ b/plugins/StopSpamMod/src/utilities.cpp
@@ -249,7 +249,7 @@ void __cdecl CleanProtocolTmpThread(void *param)
std::list<MCONTACT> contacts;
for (auto &hContact : Contacts(szProto))
- if (db_get_b(hContact, "CList", "NotOnList", 0) || (L"Not In List" == DBGetContactSettingStringPAN(hContact, "CList", "Group", L"")))
+ if (!Contact_OnList(hContact) || (L"Not In List" == DBGetContactSettingStringPAN(hContact, "CList", "Group", L"")))
contacts.push_back(hContact);
Sleep(5000);
@@ -279,7 +279,7 @@ void __cdecl CleanProtocolExclThread(void *param)
std::list<MCONTACT> contacts;
for (auto &hContact : Contacts(szProto))
- if (db_get_b(hContact, "CList", "NotOnList", 0) && g_plugin.getByte(hContact, "Excluded"))
+ if (!Contact_OnList(hContact) && g_plugin.getByte(hContact, "Excluded"))
contacts.push_back(hContact);
Sleep(5000);