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/IRCG/src/main.cpp | 49 ++++++++++++++++++++++++--------------------- protocols/IRCG/src/stdafx.h | 1 + 2 files changed, 27 insertions(+), 23 deletions(-) (limited to 'protocols/IRCG') diff --git a/protocols/IRCG/src/main.cpp b/protocols/IRCG/src/main.cpp index c821c183c2..81ff6f6581 100644 --- a/protocols/IRCG/src/main.cpp +++ b/protocols/IRCG/src/main.cpp @@ -73,20 +73,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC ///////////////////////////////////////////////////////////////////////////////////////// -static CIrcProto* ircProtoInit(const char* pszProtoName, const wchar_t* tszUserName) -{ - CIrcProto *ppro = new CIrcProto(pszProtoName, tszUserName); - g_Instances.insert(ppro); - return ppro; -} - -static int ircProtoUninit(CIrcProto *ppro) -{ - g_Instances.remove((CIrcProto*)ppro); - delete ppro; - return 0; -} - extern "C" int __declspec(dllexport) Load() { mir_getLP(&pluginInfo); @@ -96,15 +82,6 @@ extern "C" int __declspec(dllexport) Load() InitIcons(); InitServers(); InitContactMenus(); - - // register protocol - PROTOCOLDESCRIPTOR pd = { 0 }; - pd.cbSize = sizeof(pd); - pd.szName = "IRC"; - pd.type = PROTOTYPE_PROTOCOL; - pd.fnInit = (pfnInitProto)ircProtoInit; - pd.fnUninit = (pfnUninitProto)ircProtoUninit; - Proto_RegisterModule(&pd); return 0; } @@ -116,3 +93,29 @@ extern "C" int __declspec(dllexport) Unload(void) UninitTimers(); return 0; } + +///////////////////////////////////////////////////////////////////////////////////////// + +static PROTO_INTERFACE* ircProtoInit(const char* pszProtoName, const wchar_t* tszUserName) +{ + CIrcProto *ppro = new CIrcProto(pszProtoName, tszUserName); + g_Instances.insert(ppro); + return ppro; +} + +static int ircProtoUninit(PROTO_INTERFACE *ppro) +{ + g_Instances.remove((CIrcProto*)ppro); + delete (CIrcProto*)ppro; + return 0; +} + +struct CMPlugin : public CMPluginBase +{ + CMPlugin() : + CMPluginBase("IRC") + { + RegisterProtocol(PROTOTYPE_PROTOCOL, ircProtoInit, ircProtoUninit); + } +} + g_plugin; diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h index 16f753c395..eef1cb6a10 100644 --- a/protocols/IRCG/src/stdafx.h +++ b/protocols/IRCG/src/stdafx.h @@ -66,6 +66,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "m_string.h" #include "win2k.h" #include "m_gui.h" +#include #include "resource.h" -- cgit v1.2.3