summaryrefslogtreecommitdiff
path: root/plugins/BossKeyPlus/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-11-12 22:28:31 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-11-12 22:28:31 +0300
commit5578663450161f3f329f73d715e2399c5d03decd (patch)
treee987830cd0a206e50fdbb2c735e8d61943ad6f06 /plugins/BossKeyPlus/src
parentb2f4af6c11168157fface019925b40ddbcd18a95 (diff)
Boltun, BossKey -> g_plugin
Diffstat (limited to 'plugins/BossKeyPlus/src')
-rw-r--r--plugins/BossKeyPlus/src/BossKey.cpp27
-rw-r--r--plugins/BossKeyPlus/src/BossKeyIdle.cpp2
-rw-r--r--plugins/BossKeyPlus/src/Options.cpp22
-rw-r--r--plugins/BossKeyPlus/src/stdafx.h2
4 files changed, 26 insertions, 27 deletions
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>
{