diff options
author | George Hazan <ghazan@miranda.im> | 2018-05-17 20:51:37 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-05-17 20:51:37 +0300 |
commit | 7639f72273189df60566755c0d5f1e4ab7201b67 (patch) | |
tree | 94a51765449331befe968a90b48cbf08fa83e6ed /plugins/NoHistory/src | |
parent | 523f3588b6f21adcc4bcf3ec3ffad05e2298863a (diff) |
NewAwaySys, NewEventNotify, NewXstatusNotify, NoHistory, NotesReminders, NotifyAnything, Nudge => CMPlugin
Diffstat (limited to 'plugins/NoHistory/src')
-rw-r--r-- | plugins/NoHistory/src/dllmain.cpp | 16 | ||||
-rw-r--r-- | plugins/NoHistory/src/icons.cpp | 2 | ||||
-rw-r--r-- | plugins/NoHistory/src/options.cpp | 2 | ||||
-rw-r--r-- | plugins/NoHistory/src/stdafx.h | 15 |
4 files changed, 19 insertions, 16 deletions
diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index cbd5db623c..9b03d1d110 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -1,7 +1,7 @@ #include "stdafx.h"
-HINSTANCE hInst;
int hLangpack = 0;
+CMPlugin g_plugin;
// add icon to srmm status icons
static void SrmmMenu_UpdateIcon(MCONTACT hContact);
@@ -41,17 +41,13 @@ PLUGININFOEX pluginInfo = {0xb25e8c7b, 0x292b, 0x495a, {0x9f, 0xb8, 0xa4, 0xc3, 0xd4, 0xee, 0xb0, 0x4b}}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec (dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
void RemoveReadEvents(MCONTACT hContact = 0)
{
DBEVENTINFO info = {};
@@ -240,7 +236,9 @@ void SrmmMenu_Load() HookEvent(ME_MSG_ICONPRESSED, IconPressed);
}
-int ModulesLoaded(WPARAM, LPARAM)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static int ModulesLoaded(WPARAM, LPARAM)
{
// create contact menu item
CMenuItem mi;
@@ -285,6 +283,8 @@ extern "C" __declspec (dllexport) int Load() return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec (dllexport) int Unload(void)
{
RemoveReadEvents();
diff --git a/plugins/NoHistory/src/icons.cpp b/plugins/NoHistory/src/icons.cpp index c718ecd356..d5c504abcc 100644 --- a/plugins/NoHistory/src/icons.cpp +++ b/plugins/NoHistory/src/icons.cpp @@ -19,7 +19,7 @@ int ReloadIcons(WPARAM, LPARAM) void InitIcons()
{
- Icon_Register(hInst, LPGEN("No History"), iconList, _countof(iconList), MODULE);
+ Icon_Register(g_plugin.getInst(), LPGEN("No History"), iconList, _countof(iconList), MODULE);
ReloadIcons(0, 0);
diff --git a/plugins/NoHistory/src/options.cpp b/plugins/NoHistory/src/options.cpp index a631c749fa..da4d9555d2 100644 --- a/plugins/NoHistory/src/options.cpp +++ b/plugins/NoHistory/src/options.cpp @@ -221,7 +221,7 @@ int OptInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.flags = ODPF_BOLDGROUPS|ODPF_UNICODE;
odp.position = -790000000;
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT);
odp.szTitle.w = LPGENW("No History");
odp.szGroup.w = LPGENW("History");
diff --git a/plugins/NoHistory/src/stdafx.h b/plugins/NoHistory/src/stdafx.h index 7ce31be872..295a3b01df 100644 --- a/plugins/NoHistory/src/stdafx.h +++ b/plugins/NoHistory/src/stdafx.h @@ -4,7 +4,6 @@ #include <windows.h>
#include <commctrl.h>
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
#include <newpluginapi.h>
#include <m_database.h>
@@ -22,13 +21,17 @@ #include "options.h"
#include "version.h"
-#define MODULE "NoHistory"
-#define DBSETTING_REMOVE "RemoveHistory"
+#define MODULE "NoHistory"
-extern HINSTANCE hInst;
+#define DBSETTING_REMOVE "RemoveHistory"
-#endif
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULE)
+ {}
+};
void SrmmMenu_Load();
-
+#endif
|