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/Sametime/src/StdAfx.h | 1 + protocols/Sametime/src/sametime.cpp | 43 ++++++++++++++++++++----------------- 2 files changed, 24 insertions(+), 20 deletions(-) (limited to 'protocols/Sametime/src') diff --git a/protocols/Sametime/src/StdAfx.h b/protocols/Sametime/src/StdAfx.h index 5fa7d2b4d3..9f8fe88525 100644 --- a/protocols/Sametime/src/StdAfx.h +++ b/protocols/Sametime/src/StdAfx.h @@ -75,3 +75,4 @@ extern "C" { #include #include #include +#include \ No newline at end of file diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp index 6f0d783b14..faebb0d6c3 100644 --- a/protocols/Sametime/src/sametime.cpp +++ b/protocols/Sametime/src/sametime.cpp @@ -246,7 +246,22 @@ void CSametimeProto::BroadcastNewStatus(int iNewStatus) ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)previous_status, m_iStatus); } -static CSametimeProto* sametime_proto_init(const char* pszProtoName, const wchar_t* tszUserName) +extern "C" int __declspec(dllexport) Load(void) +{ + mir_getLP(&pluginInfo); + pcli = Clist_GetInterface(); + return 0; +} + +extern "C" int __declspec(dllexport) Unload() +{ + g_Instances.destroy(); + return 0; +} + +///////////////////////////////////////////////////////////////////////////////////////// + +static PROTO_INTERFACE* sametime_proto_init(const char* pszProtoName, const wchar_t* tszUserName) { CSametimeProto* proto = new CSametimeProto(pszProtoName, tszUserName); g_Instances.insert(proto); @@ -261,24 +276,12 @@ static int sametime_proto_uninit(PROTO_INTERFACE* ppro) return 0; } -extern "C" int __declspec(dllexport) Load(void) +struct CMPlugin : public CMPluginBase { - mir_getLP(&pluginInfo); - pcli = Clist_GetInterface(); - - PROTOCOLDESCRIPTOR pd = { 0 }; - pd.cbSize = sizeof(pd); - pd.type = PROTOTYPE_PROTOCOL; - pd.szName = "Sametime"; - pd.fnInit = (pfnInitProto)sametime_proto_init; - pd.fnUninit = (pfnUninitProto)sametime_proto_uninit; - Proto_RegisterModule(&pd); - return 0; -} - -extern "C" int __declspec(dllexport) Unload() -{ - g_Instances.destroy(); - return 0; + CMPlugin() : + CMPluginBase("Sametime") + { + RegisterProtocol(PROTOTYPE_PROTOCOL, sametime_proto_init, sametime_proto_uninit); + } } - + g_plugin; -- cgit v1.2.3