diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-28 14:29:31 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-28 14:29:31 +0300 |
commit | a905c9c3f92fd54f37a5466649ac378db69e7cb0 (patch) | |
tree | 87a60dadfbf9fd8d916ea9100c26b6e314293242 /protocols/Gadu-Gadu/src | |
parent | d75fed3bfc9c252f5d20b889e0bec95fb0a4527e (diff) |
all protocols rewritten to CMPluginBase
Diffstat (limited to 'protocols/Gadu-Gadu/src')
-rw-r--r-- | protocols/Gadu-Gadu/src/gg.cpp | 57 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/gg.h | 1 |
2 files changed, 28 insertions, 30 deletions
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 @@ -310,27 +310,6 @@ void GaduProto::menus_init() }
//////////////////////////////////////////////////////////
-// 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
//
extern "C" int __declspec(dllexport) Load(void)
@@ -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 <win2k.h>
#include <m_folders.h>
#include <m_gui.h>
+#include <m_plugin.h>
// libgadu headers
#include "libgadu.h"
|