From 81ce57622c3166830b23eae534dacc6b008c659d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 28 Mar 2018 16:34:30 +0300 Subject: common protocol instance management code went into template --- protocols/Sametime/src/sametime.cpp | 29 +---------------------------- protocols/Sametime/src/sametime.h | 2 -- protocols/Sametime/src/sametime_proto.h | 12 ++++++------ 3 files changed, 7 insertions(+), 36 deletions(-) (limited to 'protocols/Sametime') diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp index faebb0d6c3..f66a1fdddc 100644 --- a/protocols/Sametime/src/sametime.cpp +++ b/protocols/Sametime/src/sametime.cpp @@ -16,6 +16,7 @@ PLUGININFOEX pluginInfo = { 0xf1b0ba1b, 0xc91, 0x4313, { 0x85, 0xeb, 0x22, 0x50, 0x69, 0xd4, 0x4d, 0x1 } } // {F1B0BA1B-0C91-4313-85EB-225069D44D01} }; +CMPlugin g_plugin; CLIST_INTERFACE *pcli; HINSTANCE hInst; LIST g_Instances(1, PtrKeySortT); @@ -255,33 +256,5 @@ extern "C" int __declspec(dllexport) Load(void) 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); - return proto; -} - -static int sametime_proto_uninit(PROTO_INTERFACE* ppro) -{ - CSametimeProto* proto = (CSametimeProto*)ppro; - g_Instances.remove(proto); - delete proto; - return 0; -} - -struct CMPlugin : public CMPluginBase -{ - CMPlugin() : - CMPluginBase("Sametime") - { - RegisterProtocol(PROTOTYPE_PROTOCOL, sametime_proto_init, sametime_proto_uninit); - } -} - g_plugin; diff --git a/protocols/Sametime/src/sametime.h b/protocols/Sametime/src/sametime.h index 2458028af0..f5da14c480 100644 --- a/protocols/Sametime/src/sametime.h +++ b/protocols/Sametime/src/sametime.h @@ -107,8 +107,6 @@ struct CSametimeProto; extern HINSTANCE hInst; extern PLUGININFOEX pluginInfo; -extern LIST g_Instances; - #include "sametime_proto.h" diff --git a/protocols/Sametime/src/sametime_proto.h b/protocols/Sametime/src/sametime_proto.h index 92170d575e..0742839875 100644 --- a/protocols/Sametime/src/sametime_proto.h +++ b/protocols/Sametime/src/sametime_proto.h @@ -143,9 +143,6 @@ struct CSametimeProto : public PROTO void InitPlaces(mwSession* session); void DeinitPlaces(mwSession* session); - - - /* properties */ char szProtoGroups[128]; @@ -196,7 +193,12 @@ struct CSametimeProto : public PROTO }; - +struct CMPlugin : public ACCPROTOPLUGIN +{ + CMPlugin() : + ACCPROTOPLUGIN("Sametime") + {} +}; typedef struct tag_TFakeAckParams { CSametimeProto* proto; @@ -226,6 +228,4 @@ struct PopupData { CSametimeProto* proto; }; - #endif //#ifndef _SAMETIME_PROTO_H - -- cgit v1.2.3