diff options
-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 | ||||
-rw-r--r-- | plugins/BossKeyPlus/src/BossKey.cpp | 27 | ||||
-rw-r--r-- | plugins/BossKeyPlus/src/BossKeyIdle.cpp | 2 | ||||
-rw-r--r-- | plugins/BossKeyPlus/src/Options.cpp | 22 | ||||
-rw-r--r-- | plugins/BossKeyPlus/src/stdafx.h | 2 |
7 files changed, 49 insertions, 56 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)
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index b08d600000..e904cb65f9 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -57,7 +57,7 @@ static PLUGININFOEX pluginInfoEx = { };
CMPlugin::CMPlugin() :
- PLUGIN<CMPlugin>(MOD_NAME, pluginInfoEx)
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
{}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -240,12 +240,11 @@ static void CreateTrayIcon(bool create) {
NOTIFYICONDATA nim;
DBVARIANT dbVar;
- if (!db_get_ws(NULL, MOD_NAME, "ToolTipText", &dbVar)) {
+ if (!g_plugin.getWString("ToolTipText", &dbVar)) {
wcsncpy_s(nim.szTip, dbVar.pwszVal, _TRUNCATE);
db_free(&dbVar);
}
- else
- wcsncpy_s(nim.szTip, L"Miranda NG", _TRUNCATE);
+ else wcsncpy_s(nim.szTip, L"Miranda NG", _TRUNCATE);
nim.cbSize = sizeof(nim);
nim.hWnd = g_hListenWindow;
@@ -303,10 +302,10 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara if (g_wMask & OPT_CHANGESTATUS) // is this even needed?
{
- BYTE bReqMode = db_get_b(0, MOD_NAME, "stattype", 2);
+ BYTE bReqMode = g_plugin.getByte("stattype", 2);
unsigned uMode = (STATUS_ARR_TO_ID[bReqMode]);
DBVARIANT dbVar;
- if (g_wMask & OPT_USEDEFMSG || db_get_ws(NULL, MOD_NAME, "statmsg", &dbVar)) {
+ if (g_wMask & OPT_USEDEFMSG || g_plugin.getWString("statmsg", &dbVar)) {
wchar_t *ptszDefMsg = GetDefStatusMsg(uMode, nullptr);
ChangeAllProtoStatuses(uMode, ptszDefMsg);
mir_free(ptszDefMsg);
@@ -345,7 +344,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara g_bWindowHidden = true;
g_bOldSetting |= OLD_WASHIDDEN;
- db_set_b(0, MOD_NAME, "OldSetting", g_bOldSetting);
+ g_plugin.setByte("OldSetting", g_bOldSetting);
}
return 0;
@@ -356,7 +355,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara if (g_wMask & OPT_REQPASS) { //password request
DBVARIANT dbVar;
- if (!db_get_s(0, MOD_NAME, "password", &dbVar)) {
+ if (!g_plugin.getString("password", &dbVar)) {
g_fPassRequested = true;
strncpy(g_password, dbVar.pszVal, MAXPASSLEN);
@@ -405,7 +404,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara PostMessage(hWnd, WM_MOUSEMOVE, 0, (LPARAM)MAKELONG(2, 2)); // reset core's IDLE
g_bWindowHidden = false;
- db_set_b(0, MOD_NAME, "OldSetting", 0);
+ g_plugin.setByte("OldSetting", 0);
}
return 0;
}
@@ -552,7 +551,7 @@ static int TabsrmmButtonPressed(WPARAM, LPARAM lParam) {
CustomButtonClickData *cbcd = (CustomButtonClickData *)lParam;
- if (!mir_strcmp(cbcd->pszModule, MOD_NAME))
+ if (!mir_strcmp(cbcd->pszModule, MODULENAME))
BossKeyHideMiranda(0, 0);
return 0;
@@ -561,7 +560,7 @@ static int TabsrmmButtonPressed(WPARAM, LPARAM lParam) static int TabsrmmButtonsInit(WPARAM, LPARAM)
{
BBButton bbd = {};
- bbd.pszModuleName = MOD_NAME;
+ bbd.pszModuleName = MODULENAME;
bbd.dwDefPos = 5000;
bbd.pwszTooltip = LPGENW("Hide Miranda NG");
bbd.bbbFlags = BBBF_ISRSIDEBUTTON | BBBF_CANBEHIDDEN;
@@ -599,7 +598,7 @@ static int EnumProtos(WPARAM, LPARAM) static int MirandaLoaded(WPARAM, LPARAM)
{
- g_wMask = db_get_w(0, MOD_NAME, "optsmask", DEFAULTSETTING);
+ g_wMask = g_plugin.getWord("optsmask", DEFAULTSETTING);
RegisterCoreHotKeys();
@@ -660,8 +659,8 @@ static int MirandaLoaded(WPARAM, LPARAM) int CMPlugin::Load()
{
- g_wMaskAdv = db_get_w(0, MOD_NAME, "optsmaskadv", 0);
- g_bOldSetting = db_get_b(0, MOD_NAME, "OldSetting", 0);
+ g_wMaskAdv = g_plugin.getWord("optsmaskadv", 0);
+ g_bOldSetting = g_plugin.getByte("OldSetting", 0);
if ((g_bOldSetting & OLD_POPUP) && !(g_wMaskAdv & OPT_RESTORE)) // Restore popup settings if Miranda was crushed or killed in hidden mode and "Restore hiding on startup after failure" option is disabled
{
diff --git a/plugins/BossKeyPlus/src/BossKeyIdle.cpp b/plugins/BossKeyPlus/src/BossKeyIdle.cpp index ba70b6cbdc..415aef353e 100644 --- a/plugins/BossKeyPlus/src/BossKeyIdle.cpp +++ b/plugins/BossKeyPlus/src/BossKeyIdle.cpp @@ -54,7 +54,7 @@ VOID CALLBACK IdleTimer(HWND, UINT, UINT_PTR idEvent, DWORD) void InitIdleTimer()
{
- minutes = db_get_b(0, MOD_NAME, "time", 10);
+ minutes = g_plugin.getByte("time", 10);
hTimer = SetTimer(nullptr, 0, 2000, IdleTimer);
}
diff --git a/plugins/BossKeyPlus/src/Options.cpp b/plugins/BossKeyPlus/src/Options.cpp index 39f335cfe3..547f07ed25 100644 --- a/plugins/BossKeyPlus/src/Options.cpp +++ b/plugins/BossKeyPlus/src/Options.cpp @@ -41,7 +41,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam DBVARIANT dbVar;
- if (!db_get_s(0, MOD_NAME, "password", &dbVar)) {
+ if (!g_plugin.getString("password", &dbVar)) {
SetDlgItemTextA(hwndDlg, IDC_MAINOPT_PASS, dbVar.pszVal);
db_free(&dbVar);
}
@@ -57,7 +57,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_INSERTSTRING, -1, (LPARAM)Clist_GetStatusModeDescription(i, 0));
- SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_SETCURSEL, db_get_b(0, MOD_NAME, "stattype", 2), 0);
+ SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_SETCURSEL, g_plugin.getByte("stattype", 2), 0);
SendMessage(hwndDlg, WM_USER + 60, 0, 0);
SendMessage(hwndDlg, WM_USER + 50, 0, 0);
@@ -75,16 +75,16 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam // write down status type
if (IsDlgButtonChecked(hwndDlg, IDC_MAINOPT_CHANGESTATUSBOX) == BST_CHECKED) {
- db_set_b(0, MOD_NAME, "stattype", (BYTE)SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_GETCURSEL, 0, 0));
+ g_plugin.setByte("stattype", (BYTE)SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_GETCURSEL, 0, 0));
// status msg, if needed
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_MAINOPT_STATMSG))) { // meaning we should save it
wchar_t tszMsg[1025];
GetDlgItemText(hwndDlg, IDC_MAINOPT_STATMSG, tszMsg, _countof(tszMsg));
if (tszMsg[0] != 0)
- db_set_ws(0, MOD_NAME, "statmsg", tszMsg);
+ g_plugin.setWString("statmsg", tszMsg);
else // delete current setting
- db_unset(NULL, MOD_NAME, "statmsg");
+ g_plugin.delSetting("statmsg");
}
wMask |= OPT_CHANGESTATUS;
}
@@ -94,7 +94,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam char szPass[MAXPASSLEN + 1];
GetDlgItemTextA(hwndDlg, IDC_MAINOPT_PASS, szPass, _countof(szPass));
if (szPass[0] != 0){
- db_set_s(0, MOD_NAME, "password", szPass);
+ g_plugin.setString("password", szPass);
wMask |= OPT_REQPASS;
}
}
@@ -104,7 +104,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam if (IsDlgButtonChecked(hwndDlg, IDC_MAINOPT_USEDEFMSG) == BST_CHECKED) wMask |= OPT_USEDEFMSG;
if (IsDlgButtonChecked(hwndDlg, IDC_MAINOPT_TRAYICON) == BST_CHECKED) wMask |= OPT_TRAYICON;
- db_set_w(0, MOD_NAME, "optsmask", wMask);
+ g_plugin.setWord("optsmask", wMask);
g_wMask = wMask;
return true;
}
@@ -123,7 +123,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam else {
DBVARIANT dbVar;
SendDlgItemMessage(hwndDlg, IDC_MAINOPT_STATMSG, EM_LIMITTEXT, 1024, 0);
- if (!db_get_ws(NULL, MOD_NAME, "statmsg", &dbVar)) {
+ if (!g_plugin.getWString("statmsg", &dbVar)) {
SetDlgItemText(hwndDlg, IDC_MAINOPT_STATMSG, dbVar.pwszVal);
db_free(&dbVar);
}
@@ -216,7 +216,7 @@ INT_PTR CALLBACK AdvOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
g_fOptionsOpen = true;
- minutes = db_get_b(0, MOD_NAME, "time", 10);
+ minutes = g_plugin.getByte("time", 10);
wchar_t szMinutes[4] = { 0 };
_itow(minutes, szMinutes, 10);
SendDlgItemMessage(hwndDlg, IDC_MAINOPT_TIME, EM_LIMITTEXT, 2, 0);
@@ -257,8 +257,8 @@ INT_PTR CALLBACK AdvOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) GetDlgItemText(hwndDlg, IDC_MAINOPT_TIME, szMinutes, _countof(szMinutes));
minutes = _wtoi(szMinutes);
if (minutes < 1) minutes = 1;
- db_set_b(0, MOD_NAME, "time", minutes);
- db_set_w(0, MOD_NAME, "optsmaskadv", wMaskAdv);
+ g_plugin.setByte("time", minutes);
+ g_plugin.setWord("optsmaskadv", wMaskAdv);
g_wMaskAdv = wMaskAdv;
return true;
}
diff --git a/plugins/BossKeyPlus/src/stdafx.h b/plugins/BossKeyPlus/src/stdafx.h index 83e8920b89..bd332466c1 100644 --- a/plugins/BossKeyPlus/src/stdafx.h +++ b/plugins/BossKeyPlus/src/stdafx.h @@ -47,7 +47,7 @@ #include "resource.h"
#include "version.h"
-#define MOD_NAME "BossKey"
+#define MODULENAME "BossKey"
struct CMPlugin : public PLUGIN<CMPlugin>
{
|