summaryrefslogtreecommitdiff
path: root/plugins/StopSpamPlus
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/StopSpamPlus')
-rw-r--r--plugins/StopSpamPlus/src/events.cpp32
-rw-r--r--plugins/StopSpamPlus/src/services.cpp18
-rw-r--r--plugins/StopSpamPlus/src/settings.cpp20
-rw-r--r--plugins/StopSpamPlus/src/utils.cpp2
4 files changed, 36 insertions, 36 deletions
diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp
index 48aa3269e4..75694b5090 100644
--- a/plugins/StopSpamPlus/src/events.cpp
+++ b/plugins/StopSpamPlus/src/events.cpp
@@ -27,8 +27,8 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam)
// if request is from unknown or not marked Answered contact
//and if I don't sent message to this contact
- if(DBGetContactSettingByte(hcntct, "CList", "NotOnList", 0) &&
- !DBGetContactSettingByte(hcntct, pluginName, answeredSetting, 0) &&
+ if(db_get_b(hcntct, "CList", "NotOnList", 0) &&
+ !db_get_b(hcntct, pluginName, answeredSetting, 0) &&
!IsExistMyMessage(hcntct))
{
if (!plSets->HandleAuthReq.Get())
@@ -50,8 +50,8 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam)
mir_free(AuthRepl);
- DBWriteContactSettingByte(hcntct, "CList", "NotOnList", 1);
- DBWriteContactSettingByte(hcntct, "CList", "Hidden", 1);
+ db_set_b(hcntct, "CList", "NotOnList", 1);
+ db_set_b(hcntct, "CList", "Hidden", 1);
if (!plSets->HistLog.Get())
db_event_delete(0, hDbEvent);
delete [] dbei.pBlob;
@@ -81,13 +81,13 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l)
return 0;
// if message is from known or marked Answered contact
- if(DBGetContactSettingByte(hContact, pluginName, answeredSetting, 0))
+ if(db_get_b(hContact, pluginName, answeredSetting, 0))
// ...let the event go its way
return 0;
// checking if message from self-added contact
//Contact in Not in list icq group
- if (!DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) && DBGetContactSettingWord(hContact, dbei->szModule, "SrvGroupId", -1) != 1)
+ if (!db_get_b(hContact, "CList", "NotOnList", 0) && db_get_w(hContact, dbei->szModule, "SrvGroupId", -1) != 1)
return 0;
//if I sent message to this contact
@@ -135,14 +135,14 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l)
)
{
// unhide contact
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
// mark contact as Answered
- DBWriteContactSettingByte(hContact, pluginName, answeredSetting, 1);
+ db_set_b(hContact, pluginName, answeredSetting, 1);
//add contact permanently
if(plSets->AddPermanent.Get())
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
// send congratulation
@@ -160,7 +160,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l)
// if message message does not contain infintite talk protection prefix
// and question count for this contact is less then maximum
if ( (!plSets->InfTalkProtection.Get() || tstring::npos==message.find(infTalkProtPrefix))
- && (!plSets->MaxQuestCount.Get() || DBGetContactSettingDword(hContact, pluginName, questCountSetting, 0) < plSets->MaxQuestCount.Get()))
+ && (!plSets->MaxQuestCount.Get() || db_get_dw(hContact, pluginName, questCountSetting, 0) < plSets->MaxQuestCount.Get()))
{
// send question
tstring q = infTalkProtPrefix + variables_parse((tstring)(plSets->Question), hContact);
@@ -172,13 +172,13 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l)
// increment question count
- DWORD questCount = DBGetContactSettingDword(hContact, pluginName, questCountSetting, 0);
- DBWriteContactSettingDword(hContact, pluginName, questCountSetting, questCount + 1);
+ DWORD questCount = db_get_dw(hContact, pluginName, questCountSetting, 0);
+ db_set_dw(hContact, pluginName, questCountSetting, questCount + 1);
// hide contact from contact list
}
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "Hidden", 1);
// save message from contact
dbei->flags |= DBEF_READ;
@@ -227,8 +227,8 @@ MIRANDA_HOOK_EVENT(ME_DB_CONTACT_SETTINGCHANGED, w, l)
return 0;
if (!cws->value.type)
{
- DBDeleteContactSetting(hContact, pluginName, answeredSetting);
- DBDeleteContactSetting(hContact, pluginName, questCountSetting);
+ db_unset(hContact, pluginName, answeredSetting);
+ db_unset(hContact, pluginName, questCountSetting);
}
return 0;
diff --git a/plugins/StopSpamPlus/src/services.cpp b/plugins/StopSpamPlus/src/services.cpp
index 905a87ee89..21b77e14f4 100644
--- a/plugins/StopSpamPlus/src/services.cpp
+++ b/plugins/StopSpamPlus/src/services.cpp
@@ -8,10 +8,10 @@ INT_PTR IsContactPassed(WPARAM wParam, LPARAM /*lParam*/)
if ( !plSets->ProtoDisabled( proto.c_str()))
return CS_PASSED;
- if ( DBGetContactSettingByte(hContact, pluginName, answeredSetting, 0))
+ if ( db_get_b(hContact, pluginName, answeredSetting, 0))
return CS_PASSED;
- if ( !DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) && DBGetContactSettingWord( hContact, proto.c_str(), "SrvGroupId", -1 ) != 1)
+ if ( !db_get_b(hContact, "CList", "NotOnList", 0) && db_get_w( hContact, proto.c_str(), "SrvGroupId", -1 ) != 1)
return CS_PASSED;
if ( IsExistMyMessage(hContact))
@@ -27,10 +27,10 @@ INT_PTR RemoveTempContacts(WPARAM wParam,LPARAM lParam)
HANDLE hNext = db_find_next(hContact);
DBVARIANT dbv = { 0 };
- if ( DBGetContactSettingTString( hContact, "CList", "Group", &dbv ))
+ if ( db_get_ts( hContact, "CList", "Group", &dbv ))
dbv.ptszVal = NULL;
- if ( DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) || DBGetContactSettingByte(hContact, "CList", "Hidden", 0 ) || (dbv.ptszVal != NULL && (_tcsstr(dbv.ptszVal, _T("Not In List")) || _tcsstr(dbv.ptszVal, TranslateT("Not In List"))))) {
+ if ( db_get_b(hContact, "CList", "NotOnList", 0) || db_get_b(hContact, "CList", "Hidden", 0 ) || (dbv.ptszVal != NULL && (_tcsstr(dbv.ptszVal, _T("Not In List")) || _tcsstr(dbv.ptszVal, TranslateT("Not In List"))))) {
char *szProto = GetContactProto(hContact);
if ( szProto != NULL ) {
// Check if protocol uses server side lists
@@ -40,14 +40,14 @@ INT_PTR RemoveTempContacts(WPARAM wParam,LPARAM lParam)
status = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
if (status == ID_STATUS_OFFLINE || (status >= ID_STATUS_CONNECTING && status < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES))
// Set a flag so we remember to delete the contact when the protocol goes online the next time
- DBWriteContactSettingByte( hContact, "CList", "Delete", 1 );
+ db_set_b( hContact, "CList", "Delete", 1 );
else
CallService( MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0 );
}
}
}
- DBFreeVariant( &dbv );
+ db_free( &dbv );
hContact = hNext;
}
@@ -56,13 +56,13 @@ INT_PTR RemoveTempContacts(WPARAM wParam,LPARAM lParam)
do {
group_name = (char *)CallService(MS_CLIST_GROUPGETNAME, (WPARAM)hGroup, 0);
if (group_name != NULL && strstr(group_name, "Not In List")) {
- BYTE ConfirmDelete = DBGetContactSettingByte(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT);
+ BYTE ConfirmDelete = db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT);
if ( ConfirmDelete )
- DBWriteContactSettingByte( NULL, "CList", "ConfirmDelete", 0 );
+ db_set_b( NULL, "CList", "ConfirmDelete", 0 );
CallService( MS_CLIST_GROUPDELETE, (WPARAM)hGroup, 0 );
if ( ConfirmDelete )
- DBWriteContactSettingByte( NULL, "CList", "ConfirmDelete", ConfirmDelete );
+ db_set_b( NULL, "CList", "ConfirmDelete", ConfirmDelete );
break;
}
hGroup++;
diff --git a/plugins/StopSpamPlus/src/settings.cpp b/plugins/StopSpamPlus/src/settings.cpp
index 05a9007d0c..52dcc274a2 100644
--- a/plugins/StopSpamPlus/src/settings.cpp
+++ b/plugins/StopSpamPlus/src/settings.cpp
@@ -4,10 +4,10 @@
tstring db_usage::DBGetPluginSetting(std::string const &name, tstring const &defValue)
{
DBVARIANT dbv;
- if(DBGetContactSettingTString(NULL, pluginName, name.c_str(), &dbv))
+ if(db_get_ts(NULL, pluginName, name.c_str(), &dbv))
return defValue;
tstring value = dbv.ptszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return value;
}
@@ -15,45 +15,45 @@ tstring db_usage::DBGetPluginSetting(std::string const &name, tstring const &def
std::string db_usage::DBGetPluginSetting(std::string const &name, std::string const &defValue)
{
DBVARIANT dbv;
- if(DBGetContactSettingString(NULL, pluginName, name.c_str(), &dbv))
+ if(db_get_s(NULL, pluginName, name.c_str(), &dbv))
return defValue;
std::string value = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return value;
}
bool db_usage::DBGetPluginSetting(std::string const &name, bool const &defValue)
{
- return(0 != DBGetContactSettingByte(NULL, pluginName, name.c_str(), defValue?1:0));
+ return(0 != db_get_b(NULL, pluginName, name.c_str(), defValue?1:0));
}
DWORD db_usage::DBGetPluginSetting(std::string const &name, DWORD const &defValue)
{
- return DBGetContactSettingDword(NULL, pluginName, name.c_str(), defValue);
+ return db_get_dw(NULL, pluginName, name.c_str(), defValue);
}
//writting to database--------------
void db_usage::DBSetPluginSetting(std::string const &name, tstring const &value)
{
- DBWriteContactSettingTString(NULL, pluginName, name.c_str(), value.c_str());
+ db_set_ts(NULL, pluginName, name.c_str(), value.c_str());
}
void db_usage::DBSetPluginSetting(std::string const &name, std::string const &value)
{
- DBWriteContactSettingString(NULL, pluginName, name.c_str(), value.c_str());
+ db_set_s(NULL, pluginName, name.c_str(), value.c_str());
}
void db_usage::DBSetPluginSetting(std::string const &name, bool const &value)
{
- DBWriteContactSettingByte(NULL, pluginName, name.c_str(), value?1:0);
+ db_set_b(NULL, pluginName, name.c_str(), value?1:0);
}
void db_usage::DBSetPluginSetting(std::string const &name, DWORD const &value)
{
- DBWriteContactSettingDword(NULL, pluginName, name.c_str(),value);
+ db_set_dw(NULL, pluginName, name.c_str(),value);
}
Settings *plSets;
diff --git a/plugins/StopSpamPlus/src/utils.cpp b/plugins/StopSpamPlus/src/utils.cpp
index b1329ccd0c..ca4c46c292 100644
--- a/plugins/StopSpamPlus/src/utils.cpp
+++ b/plugins/StopSpamPlus/src/utils.cpp
@@ -22,7 +22,7 @@ bool IsExistMyMessage(HANDLE hContact)
if(dbei.flags & DBEF_SENT){
// mark contact as Answered
- DBWriteContactSettingByte(hContact, pluginName, answeredSetting, 1);
+ db_set_b(hContact, pluginName, answeredSetting, 1);
// ...let the event go its way
return true;
}