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/MobileState/src | |
parent | 5ebe9c34375bce857ad3160abba67d6ed2beadaf (diff) |
Db3x_mmap, Dbx_mdbx, Exchange, MyDetails, RecentContacts, TopToolBar, WebView => CMPlugin
Diffstat (limited to 'plugins/MobileState/src')
-rw-r--r-- | plugins/MobileState/src/main.cpp | 29 | ||||
-rw-r--r-- | plugins/MobileState/src/stdafx.h | 8 |
2 files changed, 23 insertions, 14 deletions
diff --git a/plugins/MobileState/src/main.cpp b/plugins/MobileState/src/main.cpp index 46a3f348f1..2ced60c6cb 100644 --- a/plugins/MobileState/src/main.cpp +++ b/plugins/MobileState/src/main.cpp @@ -19,10 +19,15 @@ #include "stdafx.h"
-HINSTANCE g_hInst;
int hLangpack;
+CMPlugin g_plugin;
+
HANDLE hExtraIcon = nullptr;
+static IconItem icon = { LPGEN("Mobile State"), "mobile_icon", IDI_MOBILE };
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -36,19 +41,13 @@ PLUGININFOEX pluginInfo = { { 0xf0ba32d0, 0xcd07, 0x4a9c, { 0x92, 0x6b, 0x5a, 0x1f, 0xf2, 0x1c, 0x3c, 0x10 } }
};
-static IconItem icon = { LPGEN("Mobile State"), "mobile_icon", IDI_MOBILE };
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- g_hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
bool hasMobileClient(MCONTACT hContact, LPARAM)
{
char *proto = GetContactProto(hContact);
@@ -67,7 +66,9 @@ bool hasMobileClient(MCONTACT hContact, LPARAM) return false;
}
-int ExtraIconsApply(WPARAM wParam, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static int ExtraIconsApply(WPARAM wParam, LPARAM lParam)
{
if (wParam == NULL)
return 0;
@@ -80,7 +81,7 @@ int ExtraIconsApply(WPARAM wParam, LPARAM lParam) return 0;
}
-int onContactSettingChanged(WPARAM wParam, LPARAM lParam)
+static int onContactSettingChanged(WPARAM wParam, LPARAM lParam)
{
char *proto = GetContactProto(wParam);
if (!proto)
@@ -93,7 +94,7 @@ int onContactSettingChanged(WPARAM wParam, LPARAM lParam) return 0;
}
-int onModulesLoaded(WPARAM, LPARAM)
+static int onModulesLoaded(WPARAM, LPARAM)
{
// Set initial value for all contacts
for (auto &hContact : Contacts())
@@ -111,13 +112,15 @@ extern "C" int __declspec(dllexport) Load(void) HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, ExtraIconsApply);
// IcoLib support
- Icon_Register(g_hInst, "Mobile State", &icon, 1);
+ Icon_Register(g_plugin.getInst(), "Mobile State", &icon, 1);
// Extra icons
hExtraIcon = ExtraIcon_RegisterIcolib("mobilestate", LPGEN("Mobile State"), "mobile_icon");
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
diff --git a/plugins/MobileState/src/stdafx.h b/plugins/MobileState/src/stdafx.h index d0090adf55..0c59a5a1bd 100644 --- a/plugins/MobileState/src/stdafx.h +++ b/plugins/MobileState/src/stdafx.h @@ -23,7 +23,6 @@ #include <malloc.h>
// Miranda API headers
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_database.h>
#include <m_protocols.h>
@@ -37,3 +36,10 @@ #include "clients.h"
#define MODULENAME "MobileState"
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {}
+};
|