summaryrefslogtreecommitdiff
path: root/protocols/MRA
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-28 14:29:31 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-28 14:29:31 +0300
commita905c9c3f92fd54f37a5466649ac378db69e7cb0 (patch)
tree87a60dadfbf9fd8d916ea9100c26b6e314293242 /protocols/MRA
parentd75fed3bfc9c252f5d20b889e0bec95fb0a4527e (diff)
all protocols rewritten to CMPluginBase
Diffstat (limited to 'protocols/MRA')
-rw-r--r--protocols/MRA/src/Mra.cpp50
-rw-r--r--protocols/MRA/src/stdafx.h1
2 files changed, 27 insertions, 24 deletions
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 <m_xstatus.h>
#include <m_nudge.h>
#include <m_proto_listeningto.h>
+#include <m_plugin.h>
#define PROTO_VERSION_MAJOR 1
#define PROTO_VERSION_MINOR 21