From 88b04fed4966b0f1686690cb6101854afb52a5ee Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 17 May 2018 21:37:53 +0300 Subject: Db3x_mmap, Dbx_mdbx, Exchange, MyDetails, RecentContacts, TopToolBar, WebView => CMPlugin --- plugins/MobileState/src/main.cpp | 29 ++++++++++++++++------------- plugins/MobileState/src/stdafx.h | 8 +++++++- 2 files changed, 23 insertions(+), 14 deletions(-) (limited to 'plugins/MobileState') 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 // Miranda API headers -#define __NO_CMPLUGIN_NEEDED #include #include #include @@ -37,3 +36,10 @@ #include "clients.h" #define MODULENAME "MobileState" + +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN(MODULENAME) + {} +}; -- cgit v1.2.3