diff options
author | George Hazan <ghazan@miranda.im> | 2018-05-17 21:37:53 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-05-17 21:37:53 +0300 |
commit | 88b04fed4966b0f1686690cb6101854afb52a5ee (patch) | |
tree | 79b4e574c0849f24907168075c8d0babfde2fde4 /plugins/Exchange | |
parent | 5ebe9c34375bce857ad3160abba67d6ed2beadaf (diff) |
Db3x_mmap, Dbx_mdbx, Exchange, MyDetails, RecentContacts, TopToolBar, WebView => CMPlugin
Diffstat (limited to 'plugins/Exchange')
-rw-r--r-- | plugins/Exchange/src/emails.cpp | 2 | ||||
-rw-r--r-- | plugins/Exchange/src/exchange.cpp | 25 | ||||
-rw-r--r-- | plugins/Exchange/src/hooked_events.cpp | 4 | ||||
-rw-r--r-- | plugins/Exchange/src/stdafx.h | 13 |
4 files changed, 20 insertions, 24 deletions
diff --git a/plugins/Exchange/src/emails.cpp b/plugins/Exchange/src/emails.cpp index 7298a6b902..1cc625746d 100644 --- a/plugins/Exchange/src/emails.cpp +++ b/plugins/Exchange/src/emails.cpp @@ -326,7 +326,7 @@ int ShowEmailsWindow(int cUnreadEmails) {
if (cUnreadEmails > 0) { //show window only if there are unread emails
if (!hEmailsDlg)
- hEmailsDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EMAILS), nullptr, DlgProcEmails);
+ hEmailsDlg = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EMAILS), nullptr, DlgProcEmails);
SetWindowLongPtr(hEmailsDlg, GWLP_USERDATA, cUnreadEmails);
if (IsWindowVisible(hEmailsDlg))
diff --git a/plugins/Exchange/src/exchange.cpp b/plugins/Exchange/src/exchange.cpp index d9932b1b80..2c80074eda 100644 --- a/plugins/Exchange/src/exchange.cpp +++ b/plugins/Exchange/src/exchange.cpp @@ -20,15 +20,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-char ModuleName[] = "ExchangeNotify";
-HINSTANCE hInstance;
HICON hiMailIcon = nullptr;
HWND hEmailsDlg = nullptr;
int hLangpack=0;
+CMPlugin g_plugin;
CExchangeServer exchangeServer;
-PLUGININFOEX pluginInfo = {
+/////////////////////////////////////////////////////////////////////////////////////////
+
+PLUGININFOEX pluginInfo =
+{
sizeof(PLUGININFOEX),
__PLUGIN_DISPLAY_NAME,
__VERSION_DWORD,
@@ -45,31 +47,22 @@ extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD) return &pluginInfo;
}
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_EXCHANGE, MIID_LAST};
+/////////////////////////////////////////////////////////////////////////////////////////
extern "C" int __declspec(dllexport) Load()
{
mir_getLP( &pluginInfo );
- hiMailIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MAIL));
+ hiMailIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_MAIL));
InitServices();
HookEvents();
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload()
{
DestroyServices();
UnhookEvents();
return 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID)
-{
- hInstance = hinstDLL; //save global instance
- if (fdwReason == DLL_PROCESS_ATTACH)
- DisableThreadLibraryCalls(hinstDLL);
-
- return TRUE;
-}
diff --git a/plugins/Exchange/src/hooked_events.cpp b/plugins/Exchange/src/hooked_events.cpp index 31c57720c9..702b8ad7b1 100644 --- a/plugins/Exchange/src/hooked_events.cpp +++ b/plugins/Exchange/src/hooked_events.cpp @@ -63,7 +63,7 @@ int OnModulesLoaded(WPARAM, LPARAM) mi.name.w = LPGENW("Check exchange mailbox");
Menu_AddMainMenuItem(&mi);
- hEmailsDlg = nullptr; //CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EMAILS), NULL, DlgProcEmails); //create emails window
+ hEmailsDlg = nullptr; //CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EMAILS), NULL, DlgProcEmails); //create emails window
FirstTimeCheck();
// CheckEmail();
return 0;
@@ -74,7 +74,7 @@ int OnOptionsInitialise(WPARAM wParam, LPARAM) {
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 100000000;
- odp.hInstance = hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_EXCHANGE);
odp.szTitle.w = LPGENW("Exchange notify");
odp.szGroup.w = LPGENW("Plugins");
diff --git a/plugins/Exchange/src/stdafx.h b/plugins/Exchange/src/stdafx.h index 5c04e1c8f7..213ee4ea42 100644 --- a/plugins/Exchange/src/stdafx.h +++ b/plugins/Exchange/src/stdafx.h @@ -31,8 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <stdlib.h>
#include <string.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_core.h>
#include <m_popup.h>
@@ -50,11 +48,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "services.h"
#include "hooked_events.h"
-extern char ModuleName[];
-extern HINSTANCE hInstance;
+#define ModuleName "ExchangeNotify"
+
extern HICON hiMailIcon;
extern HWND hEmailsDlg;
-
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(ModuleName)
+ {}
+};
#endif //M_EXCHANGE_COMMONHEADERS_H
\ No newline at end of file |