summaryrefslogtreecommitdiff
path: root/plugins/Exchange
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-20 15:08:48 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-20 15:08:48 +0300
commit8a74e7495ce5ad39de4f5c25121a84d35df90c36 (patch)
tree03e5b4870f09a3163306740c2eebee47bc15b042 /plugins/Exchange
parentc5bf7d6123dd1c3b82ccb8fdb1b068077e9d56d4 (diff)
CMPlugin to receive a reference to PLUGININFOEX
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/exchange.cpp12
-rw-r--r--plugins/Exchange/src/hooked_events.cpp8
-rw-r--r--plugins/Exchange/src/stdafx.h6
-rw-r--r--plugins/Exchange/src/utils.cpp2
6 files changed, 39 insertions, 37 deletions
diff --git a/plugins/Exchange/src/dlg_handlers.cpp b/plugins/Exchange/src/dlg_handlers.cpp
index 2f1f5d62eb..ae17cb3e9f 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 = db_get_b(NULL, MODULENAME, "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, db_get_dw(NULL, MODULENAME, "Port", EXCHANGE_PORT), FALSE);
- SetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, db_get_dw(NULL, ModuleName, "Interval", DEFAULT_INTERVAL), FALSE);
+ SetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, db_get_dw(NULL, MODULENAME, "Interval", DEFAULT_INTERVAL), FALSE);
- CheckDlgButton(hWnd, IDC_RECONNECT, (db_get_b(NULL, ModuleName, "Reconnect", 0)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_RECONNECT, (db_get_b(NULL, MODULENAME, "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, 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);
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 = db_get_b(NULL, MODULENAME, "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 = db_get_b(NULL, MODULENAME, "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));
+ db_set_b(NULL, MODULENAME, "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);
+ db_set_ws(NULL, MODULENAME, "Username", buffer);
GetDlgItemText(hWnd, IDC_PASSWORD_EDIT, buffer, _countof(buffer));
- db_set_ws(NULL, ModuleName, "Password", buffer);
+ db_set_ws(NULL, MODULENAME, "Password", buffer);
GetDlgItemText(hWnd, IDC_SERVER_EDIT, buffer, _countof(buffer));
- db_set_ws(NULL, ModuleName, "Server", buffer);
+ db_set_ws(NULL, MODULENAME, "Server", buffer);
GetDlgItemText(hWnd, IDC_PORT_EDIT, buffer, _countof(buffer));
- db_set_dw(NULL, ModuleName, "Port", GetDlgItemInt(hWnd, IDC_PORT_EDIT, nullptr, FALSE));
+ db_set_dw(NULL, MODULENAME, "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));
+ 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));
- db_set_b(NULL, ModuleName, "Reconnect", IsDlgButtonChecked(hWnd, IDC_RECONNECT));
+ db_set_b(NULL, MODULENAME, "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));
+ db_set_b(NULL, MODULENAME, "UsePopups", IsDlgButtonChecked(hWnd, IDC_USE_POPUPS));
+ db_set_b(NULL, MODULENAME, "UsePortCheck", IsDlgButtonChecked(hWnd, IDC_USE_PORTCHECK));
- db_set_b(NULL, ModuleName, "MaxRetries", GetDlgItemInt(hWnd, IDC_MAX_RETRIES, nullptr, FALSE));
+ db_set_b(NULL, MODULENAME, "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 1cc625746d..b15f7a8932 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 = db_get_b(NULL, MODULENAME, "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 = db_get_dw(NULL, MODULENAME, "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 = db_get_dw(NULL, MODULENAME, "Port", EXCHANGE_PORT);
addrServer->sin_port = htons(port);
}
int CExchangeServer::IsServerAvailable()
{
- if (!db_get_b(NULL, ModuleName, "UsePortCheck", 1))
+ if (!db_get_b(NULL, MODULENAME, "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) ? db_get_b(NULL, MODULENAME, "UsePopups", 0) : 0;
if (usePopups)
return ShowPopupMessage(TranslateT("Exchange email"), message, cUnreadEmails);
diff --git a/plugins/Exchange/src/exchange.cpp b/plugins/Exchange/src/exchange.cpp
index 56596f5577..83265c8568 100644
--- a/plugins/Exchange/src/exchange.cpp
+++ b/plugins/Exchange/src/exchange.cpp
@@ -30,7 +30,7 @@ CExchangeServer exchangeServer;
/////////////////////////////////////////////////////////////////////////////////////////
-PLUGININFOEX pluginInfo =
+PLUGININFOEX pluginInfoEx =
{
sizeof(PLUGININFOEX),
__PLUGIN_DISPLAY_NAME,
@@ -43,16 +43,20 @@ PLUGININFOEX pluginInfo =
{0x2fd0df15, 0x7098, 0x41ce, {0xaa, 0x92, 0xff, 0x62, 0x18, 0x06, 0xe3, 0x8b}} //{2fd0df15-7098-41ce-aa92-ff621806e38b}
};
-extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
+CMPlugin::CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
+{}
+
+extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
{
- return &pluginInfo;
+ return &pluginInfoEx;
}
/////////////////////////////////////////////////////////////////////////////////////////
extern "C" int __declspec(dllexport) Load()
{
- mir_getLP( &pluginInfo );
+ mir_getLP(&pluginInfoEx);
hiMailIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_MAIL));
InitServices();
HookEvents();
diff --git a/plugins/Exchange/src/hooked_events.cpp b/plugins/Exchange/src/hooked_events.cpp
index 702b8ad7b1..3286622a22 100644
--- a/plugins/Exchange/src/hooked_events.cpp
+++ b/plugins/Exchange/src/hooked_events.cpp
@@ -105,14 +105,14 @@ int UpdateTimers()
{
KillTimers();
int interval;
- interval = db_get_dw(NULL, ModuleName, "Interval", DEFAULT_INTERVAL);
+ interval = db_get_dw(NULL, MODULENAME, "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 = db_get_b(NULL, MODULENAME, "Reconnect", 0);
if (bReconnect) //user wants to forcefully reconnect every x minutes
{
- interval = db_get_dw(NULL, ModuleName, "ReconnectInterval", DEFAULT_RECONNECT_INTERVAL);
+ interval = db_get_dw(NULL, MODULENAME, "ReconnectInterval", DEFAULT_RECONNECT_INTERVAL);
interval *= 1000 * 60; //go from miliseconds to seconds to minutes
hReconnectTimer = SetTimer(nullptr, 0, interval, (TIMERPROC) OnReconnectTimer);
}
@@ -144,7 +144,7 @@ VOID CALLBACK OnCheckTimer(HWND, UINT, UINT_PTR, DWORD)
else{
exchangeServer.Connect();
}*/
- int bCheck = db_get_b(NULL, ModuleName, "Check", 1);
+ int bCheck = db_get_b(NULL, MODULENAME, "Check", 1);
if (bCheck) //only check if we were told to
{
diff --git a/plugins/Exchange/src/stdafx.h b/plugins/Exchange/src/stdafx.h
index 213ee4ea42..1bca507c9d 100644
--- a/plugins/Exchange/src/stdafx.h
+++ b/plugins/Exchange/src/stdafx.h
@@ -48,16 +48,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "services.h"
#include "hooked_events.h"
-#define ModuleName "ExchangeNotify"
+#define MODULENAME "ExchangeNotify"
extern HICON hiMailIcon;
extern HWND hEmailsDlg;
struct CMPlugin : public PLUGIN<CMPlugin>
{
- CMPlugin() :
- PLUGIN<CMPlugin>(ModuleName)
- {}
+ CMPlugin();
};
#endif //M_EXCHANGE_COMMONHEADERS_H \ No newline at end of file
diff --git a/plugins/Exchange/src/utils.cpp b/plugins/Exchange/src/utils.cpp
index 3316ce41b3..96153d13b1 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 (db_get_ws(NULL, MODULENAME, szSettingName, &dbv) == 0) {
res = 0;
size_t tmp = mir_wstrlen(dbv.ptszVal);
size_t len = (tmp < size - 1) ? tmp : size - 1;