diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-28 16:34:30 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-28 16:34:30 +0300 |
commit | 81ce57622c3166830b23eae534dacc6b008c659d (patch) | |
tree | 6d6ac74667f733a20b94fa27cc01c2f45688c533 /protocols/Sametime | |
parent | c2bb7727483b9b5620e8cc0ce6adae35ee78d0a4 (diff) |
common protocol instance management code went into template
Diffstat (limited to 'protocols/Sametime')
-rw-r--r-- | protocols/Sametime/src/sametime.cpp | 29 | ||||
-rw-r--r-- | protocols/Sametime/src/sametime.h | 2 | ||||
-rw-r--r-- | protocols/Sametime/src/sametime_proto.h | 12 |
3 files changed, 7 insertions, 36 deletions
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<CSametimeProto> 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<CSametimeProto> 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<CSametimeProto> void InitPlaces(mwSession* session);
void DeinitPlaces(mwSession* session);
-
-
-
/* properties */
char szProtoGroups[128];
@@ -196,7 +193,12 @@ struct CSametimeProto : public PROTO<CSametimeProto> };
-
+struct CMPlugin : public ACCPROTOPLUGIN<CSametimeProto>
+{
+ CMPlugin() :
+ ACCPROTOPLUGIN<CSametimeProto>("Sametime")
+ {}
+};
typedef struct tag_TFakeAckParams {
CSametimeProto* proto;
@@ -226,6 +228,4 @@ struct PopupData { CSametimeProto* proto;
};
-
#endif //#ifndef _SAMETIME_PROTO_H
-
|