From a905c9c3f92fd54f37a5466649ac378db69e7cb0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 28 Mar 2018 14:29:31 +0300 Subject: all protocols rewritten to CMPluginBase --- protocols/MRA/src/Mra.cpp | 50 ++++++++++++++++++++++++---------------------- protocols/MRA/src/stdafx.h | 1 + 2 files changed, 27 insertions(+), 24 deletions(-) (limited to 'protocols/MRA') diff --git a/protocols/MRA/src/Mra.cpp b/protocols/MRA/src/Mra.cpp index 0c863e3c3a..49eded7d0a 100644 --- a/protocols/MRA/src/Mra.cpp +++ b/protocols/MRA/src/Mra.cpp @@ -50,22 +50,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) /////////////////////////////////////////////////////////////////////////////// -static CMraProto* mraProtoInit(const char* pszProtoName, const wchar_t* tszUserName) -{ - CMraProto *ppro = new CMraProto(pszProtoName, tszUserName); - g_Instances.insert(ppro); - return ppro; -} - -static int mraProtoUninit(CMraProto *ppro) -{ - g_Instances.remove(ppro); - delete ppro; - return 0; -} - -/////////////////////////////////////////////////////////////////////////////// - static int __cdecl OnPreShutdown(WPARAM, LPARAM) { g_bShutdown = true; @@ -81,14 +65,6 @@ extern "C" __declspec(dllexport) int Load(void) InitXStatusIcons(); HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); - - PROTOCOLDESCRIPTOR pd = { 0 }; - pd.cbSize = sizeof(pd); - pd.szName = "MRA"; - pd.type = PROTOTYPE_PROTOCOL; - pd.fnInit = (pfnInitProto)mraProtoInit; - pd.fnUninit = (pfnUninitProto)mraProtoUninit; - Proto_RegisterModule(&pd); return 0; } @@ -102,3 +78,29 @@ extern "C" __declspec(dllexport) int Unload(void) return 0; } + +///////////////////////////////////////////////////////////////////////////////////////// + +static PROTO_INTERFACE* mraProtoInit(const char* pszProtoName, const wchar_t* tszUserName) +{ + CMraProto *ppro = new CMraProto(pszProtoName, tszUserName); + g_Instances.insert(ppro); + return ppro; +} + +static int mraProtoUninit(PROTO_INTERFACE *ppro) +{ + g_Instances.remove((CMraProto*)ppro); + delete (CMraProto*)ppro; + return 0; +} + +struct CMPlugin : public CMPluginBase +{ + CMPlugin() : + CMPluginBase("MRA") + { + RegisterProtocol(PROTOTYPE_PROTOCOL, mraProtoInit, mraProtoUninit); + } +} + g_plugin; diff --git a/protocols/MRA/src/stdafx.h b/protocols/MRA/src/stdafx.h index e7bd1a649a..dd94bdfbb9 100644 --- a/protocols/MRA/src/stdafx.h +++ b/protocols/MRA/src/stdafx.h @@ -50,6 +50,7 @@ #include #include #include +#include #define PROTO_VERSION_MAJOR 1 #define PROTO_VERSION_MINOR 21 -- cgit v1.2.3