summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-11-13 23:17:16 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-11-13 23:17:16 +0300
commit37bf075d4d326f6d5577fd2ce81f0e75d5ee7311 (patch)
tree1b2f1fbf833ec7ee005e8f430622a5ed2b564c79 /plugins
parent70ac0a879897a5100308f70d667267e5962060d4 (diff)
YAMN -> g_plugin
Diffstat (limited to 'plugins')
-rw-r--r--plugins/YAMN/src/browser/mailbrowser.cpp12
-rw-r--r--plugins/YAMN/src/proto/pop3/pop3comm.cpp19
-rw-r--r--plugins/YAMN/src/proto/pop3/pop3opt.cpp18
-rw-r--r--plugins/YAMN/src/services.cpp27
-rw-r--r--plugins/YAMN/src/yamn.cpp4
5 files changed, 39 insertions, 41 deletions
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp
index 654f529e31..974e46fbe4 100644
--- a/plugins/YAMN/src/browser/mailbrowser.cpp
+++ b/plugins/YAMN/src/browser/mailbrowser.cpp
@@ -650,7 +650,7 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D
db_set_ws(ActualAccount->hContact, "CList", "StatusMsg", tszMsg);
if (nflags & YAMN_ACC_CONTNICK)
- db_set_ws(ActualAccount->hContact, YAMN_DBMODULE, "Nick", tszMsg);
+ g_plugin.setWString(ActualAccount->hContact, "Nick", tszMsg);
}
if ((nflags & YAMN_ACC_POP) &&
@@ -779,7 +779,7 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D
else db_set_s(ActualAccount->hContact, "CList", "StatusMsg", Translate("No new mail message"));
if (nflags & YAMN_ACC_CONTNICK)
- db_set_s(ActualAccount->hContact, YAMN_DBMODULE, "Nick", ActualAccount->Name);
+ g_plugin.setString(ActualAccount->hContact, "Nick", ActualAccount->Name);
}
}
return;
@@ -806,7 +806,7 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
hContact = PUGetContact(hWnd);
- if (!db_get_s(hContact, YAMN_DBMODULE, "Id", &dbv)) {
+ if (!g_plugin.getString(hContact, "Id", &dbv)) {
Account = (HACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
db_free(&dbv);
}
@@ -870,7 +870,7 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
MCONTACT hContact = PUGetContact(hWnd);
- if (!db_get_s(hContact, YAMN_DBMODULE, "Id", &dbv)) {
+ if (!g_plugin.getString(hContact, "Id", &dbv)) {
ActualAccount = (HACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
db_free(&dbv);
}
@@ -899,7 +899,7 @@ LRESULT CALLBACK NoNewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
MCONTACT hContact = PUGetContact(hWnd);
- if (!db_get_s(hContact, YAMN_DBMODULE, "Id", &dbv)) {
+ if (!g_plugin.getString(hContact, "Id", &dbv)) {
ActualAccount = (HACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
db_free(&dbv);
}
@@ -962,7 +962,7 @@ LRESULT CALLBACK NoNewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
MCONTACT hContact = PUGetContact(hWnd);
- if (!db_get_s(hContact, YAMN_DBMODULE, "Id", &dbv)) {
+ if (!g_plugin.getString(hContact, "Id", &dbv)) {
ActualAccount = (HACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
db_free(&dbv);
}
diff --git a/plugins/YAMN/src/proto/pop3/pop3comm.cpp b/plugins/YAMN/src/proto/pop3/pop3comm.cpp
index f601ab947f..656dc1e5c1 100644
--- a/plugins/YAMN/src/proto/pop3/pop3comm.cpp
+++ b/plugins/YAMN/src/proto/pop3/pop3comm.cpp
@@ -283,10 +283,10 @@ int RegisterPOP3Plugin(WPARAM, LPARAM)
for (Finder = POP3Plugin->FirstAccount; Finder != nullptr; Finder = Finder->Next) {
Finder->hContact = NULL;
for (auto &hContact : Contacts(YAMN_DBMODULE)) {
- if (!db_get_s(hContact, YAMN_DBMODULE, "Id", &dbv)) {
+ if (!g_plugin.getString(hContact, "Id", &dbv)) {
if (mir_strcmp(dbv.pszVal, Finder->Name) == 0) {
Finder->hContact = hContact;
- db_set_w(Finder->hContact, YAMN_DBMODULE, "Status", ID_STATUS_ONLINE);
+ g_plugin.setWord(Finder->hContact, "Status", ID_STATUS_ONLINE);
db_set_s(Finder->hContact, "CList", "StatusMsg", Translate("No new mail message"));
if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT))
db_unset(Finder->hContact, "CList", "Hidden");
@@ -302,10 +302,9 @@ int RegisterPOP3Plugin(WPARAM, LPARAM)
// No account contact found, have to create one
Finder->hContact = db_add_contact();
Proto_AddToContact(Finder->hContact, YAMN_DBMODULE);
- db_set_s(Finder->hContact, YAMN_DBMODULE, "Id", Finder->Name);
- db_set_s(Finder->hContact, YAMN_DBMODULE, "Nick", Finder->Name);
- db_set_s(Finder->hContact, "Protocol", "p", YAMN_DBMODULE);
- db_set_w(Finder->hContact, YAMN_DBMODULE, "Status", YAMN_STATUS);
+ g_plugin.setString(Finder->hContact, "Id", Finder->Name);
+ g_plugin.setString(Finder->hContact, "Nick", Finder->Name);
+ g_plugin.setWord(Finder->hContact, "Status", YAMN_STATUS);
}
}
@@ -406,10 +405,10 @@ HYAMNMAIL WINAPI CreatePOP3Mail(HACCOUNT Account, DWORD)
return (HYAMNMAIL)NewMail;
}
-static void SetContactStatus(HACCOUNT account, int status) {
- if ((account->hContact) && (account->NewMailN.Flags & YAMN_ACC_CONT)) {
- db_set_w(account->hContact, YAMN_DBMODULE, "Status", status);
- }
+static void SetContactStatus(HACCOUNT account, int status)
+{
+ if ((account->hContact) && (account->NewMailN.Flags & YAMN_ACC_CONT))
+ g_plugin.setWord(account->hContact, "Status", status);
}
static void PostErrorProc(HPOP3ACCOUNT ActualAccount, void *ParamToBadConnection, DWORD POP3PluginParam, BOOL UseSSL)
diff --git a/plugins/YAMN/src/proto/pop3/pop3opt.cpp b/plugins/YAMN/src/proto/pop3/pop3opt.cpp
index ff4b4f33d6..bd4e2c4220 100644
--- a/plugins/YAMN/src/proto/pop3/pop3opt.cpp
+++ b/plugins/YAMN/src/proto/pop3/pop3opt.cpp
@@ -20,13 +20,13 @@ INT_PTR CALLBACK DlgProcYAMNOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hDlg);
- CheckDlgButton(hDlg, IDC_CHECKTTB, db_get_b(0, YAMN_DBMODULE, YAMN_TTBFCHECK, 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, IDC_CHECKTTB, g_plugin.getByte(YAMN_TTBFCHECK, 1) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_LONGDATE, (optDateTime&SHOWDATELONG) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_SMARTDATE, (optDateTime&SHOWDATENOTODAY) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_NOSECONDS, (optDateTime&SHOWDATENOSECONDS) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg, IDC_MAINMENU, db_get_b(0, YAMN_DBMODULE, YAMN_SHOWMAINMENU, 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg, IDC_YAMNASPROTO, db_get_b(0, YAMN_DBMODULE, YAMN_SHOWASPROTO, 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg, IDC_CLOSEONDELETE, db_get_b(0, YAMN_DBMODULE, YAMN_CLOSEDELETE, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, IDC_MAINMENU, g_plugin.getByte(YAMN_SHOWMAINMENU, 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, IDC_YAMNASPROTO, g_plugin.getByte(YAMN_SHOWASPROTO, 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, IDC_CLOSEONDELETE, g_plugin.getByte(YAMN_CLOSEDELETE, 0) ? BST_CHECKED : BST_UNCHECKED);
break;
case WM_COMMAND:
@@ -48,10 +48,10 @@ INT_PTR CALLBACK DlgProcYAMNOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- db_set_b(0, YAMN_DBMODULE, YAMN_SHOWASPROTO, IsDlgButtonChecked(hDlg, IDC_YAMNASPROTO));
- db_set_b(0, YAMN_DBMODULE, YAMN_SHOWMAINMENU, IsDlgButtonChecked(hDlg, IDC_MAINMENU));
- db_set_b(0, YAMN_DBMODULE, YAMN_CLOSEDELETE, IsDlgButtonChecked(hDlg, IDC_CLOSEONDELETE));
- db_set_b(0, YAMN_DBMODULE, YAMN_TTBFCHECK, IsDlgButtonChecked(hDlg, IDC_CHECKTTB));
+ g_plugin.setByte(YAMN_SHOWASPROTO, IsDlgButtonChecked(hDlg, IDC_YAMNASPROTO));
+ g_plugin.setByte(YAMN_SHOWMAINMENU, IsDlgButtonChecked(hDlg, IDC_MAINMENU));
+ g_plugin.setByte(YAMN_CLOSEDELETE, IsDlgButtonChecked(hDlg, IDC_CLOSEONDELETE));
+ g_plugin.setByte(YAMN_TTBFCHECK, IsDlgButtonChecked(hDlg, IDC_CHECKTTB));
AddTopToolbarIcon(0, 0);
CheckMenuItems();
@@ -60,7 +60,7 @@ INT_PTR CALLBACK DlgProcYAMNOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
if (IsDlgButtonChecked(hDlg, IDC_LONGDATE))optDateTime |= SHOWDATELONG;
if (IsDlgButtonChecked(hDlg, IDC_SMARTDATE))optDateTime |= SHOWDATENOTODAY;
if (IsDlgButtonChecked(hDlg, IDC_NOSECONDS))optDateTime |= SHOWDATENOSECONDS;
- db_set_b(0, YAMN_DBMODULE, YAMN_DBTIMEOPTIONS, optDateTime);
+ g_plugin.setByte(YAMN_DBTIMEOPTIONS, optDateTime);
}
}
break;
diff --git a/plugins/YAMN/src/services.cpp b/plugins/YAMN/src/services.cpp
index 392e6be674..4b605145b8 100644
--- a/plugins/YAMN/src/services.cpp
+++ b/plugins/YAMN/src/services.cpp
@@ -11,7 +11,7 @@ static INT_PTR Service_GetCaps(WPARAM wParam, LPARAM)
if (wParam == PFLAGNUM_2)
return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND;
if (wParam == PFLAGNUM_5) {
- if (db_get_b(0, YAMN_DBMODULE, YAMN_SHOWASPROTO, 1))
+ if (g_plugin.getByte(YAMN_SHOWASPROTO, 1))
return PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND;
return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND;
}
@@ -68,7 +68,7 @@ static INT_PTR ContactApplication(WPARAM wParam, LPARAM)
return 0;
DBVARIANT dbv;
- if (db_get_s(wParam, YAMN_DBMODULE, "Id", &dbv))
+ if (g_plugin.getString(wParam, "Id", &dbv))
return 0;
HACCOUNT ActualAccount = (HACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
@@ -170,7 +170,7 @@ static INT_PTR ContactMailCheck(WPARAM hContact, LPARAM)
return 0;
DBVARIANT dbv;
- if (db_get_s(hContact, YAMN_DBMODULE, "Id", &dbv))
+ if (g_plugin.getString(hContact, "Id", &dbv))
return 0;
HACCOUNT ActualAccount = (HACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
@@ -222,7 +222,7 @@ static INT_PTR ContactMailCheck(WPARAM hContact, LPARAM)
return;
DBVARIANT dbv;
- if (db_get_s(wParam, YAMN_DBMODULE, "Id", &dbv))
+ if (g_plugin.getString(wParam, "Id", &dbv))
return;
HACCOUNT ActualAccount = (HACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
@@ -292,7 +292,7 @@ HBITMAP LoadBmpFromIcon(HICON hIcon)
int AddTopToolbarIcon(WPARAM, LPARAM)
{
- if (db_get_b(0, YAMN_DBMODULE, YAMN_TTBFCHECK, 1)) {
+ if (g_plugin.getByte(YAMN_TTBFCHECK, 1)) {
if (ServiceExists(MS_TTB_REMOVEBUTTON) && hTTButton == nullptr) {
TTBButton btn = {};
btn.pszService = MS_YAMN_FORCECHECK;
@@ -318,11 +318,11 @@ int Shutdown(WPARAM, LPARAM)
{
CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hTTButton, 0);
- db_set_dw(0, YAMN_DBMODULE, YAMN_DBMSGPOSX, HeadPosX);
- db_set_dw(0, YAMN_DBMODULE, YAMN_DBMSGPOSY, HeadPosY);
- db_set_dw(0, YAMN_DBMODULE, YAMN_DBMSGSIZEX, HeadSizeX);
- db_set_dw(0, YAMN_DBMODULE, YAMN_DBMSGSIZEY, HeadSizeY);
- db_set_w(0, YAMN_DBMODULE, YAMN_DBMSGPOSSPLIT, HeadSplitPos);
+ g_plugin.setDword(YAMN_DBMSGPOSX, HeadPosX);
+ g_plugin.setDword(YAMN_DBMSGPOSY, HeadPosY);
+ g_plugin.setDword(YAMN_DBMSGSIZEX, HeadSizeX);
+ g_plugin.setDword(YAMN_DBMSGSIZEY, HeadSizeY);
+ g_plugin.setWord(YAMN_DBMSGPOSSPLIT, HeadSplitPos);
YAMNVar.Shutdown = TRUE;
KillTimer(nullptr, SecTimer);
@@ -441,10 +441,9 @@ void RefreshContact(void)
else if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) {
Finder->hContact = db_add_contact();
Proto_AddToContact(Finder->hContact, YAMN_DBMODULE);
- db_set_s(Finder->hContact, YAMN_DBMODULE, "Id", Finder->Name);
- db_set_s(Finder->hContact, YAMN_DBMODULE, "Nick", Finder->Name);
- db_set_s(Finder->hContact, "Protocol", "p", YAMN_DBMODULE);
- db_set_w(Finder->hContact, YAMN_DBMODULE, "Status", ID_STATUS_ONLINE);
+ g_plugin.setString(Finder->hContact, "Id", Finder->Name);
+ g_plugin.setString(Finder->hContact, "Nick", Finder->Name);
+ g_plugin.setWord(Finder->hContact, "Status", ID_STATUS_ONLINE);
db_set_s(Finder->hContact, "CList", "StatusMsg", Translate("No new mail message"));
}
}
diff --git a/plugins/YAMN/src/yamn.cpp b/plugins/YAMN/src/yamn.cpp
index 9343f0f53f..cd5a8514cc 100644
--- a/plugins/YAMN/src/yamn.cpp
+++ b/plugins/YAMN/src/yamn.cpp
@@ -232,11 +232,11 @@ ChangeIsCountingStatusLabel:
#endif
if (((ActualAccount->isCounting) != 0) != isAccountCounting) {
ActualAccount->isCounting=isAccountCounting;
- WORD cStatus = db_get_w(ActualAccount->hContact, YAMN_DBMODULE, "Status", 0);
+ WORD cStatus = g_plugin.getWord(ActualAccount->hContact, "Status");
switch (cStatus) {
case ID_STATUS_ONLINE:
case ID_STATUS_OFFLINE:
- db_set_w(ActualAccount->hContact, YAMN_DBMODULE, "Status", isAccountCounting?ID_STATUS_ONLINE:ID_STATUS_OFFLINE);
+ g_plugin.setWord(ActualAccount->hContact, "Status", isAccountCounting ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE);
default: break;
}
}