summaryrefslogtreecommitdiff
path: root/plugins/Exchange
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-11-12 21:44:56 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-11-12 21:44:56 +0300
commit53fe3e46177d17b4941610de19f5cc6210700cb4 (patch)
treeb67a6bc208dad141f9db14035cd7e42ff2a51872 /plugins/Exchange
parent488214ac8af0c4aeb1a5c1d8fd48368daaf4c4c7 (diff)
db_* functions replaced with g_plugin calls
Diffstat (limited to 'plugins/Exchange')
-rw-r--r--plugins/Exchange/src/dlg_handlers.cpp38
-rw-r--r--plugins/Exchange/src/emails.cpp10
-rw-r--r--plugins/Exchange/src/hooked_events.cpp8
-rw-r--r--plugins/Exchange/src/utils.cpp2
4 files changed, 29 insertions, 29 deletions
diff --git a/plugins/Exchange/src/dlg_handlers.cpp b/plugins/Exchange/src/dlg_handlers.cpp
index ae17cb3e9f..8fd8a3e1c9 100644
--- a/plugins/Exchange/src/dlg_handlers.cpp
+++ b/plugins/Exchange/src/dlg_handlers.cpp
@@ -38,7 +38,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
DBVARIANT dbv = { 0 };
dbv.type = DBVT_ASCIIZ;
- int bCheck = db_get_b(NULL, MODULENAME, "Check", 1);
+ int bCheck = g_plugin.getByte("Check", 1);
wchar_t buffer[4096];
GetStringFromDatabase("Username", L"", buffer, _countof(buffer));
@@ -50,24 +50,24 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
GetStringFromDatabase("Server", L"", buffer, _countof(buffer));
SetDlgItemText(hWnd, IDC_SERVER_EDIT, buffer);
- SetDlgItemInt(hWnd, IDC_PORT_EDIT, db_get_dw(NULL, MODULENAME, "Port", EXCHANGE_PORT), FALSE);
+ SetDlgItemInt(hWnd, IDC_PORT_EDIT, g_plugin.getDword("Port", EXCHANGE_PORT), FALSE);
- SetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, db_get_dw(NULL, MODULENAME, "Interval", DEFAULT_INTERVAL), FALSE);
+ SetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, g_plugin.getDword("Interval", DEFAULT_INTERVAL), FALSE);
- CheckDlgButton(hWnd, IDC_RECONNECT, (db_get_b(NULL, MODULENAME, "Reconnect", 0)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_RECONNECT, (g_plugin.getByte("Reconnect", 0)) ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, db_get_dw(NULL, MODULENAME, "ReconnectInterval", DEFAULT_RECONNECT_INTERVAL), FALSE);
- CheckDlgButton(hWnd, IDC_USE_POPUPS, (BOOL)db_get_b(NULL, MODULENAME, "UsePopups", 0) ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, g_plugin.getDword("ReconnectInterval", DEFAULT_RECONNECT_INTERVAL), FALSE);
+ CheckDlgButton(hWnd, IDC_USE_POPUPS, (BOOL)g_plugin.getByte("UsePopups", 0) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_USE_POPUPS), ServiceExists(MS_POPUP_ADDPOPUPT)); //disable the popups checkbox if no popup module is present
CheckDlgButton(hWnd, IDC_CHECK_EMAILS, (bCheck) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_INTERVAL_EDIT), bCheck);
- int portCheck = db_get_b(NULL, MODULENAME, "UsePortCheck", 1);
+ int portCheck = g_plugin.getByte("UsePortCheck", 1);
CheckDlgButton(hWnd, IDC_USE_PORTCHECK, (portCheck) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PORT_EDIT), portCheck);
- int retries = db_get_b(NULL, MODULENAME, "MaxRetries", MAX_EXCHANGE_CONNECT_RETRIES);
+ int retries = g_plugin.getByte("MaxRetries", MAX_EXCHANGE_CONNECT_RETRIES);
SetDlgItemInt(hWnd, IDC_MAX_RETRIES, retries, FALSE);
EnableWindow(GetDlgItem(hWnd, IDC_RECONNECT_INTERVAL), IsDlgButtonChecked(hWnd, IDC_RECONNECT));
@@ -108,30 +108,30 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- db_set_b(NULL, MODULENAME, "Check", IsDlgButtonChecked(hWnd, IDC_CHECK_EMAILS));
+ g_plugin.setByte("Check", IsDlgButtonChecked(hWnd, IDC_CHECK_EMAILS));
wchar_t buffer[4096];
GetDlgItemText(hWnd, IDC_USER_EDIT, buffer, _countof(buffer));
- db_set_ws(NULL, MODULENAME, "Username", buffer);
+ g_plugin.setWString("Username", buffer);
GetDlgItemText(hWnd, IDC_PASSWORD_EDIT, buffer, _countof(buffer));
- db_set_ws(NULL, MODULENAME, "Password", buffer);
+ g_plugin.setWString("Password", buffer);
GetDlgItemText(hWnd, IDC_SERVER_EDIT, buffer, _countof(buffer));
- db_set_ws(NULL, MODULENAME, "Server", buffer);
+ g_plugin.setWString("Server", buffer);
GetDlgItemText(hWnd, IDC_PORT_EDIT, buffer, _countof(buffer));
- db_set_dw(NULL, MODULENAME, "Port", GetDlgItemInt(hWnd, IDC_PORT_EDIT, nullptr, FALSE));
+ g_plugin.setDword("Port", GetDlgItemInt(hWnd, IDC_PORT_EDIT, nullptr, FALSE));
- db_set_dw(NULL, MODULENAME, "Interval", GetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, nullptr, FALSE));
- db_set_dw(NULL, MODULENAME, "ReconnectInterval", GetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, nullptr, FALSE));
+ g_plugin.setDword("Interval", GetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, nullptr, FALSE));
+ g_plugin.setDword("ReconnectInterval", GetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, nullptr, FALSE));
- db_set_b(NULL, MODULENAME, "Reconnect", IsDlgButtonChecked(hWnd, IDC_RECONNECT));
+ g_plugin.setByte("Reconnect", IsDlgButtonChecked(hWnd, IDC_RECONNECT));
- db_set_b(NULL, MODULENAME, "UsePopups", IsDlgButtonChecked(hWnd, IDC_USE_POPUPS));
- db_set_b(NULL, MODULENAME, "UsePortCheck", IsDlgButtonChecked(hWnd, IDC_USE_PORTCHECK));
+ g_plugin.setByte("UsePopups", IsDlgButtonChecked(hWnd, IDC_USE_POPUPS));
+ g_plugin.setByte("UsePortCheck", IsDlgButtonChecked(hWnd, IDC_USE_PORTCHECK));
- db_set_b(NULL, MODULENAME, "MaxRetries", GetDlgItemInt(hWnd, IDC_MAX_RETRIES, nullptr, FALSE));
+ g_plugin.setByte("MaxRetries", GetDlgItemInt(hWnd, IDC_MAX_RETRIES, nullptr, FALSE));
exchangeServer.Reconnect(); //login info may be changed
UpdateTimers(); //interval might get changed
diff --git a/plugins/Exchange/src/emails.cpp b/plugins/Exchange/src/emails.cpp
index b15f7a8932..dbf2e30884 100644
--- a/plugins/Exchange/src/emails.cpp
+++ b/plugins/Exchange/src/emails.cpp
@@ -36,7 +36,7 @@ CExchangeServer::~CExchangeServer()
int CExchangeServer::Connect(int bForceConnect)
{
- int maxRetries = db_get_b(NULL, MODULENAME, "MaxRetries", MAX_EXCHANGE_CONNECT_RETRIES);
+ int maxRetries = g_plugin.getByte("MaxRetries", MAX_EXCHANGE_CONNECT_RETRIES);
if (bForceConnect) {
bTryConnect = 1;
cConnections = 0;
@@ -67,7 +67,7 @@ int CExchangeServer::Connect(int bForceConnect)
GetStringFromDatabase("Password", L"", password, _countof(password));
GetStringFromDatabase("Server", L"", server, _countof(server));
- int port = db_get_dw(NULL, MODULENAME, "Port", EXCHANGE_PORT);
+ int port = g_plugin.getDword("Port", EXCHANGE_PORT);
if (mir_wstrlen(server) > 0) //only connect if there's a server to connect to
return DoConnect(user, password, server, port);
@@ -139,13 +139,13 @@ void InitSocketAddr(sockaddr_in *addrServer, char *szServer)
else
memcpy(&(addrServer->sin_addr), hp->h_addr, hp->h_length);
- int port = db_get_dw(NULL, MODULENAME, "Port", EXCHANGE_PORT);
+ int port = g_plugin.getDword("Port", EXCHANGE_PORT);
addrServer->sin_port = htons(port);
}
int CExchangeServer::IsServerAvailable()
{
- if (!db_get_b(NULL, MODULENAME, "UsePortCheck", 1))
+ if (!g_plugin.getByte("UsePortCheck", 1))
return 1;
SOCKET sServer = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
@@ -294,7 +294,7 @@ int CExchangeServer::Check(int bNoEmailsNotify)
int ShowMessage(wchar_t *message, int cUnreadEmails)
{
- int usePopups = ServiceExists(MS_POPUP_ADDPOPUPT) ? db_get_b(NULL, MODULENAME, "UsePopups", 0) : 0;
+ int usePopups = ServiceExists(MS_POPUP_ADDPOPUPT) ? g_plugin.getByte("UsePopups", 0) : 0;
if (usePopups)
return ShowPopupMessage(TranslateT("Exchange email"), message, cUnreadEmails);
diff --git a/plugins/Exchange/src/hooked_events.cpp b/plugins/Exchange/src/hooked_events.cpp
index a7a9c2f4f4..42b3cedd1c 100644
--- a/plugins/Exchange/src/hooked_events.cpp
+++ b/plugins/Exchange/src/hooked_events.cpp
@@ -93,14 +93,14 @@ int UpdateTimers()
{
KillTimers();
int interval;
- interval = db_get_dw(NULL, MODULENAME, "Interval", DEFAULT_INTERVAL);
+ interval = g_plugin.getDword("Interval", DEFAULT_INTERVAL);
interval *= 1000; //go from miliseconds to seconds
hCheckTimer = SetTimer(nullptr, 0, interval, (TIMERPROC) OnCheckTimer);
- int bReconnect = db_get_b(NULL, MODULENAME, "Reconnect", 0);
+ int bReconnect = g_plugin.getByte("Reconnect", 0);
if (bReconnect) //user wants to forcefully reconnect every x minutes
{
- interval = db_get_dw(NULL, MODULENAME, "ReconnectInterval", DEFAULT_RECONNECT_INTERVAL);
+ interval = g_plugin.getDword("ReconnectInterval", DEFAULT_RECONNECT_INTERVAL);
interval *= 1000 * 60; //go from miliseconds to seconds to minutes
hReconnectTimer = SetTimer(nullptr, 0, interval, (TIMERPROC) OnReconnectTimer);
}
@@ -132,7 +132,7 @@ VOID CALLBACK OnCheckTimer(HWND, UINT, UINT_PTR, DWORD)
else{
exchangeServer.Connect();
}*/
- int bCheck = db_get_b(NULL, MODULENAME, "Check", 1);
+ int bCheck = g_plugin.getByte("Check", 1);
if (bCheck) //only check if we were told to
{
diff --git a/plugins/Exchange/src/utils.cpp b/plugins/Exchange/src/utils.cpp
index 75b4ef4b93..d133aab166 100644
--- a/plugins/Exchange/src/utils.cpp
+++ b/plugins/Exchange/src/utils.cpp
@@ -113,7 +113,7 @@ int GetStringFromDatabase(char *szSettingName, wchar_t *szError, wchar_t *szResu
DBVARIANT dbv = { 0 };
int res = 1;
dbv.type = DBVT_ASCIIZ;
- if (db_get_ws(NULL, MODULENAME, szSettingName, &dbv) == 0) {
+ if (g_plugin.getWString(szSettingName, &dbv) == 0) {
res = 0;
size_t tmp = mir_wstrlen(dbv.pwszVal);
size_t len = (tmp < size - 1) ? tmp : size - 1;