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/MSN/src/msn.cpp | 46 +++++++++++++++++++++++++--------------------- protocols/MSN/src/stdafx.h | 1 + 2 files changed, 26 insertions(+), 21 deletions(-) (limited to 'protocols/MSN/src') diff --git a/protocols/MSN/src/msn.cpp b/protocols/MSN/src/msn.cpp index 697c1f6569..71dc64eb4f 100644 --- a/protocols/MSN/src/msn.cpp +++ b/protocols/MSN/src/msn.cpp @@ -82,19 +82,6 @@ static int OnModulesLoaded(WPARAM, LPARAM) return 0; } -static CMsnProto* msnProtoInit(const char* pszProtoName, const wchar_t* tszUserName) -{ - CMsnProto *ppro = new CMsnProto(pszProtoName, tszUserName); - g_Instances.insert(ppro); - return ppro; -} - -static int msnProtoUninit(CMsnProto* ppro) -{ - g_Instances.remove(ppro); - return 0; -} - // Performs a primary set of actions upon plugin loading extern "C" int __declspec(dllexport) Load(void) { @@ -103,14 +90,6 @@ extern "C" int __declspec(dllexport) Load(void) HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); - PROTOCOLDESCRIPTOR pd = { 0 }; - pd.cbSize = sizeof(pd); - pd.szName = "MSN"; - pd.fnInit = (pfnInitProto)msnProtoInit; - pd.fnUninit = (pfnUninitProto)msnProtoUninit; - pd.type = PROTOTYPE_PROTOCOL; - Proto_RegisterModule(&pd); - MsnInitIcons(); MSN_InitContactMenu(); return 0; @@ -135,3 +114,28 @@ extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD) // MirandaInterfaces - returns the protocol interface to the core extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST }; + +///////////////////////////////////////////////////////////////////////////////////////// + +static PROTO_INTERFACE* msnProtoInit(const char *pszProtoName, const wchar_t *tszUserName) +{ + CMsnProto *ppro = new CMsnProto(pszProtoName, tszUserName); + g_Instances.insert(ppro); + return ppro; +} + +static int msnProtoUninit(PROTO_INTERFACE *ppro) +{ + g_Instances.remove((CMsnProto*)ppro); + return 0; +} + +struct CMPlugin : public CMPluginBase +{ + CMPlugin() : + CMPluginBase("MSN") + { + RegisterProtocol(PROTOTYPE_PROTOCOL, msnProtoInit, msnProtoUninit); + } +} + g_plugin; diff --git a/protocols/MSN/src/stdafx.h b/protocols/MSN/src/stdafx.h index df61064891..1eb9ce25a3 100644 --- a/protocols/MSN/src/stdafx.h +++ b/protocols/MSN/src/stdafx.h @@ -63,6 +63,7 @@ along with this program. If not, see . #include #include #include +#include #include "m_proto_listeningto.h" #include "m_folders.h" -- cgit v1.2.3