diff options
author | George Hazan <ghazan@miranda.im> | 2018-11-12 21:44:56 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-11-12 21:44:56 +0300 |
commit | 53fe3e46177d17b4941610de19f5cc6210700cb4 (patch) | |
tree | b67a6bc208dad141f9db14035cd7e42ff2a51872 /plugins/SimpleAR | |
parent | 488214ac8af0c4aeb1a5c1d8fd48368daaf4c4c7 (diff) |
db_* functions replaced with g_plugin calls
Diffstat (limited to 'plugins/SimpleAR')
-rw-r--r-- | plugins/SimpleAR/src/Main.cpp | 22 | ||||
-rw-r--r-- | plugins/SimpleAR/src/Options.cpp | 20 |
2 files changed, 21 insertions, 21 deletions
diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp index 4b96392d79..8744d20e6f 100644 --- a/plugins/SimpleAR/src/Main.cpp +++ b/plugins/SimpleAR/src/Main.cpp @@ -55,8 +55,8 @@ CMPlugin::CMPlugin() : INT_PTR ToggleEnable(WPARAM, LPARAM)
{
- BOOL fEnabled = !db_get_b(NULL, MODULENAME, KEY_ENABLED, 1);
- db_set_b(NULL, MODULENAME, KEY_ENABLED, fEnabled);
+ BOOL fEnabled = !g_plugin.getByte(KEY_ENABLED, 1);
+ g_plugin.setByte(KEY_ENABLED, fEnabled);
if (fEnabled)
Menu_ModifyItem(hEnableMenu, LPGENW("Disable Auto&reply"), iconList[0].hIcolib);
@@ -90,12 +90,12 @@ INT OnPreBuildContactMenu(WPARAM hContact, LPARAM) INT CheckDefaults(WPARAM, LPARAM)
{
- interval = db_get_w(NULL, MODULENAME, KEY_REPEATINTERVAL, 300);
+ interval = g_plugin.getWord(KEY_REPEATINTERVAL, 300);
- wchar_t *ptszVal = db_get_wsa(NULL, MODULENAME, KEY_HEADING);
+ wchar_t *ptszVal = g_plugin.getWStringA(KEY_HEADING);
if (ptszVal == nullptr)
// Heading not set
- db_set_ws(NULL, MODULENAME, KEY_HEADING, TranslateT("Dear %user%, the owner left the following message:"));
+ g_plugin.setWString(KEY_HEADING, TranslateT("Dear %user%, the owner left the following message:"));
else
mir_free(ptszVal);
@@ -105,7 +105,7 @@ INT CheckDefaults(WPARAM, LPARAM) else {
char szStatus[6] = { 0 };
mir_snprintf(szStatus, "%d", c);
- ptszVal = db_get_wsa(NULL, MODULENAME, szStatus);
+ ptszVal = g_plugin.getWStringA(szStatus);
if (ptszVal == nullptr) {
wchar_t *ptszDefault;
if (c < ID_STATUS_FREECHAT)
@@ -116,7 +116,7 @@ INT CheckDefaults(WPARAM, LPARAM) else
ptszDefault = nullptr;
if (ptszDefault)
- db_set_ws(NULL, MODULENAME, szStatus, TranslateW(ptszDefault));
+ g_plugin.setWString(szStatus, TranslateW(ptszDefault));
}
else
mir_free(ptszVal);
@@ -126,7 +126,7 @@ INT CheckDefaults(WPARAM, LPARAM) if (ServiceExists(MS_VARS_FORMATSTRING))
gbVarsServiceExist = TRUE;
- BOOL fEnabled = db_get_b(NULL, MODULENAME, KEY_ENABLED, 1);
+ BOOL fEnabled = g_plugin.getByte(KEY_ENABLED, 1);
if (fEnabled)
Menu_ModifyItem(hEnableMenu, LPGENW("Disable Auto&reply"), iconList[0].hIcolib);
else
@@ -136,7 +136,7 @@ INT CheckDefaults(WPARAM, LPARAM) INT addEvent(WPARAM hContact, LPARAM hDBEvent)
{
- BOOL fEnabled = db_get_b(NULL, MODULENAME, KEY_ENABLED, 1);
+ BOOL fEnabled = g_plugin.getByte(KEY_ENABLED, 1);
if (!fEnabled || !hContact || !hDBEvent)
return FALSE; /// unspecifyed error
@@ -180,7 +180,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent) char szStatus[6] = { 0 };
mir_snprintf(szStatus, "%d", status);
- ptszVal = db_get_wsa(NULL, MODULENAME, szStatus);
+ ptszVal = g_plugin.getWStringA(szStatus);
if (ptszVal) {
if (*ptszVal) {
CMStringW ptszTemp;
@@ -193,7 +193,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent) msgLen += mir_wstrlen(ptszVal);
- wchar_t *ptszHead = db_get_wsa(NULL, MODULENAME, KEY_HEADING);
+ wchar_t *ptszHead = g_plugin.getWStringA(KEY_HEADING);
if (ptszHead != nullptr) {
ptszTemp = ptszHead;
ptszTemp.Replace(L"%user%", ptszNick);
diff --git a/plugins/SimpleAR/src/Options.cpp b/plugins/SimpleAR/src/Options.cpp index 42fefe82aa..6fd17f3adb 100644 --- a/plugins/SimpleAR/src/Options.cpp +++ b/plugins/SimpleAR/src/Options.cpp @@ -11,11 +11,11 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara {
char tszStatus[6] = { 0 };
- CheckDlgButton(hwndDlg, IDC_ENABLEREPLIER, db_get_b(NULL, MODULENAME, KEY_ENABLED, 1) == 1 ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemInt(hwndDlg, IDC_INTERVAL, db_get_w(NULL, MODULENAME, KEY_REPEATINTERVAL, 300) / 60, FALSE);
+ CheckDlgButton(hwndDlg, IDC_ENABLEREPLIER, g_plugin.getByte(KEY_ENABLED, 1) == 1 ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemInt(hwndDlg, IDC_INTERVAL, g_plugin.getWord(KEY_REPEATINTERVAL, 300) / 60, FALSE);
DBVARIANT dbv;
- if (!db_get_ws(NULL, MODULENAME, KEY_HEADING, &dbv)) {
+ if (!g_plugin.getWString(KEY_HEADING, &dbv)) {
SetDlgItemText(hwndDlg, IDC_HEADING, dbv.pwszVal);
db_free(&dbv);
}
@@ -28,7 +28,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara else {
SendDlgItemMessage(hwndDlg, IDC_STATUSMODE, CB_ADDSTRING, 0, (LPARAM)pszStatus);
- if (!db_get_ws(NULL, MODULENAME, tszStatus, &dbv)) {
+ if (!g_plugin.getWString(tszStatus, &dbv)) {
if (c < ID_STATUS_FREECHAT)
ptszMessage[c - ID_STATUS_ONLINE - 1] = wcsdup(dbv.pwszVal);
else if (c > ID_STATUS_INVISIBLE)
@@ -80,7 +80,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara BOOL translated;
BOOL fEnabled = IsDlgButtonChecked(hwndDlg, IDC_ENABLEREPLIER) == 1;
- db_set_b(NULL, MODULENAME, KEY_ENABLED, (BYTE)fEnabled);
+ g_plugin.setByte(KEY_ENABLED, (BYTE)fEnabled);
if (fEnabled)
Menu_ModifyItem(hEnableMenu, LPGENW("Disable Auto&reply"), iconList[0].hIcolib);
@@ -88,12 +88,12 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara Menu_ModifyItem(hEnableMenu, LPGENW("Enable Auto&reply"), iconList[1].hIcolib);
GetDlgItemText(hwndDlg, IDC_HEADING, ptszText, _countof(ptszText));
- db_set_ws(NULL, MODULENAME, KEY_HEADING, ptszText);
+ g_plugin.setWString(KEY_HEADING, ptszText);
INT size = GetDlgItemInt(hwndDlg, IDC_INTERVAL, &translated, FALSE);
if (translated)
interval = size * 60;
- db_set_w(NULL, MODULENAME, KEY_REPEATINTERVAL, interval);
+ g_plugin.setWord(KEY_REPEATINTERVAL, interval);
size = SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_GETTEXTLENGTH, 0, 0) + 1;
GetDlgItemText(hwndDlg, IDC_MESSAGE, ptszMessage[lastIndex], size);
@@ -106,11 +106,11 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara mir_snprintf(szStatus, "%d", c);
if (c<ID_STATUS_FREECHAT && ptszMessage[c - ID_STATUS_ONLINE - 1])
- db_set_ws(NULL, MODULENAME, szStatus, ptszMessage[c - ID_STATUS_ONLINE - 1]);
+ g_plugin.setWString(szStatus, ptszMessage[c - ID_STATUS_ONLINE - 1]);
else if (c>ID_STATUS_INVISIBLE && ptszMessage[c - ID_STATUS_ONLINE - 3])
- db_set_ws(NULL, MODULENAME, szStatus, ptszMessage[c - ID_STATUS_ONLINE - 3]);
+ g_plugin.setWString(szStatus, ptszMessage[c - ID_STATUS_ONLINE - 3]);
else
- db_unset(NULL, MODULENAME, szStatus);
+ g_plugin.delSetting(szStatus);
}
}
return TRUE;
|