From 7639f72273189df60566755c0d5f1e4ab7201b67 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 17 May 2018 20:51:37 +0300 Subject: NewAwaySys, NewEventNotify, NewXstatusNotify, NoHistory, NotesReminders, NotifyAnything, Nudge => CMPlugin --- plugins/NewEventNotify/src/main.cpp | 43 ++++++++++++++++----------------- plugins/NewEventNotify/src/menuitem.cpp | 6 ++--- plugins/NewEventNotify/src/stdafx.h | 12 +++++---- 3 files changed, 31 insertions(+), 30 deletions(-) (limited to 'plugins/NewEventNotify') diff --git a/plugins/NewEventNotify/src/main.cpp b/plugins/NewEventNotify/src/main.cpp index 571abdd1be..973c77ac37 100644 --- a/plugins/NewEventNotify/src/main.cpp +++ b/plugins/NewEventNotify/src/main.cpp @@ -26,14 +26,19 @@ extern PLUGIN_DATA* PopupList[20]; +PLUGIN_OPTIONS pluginOptions; + //--------------------------- //---Some global variables for the plugin CLIST_INTERFACE *pcli; -HINSTANCE g_hInst; -PLUGIN_OPTIONS pluginOptions; +CMPlugin g_plugin; int hLangpack; -PLUGININFOEX pluginInfo = { + +///////////////////////////////////////////////////////////////////////////////////////// + +PLUGININFOEX pluginInfo = +{ sizeof(PLUGININFOEX), __PLUGIN_NAME, PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), @@ -46,12 +51,17 @@ PLUGININFOEX pluginInfo = { {0x3503D584, 0x6234, 0x4BEF, {0xA5, 0x53, 0x6C, 0x1B, 0x9C, 0xD4, 0x71, 0xF2}} }; -//--------------------------- -//---Hooks +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) +{ + return &pluginInfo; +} + +///////////////////////////////////////////////////////////////////////////////////////// +// Hooks //---Called when a new event is added to the database -//wParam: contact-handle -//lParam: dbevent-handle +// wParam: contact-handle +// lParam: dbevent-handle int HookedNewEvent(WPARAM hContact, LPARAM hDbEvent) { @@ -117,17 +127,11 @@ int HookedInit(WPARAM, LPARAM) //---Called when an options dialog has to be created int HookedOptions(WPARAM wParam, LPARAM) { - OptionsAdd(g_hInst, wParam); + OptionsAdd(g_plugin.getInst(), wParam); return 0; } -//--------------------------- -//---Exported Functions - -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) -{ - return &pluginInfo; -} +///////////////////////////////////////////////////////////////////////////////////////// extern "C" __declspec(dllexport) int Load(void) { @@ -138,21 +142,16 @@ extern "C" __declspec(dllexport) int Load(void) pcli = Clist_GetInterface(); OptionsInit(&pluginOptions); - pluginOptions.hInst = g_hInst; return 0; } +///////////////////////////////////////////////////////////////////////////////////////// + extern "C" __declspec(dllexport) int Unload(void) { return 0; } -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) -{ - g_hInst = hinstDLL; - return TRUE; -} - //------------------------------------- //---Check Window Message function diff --git a/plugins/NewEventNotify/src/menuitem.cpp b/plugins/NewEventNotify/src/menuitem.cpp index 63be89ce14..d2c04d4d04 100644 --- a/plugins/NewEventNotify/src/menuitem.cpp +++ b/plugins/NewEventNotify/src/menuitem.cpp @@ -40,9 +40,9 @@ static INT_PTR MenuitemNotifyCmd(WPARAM, LPARAM) int MenuitemUpdate(BOOL bStatus) { if (bStatus) - Menu_ModifyItem(hMenuitemNotify, MENUITEM_DISABLE, LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_ENABLED))); + Menu_ModifyItem(hMenuitemNotify, MENUITEM_DISABLE, LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ENABLED))); else - Menu_ModifyItem(hMenuitemNotify, MENUITEM_ENABLE, LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_DISABLED))); + Menu_ModifyItem(hMenuitemNotify, MENUITEM_ENABLE, LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_DISABLED))); return 0; } @@ -56,7 +56,7 @@ int MenuitemInit(BOOL bStatus) SET_UID(mi, 0x7aed93f7, 0x835, 0x4ff6, 0xb1, 0x34, 0xae, 0x0, 0x21, 0x2a, 0xd7, 0x81); mi.root = hRoot; mi.position = 1; - mi.hIcolibItem = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_ENABLED)); + mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ENABLED)); mi.pszService = MS_NEN_MENUNOTIFY; mi.flags = 0; hMenuitemNotify = Menu_AddMainMenuItem(&mi); diff --git a/plugins/NewEventNotify/src/stdafx.h b/plugins/NewEventNotify/src/stdafx.h index 3a9fe248b7..b36d98cf32 100644 --- a/plugins/NewEventNotify/src/stdafx.h +++ b/plugins/NewEventNotify/src/stdafx.h @@ -32,8 +32,6 @@ #include #include -#define __NO_CMPLUGIN_NEEDED - #include #include #include @@ -150,9 +148,15 @@ //--------------------------- //---Structures +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN(MODULE) + {} +}; + struct PLUGIN_OPTIONS { - HINSTANCE hInst; BOOL bDisable; BOOL bPreview; BOOL bMenuitem; @@ -226,5 +230,3 @@ int MenuitemInit(BOOL bStatus); int MenuitemUpdate(BOOL bStatus); int NumberPopupData(MCONTACT hContact, int eventType); int CheckMsgWnd(MCONTACT hContact); - -extern HINSTANCE g_hInst; -- cgit v1.2.3