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/Gadu-Gadu/src/gg.cpp | 57 ++++++++++++++++++++---------------------- protocols/Gadu-Gadu/src/gg.h | 1 + 2 files changed, 28 insertions(+), 30 deletions(-) (limited to 'protocols/Gadu-Gadu') diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index c46aee7c65..31ba420df2 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -309,27 +309,6 @@ void GaduProto::menus_init() sessions_menus_init(hRoot); } -////////////////////////////////////////////////////////// -// Module instance initialization -// -static GaduProto *gg_proto_init(const char* pszProtoName, const wchar_t* tszUserName) -{ - GaduProto *gg = new GaduProto(pszProtoName, tszUserName); - g_Instances.insert(gg); - return gg; -} - -////////////////////////////////////////////////////////// -// Module instance uninitialization -// -static int gg_proto_uninit(PROTO_INTERFACE *proto) -{ - GaduProto *gg = (GaduProto *)proto; - g_Instances.remove(gg); - delete gg; - return 0; -} - ////////////////////////////////////////////////////////// // When plugin is loaded // @@ -340,15 +319,6 @@ extern "C" int __declspec(dllexport) Load(void) HookEvent(ME_SYSTEM_MODULESLOADED, gg_modulesloaded); - // Prepare protocol name - PROTOCOLDESCRIPTOR pd = { 0 }; - pd.cbSize = sizeof(pd); - pd.szName = GGDEF_PROTO; - pd.fnInit = (pfnInitProto)gg_proto_init; - pd.fnUninit = (pfnUninitProto)gg_proto_uninit; - pd.type = PROTOTYPE_PROTOCOL; - Proto_RegisterModule(&pd); - gg_links_instancemenu_init(); return 0; } @@ -467,3 +437,30 @@ BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD, LPVOID) #endif return TRUE; } + +///////////////////////////////////////////////////////////////////////////////////////// + +static PROTO_INTERFACE* gg_proto_init(const char *pszProtoName, const wchar_t *tszUserName) +{ + GaduProto *gg = new GaduProto(pszProtoName, tszUserName); + g_Instances.insert(gg); + return gg; +} + +static int gg_proto_uninit(PROTO_INTERFACE *proto) +{ + GaduProto *gg = (GaduProto*)proto; + g_Instances.remove(gg); + delete gg; + return 0; +} + +struct CMPlugin : public CMPluginBase +{ + CMPlugin() : + CMPluginBase(GGDEF_PROTO) + { + RegisterProtocol(PROTOTYPE_PROTOCOL, gg_proto_init, gg_proto_uninit); + } +} + g_plugin; diff --git a/protocols/Gadu-Gadu/src/gg.h b/protocols/Gadu-Gadu/src/gg.h index c4f6f76c7b..558c3227d3 100644 --- a/protocols/Gadu-Gadu/src/gg.h +++ b/protocols/Gadu-Gadu/src/gg.h @@ -69,6 +69,7 @@ #include #include #include +#include // libgadu headers #include "libgadu.h" -- cgit v1.2.3