diff options
author | George Hazan <ghazan@miranda.im> | 2018-11-12 22:28:31 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-11-12 22:28:31 +0300 |
commit | 5578663450161f3f329f73d715e2399c5d03decd (patch) | |
tree | e987830cd0a206e50fdbb2c735e8d61943ad6f06 /plugins/Boltun/src | |
parent | b2f4af6c11168157fface019925b40ddbcd18a95 (diff) |
Boltun, BossKey -> g_plugin
Diffstat (limited to 'plugins/Boltun/src')
-rw-r--r-- | plugins/Boltun/src/actionQueue.cpp | 5 | ||||
-rw-r--r-- | plugins/Boltun/src/boltun.cpp | 23 | ||||
-rw-r--r-- | plugins/Boltun/src/config.cpp | 24 |
3 files changed, 23 insertions, 29 deletions
diff --git a/plugins/Boltun/src/actionQueue.cpp b/plugins/Boltun/src/actionQueue.cpp index 1fd7834008..f31d1c6f75 100644 --- a/plugins/Boltun/src/actionQueue.cpp +++ b/plugins/Boltun/src/actionQueue.cpp @@ -190,11 +190,10 @@ void DoAnswer(MCONTACT hContact, const TalkBot::MessageInfo *info, bool sticky = void AnswerToContact(MCONTACT hContact, const wchar_t* messageToAnswer)
{
- if (Config.TalkWarnContacts && db_get_b(hContact, BOLTUN_KEY,
- DB_CONTACT_WARNED, FALSE) == FALSE)
+ if (Config.TalkWarnContacts && g_plugin.getByte(hContact, DB_CONTACT_WARNED, FALSE) == FALSE)
{
DoAnswer(hContact, new TalkBot::MessageInfo((const wchar_t*)Config.WarnText), true);
- db_set_b(hContact, BOLTUN_KEY, DB_CONTACT_WARNED, TRUE);
+ g_plugin.setByte(hContact, DB_CONTACT_WARNED, TRUE);
}
else
DoAnswer(hContact, bot->Reply(hContact, messageToAnswer, false));
diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp index c908284fea..1a76531433 100644 --- a/plugins/Boltun/src/boltun.cpp +++ b/plugins/Boltun/src/boltun.cpp @@ -166,8 +166,7 @@ static bool LoadMind(const wchar_t* filename, int &line) static bool BoltunAutoChat(MCONTACT hContact)
{
- if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT
- , FALSE) == TRUE)
+ if (g_plugin.getByte(hContact, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE) == TRUE)
return false;
if (Config.TalkWithEverybody)
@@ -184,12 +183,10 @@ static bool BoltunAutoChat(MCONTACT hContact) return true;
}
- if ((db_get_b(hContact, "CList", "NotOnList", 0) == 1) &&
- Config.TalkWithNotInList)
+ if ((db_get_b(hContact, "CList", "NotOnList", 0) == 1) && Config.TalkWithNotInList)
return true;
- if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT,
- FALSE) == TRUE)
+ if (g_plugin.getByte(hContact, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE) == TRUE)
return true;
return false;
@@ -451,8 +448,8 @@ static int MessageOptInit(WPARAM wParam, LPARAM) static int ContactClick(WPARAM hContact, LPARAM, BOOL clickNotToChat)
{
- BOOL boltunautochat = db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE);
- BOOL boltunnottochat = db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE);
+ BOOL boltunautochat = g_plugin.getByte(hContact, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE);
+ BOOL boltunnottochat = g_plugin.getByte(hContact, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE);
if (clickNotToChat) {
boltunnottochat = !boltunnottochat;
@@ -466,12 +463,12 @@ static int ContactClick(WPARAM hContact, LPARAM, BOOL clickNotToChat) boltunnottochat = FALSE;
}
else {
- db_set_b(hContact, BOLTUN_KEY, DB_CONTACT_WARNED, FALSE);
+ g_plugin.setByte(hContact, DB_CONTACT_WARNED, FALSE);
}
}
- db_set_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, (BYTE)boltunautochat);
- db_set_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, (BYTE)boltunnottochat);
+ g_plugin.setByte(hContact, DB_CONTACT_BOLTUN_AUTO_CHAT, (BYTE)boltunautochat);
+ g_plugin.setByte(hContact, DB_CONTACT_BOLTUN_NOT_TO_CHAT, (BYTE)boltunnottochat);
return 0;
}
@@ -502,12 +499,12 @@ static int OnContactMenuPrebuild(WPARAM hContact, LPARAM) Menu_ShowItem(hMenuItemStartChatting, bEnable);
if (bEnable) {
- if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE))
+ if (g_plugin.getByte(hContact, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE))
Menu_ModifyItem(hMenuItemAutoChat, nullptr, Skin_LoadIcon(SKINICON_OTHER_TICK), CMIF_CHECKED);
else
Menu_ModifyItem(hMenuItemAutoChat, nullptr, Skin_LoadIcon(SKINICON_OTHER_NOTICK), 0);
- if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE))
+ if (g_plugin.getByte(hContact, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE))
Menu_ModifyItem(hMenuItemNotToChat, nullptr, Skin_LoadIcon(SKINICON_OTHER_TICK), CMIF_CHECKED);
else
Menu_ModifyItem(hMenuItemNotToChat, nullptr, Skin_LoadIcon(SKINICON_OTHER_NOTICK), 0);
diff --git a/plugins/Boltun/src/config.cpp b/plugins/Boltun/src/config.cpp index 700a8b5014..f49ad4a667 100644 --- a/plugins/Boltun/src/config.cpp +++ b/plugins/Boltun/src/config.cpp @@ -40,15 +40,13 @@ inline wchar_t* GetString(char* key, const wchar_t* def) {
DBVARIANT dbv;
wchar_t* val;
- if (!db_get_ws(NULL, BOLTUN_KEY, key, &dbv))
- {
+ if (!g_plugin.getWString(key, &dbv)) {
size_t len = mir_wstrlen(dbv.pwszVal) + 1;
val = new wchar_t[len];
wcscpy_s(val, len, dbv.pwszVal);
db_free(&dbv);
}
- else
- {
+ else {
size_t len = mir_wstrlen(def) + 1;
val = new wchar_t[len];
wcscpy_s(val, len, def);
@@ -61,29 +59,29 @@ inline const wchar_t* SetString(char* key, const wchar_t* value) size_t len = mir_wstrlen(value) + 1;
wchar_t* val = new wchar_t[len];
wcscpy_s(val, len, value);
- db_set_ws(0, BOLTUN_KEY, key, val);
+ g_plugin.setWString(key, val);
return val;
}
#define BUILDETTERS(x, str, def) \
const bool BoltunConfig::Get##x() { \
- return db_get_dw(0, BOLTUN_KEY, str, def) != 0; } \
+ return g_plugin.getDword(str, def) != 0; } \
const bool BoltunConfig::Set##x(const bool value) { \
- db_set_dw(0, BOLTUN_KEY, str, value); \
- return value; }
+ g_plugin.setDword(str, value); \
+ return value; }
#define BUILDINTETTERS(x, str, def) \
const int BoltunConfig::Get##x() { \
- return db_get_dw(0, BOLTUN_KEY, str, def); } \
+ return g_plugin.getDword(str, def); } \
const int BoltunConfig::Set##x(const int value) { \
- db_set_dw(0, BOLTUN_KEY, str, value); \
- return value; }
+ g_plugin.setDword(str, value); \
+ return value; }
#define BUILDSTRETTERS(x, str, def) \
const wchar_t* BoltunConfig::Get##x() { \
- return GetString(str, def); } \
+ return GetString(str, def); } \
const wchar_t* BoltunConfig::Set##x(const wchar_t* value) { \
- return SetString(str, value); }
+ return SetString(str, value); }
#define BUILDINIT(x) \
x(&BoltunConfig::Get##x, &BoltunConfig::Set##x)
|