summaryrefslogtreecommitdiff
path: root/protocols/Discord
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-28 14:29:31 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-28 14:29:31 +0300
commita905c9c3f92fd54f37a5466649ac378db69e7cb0 (patch)
tree87a60dadfbf9fd8d916ea9100c26b6e314293242 /protocols/Discord
parentd75fed3bfc9c252f5d20b889e0bec95fb0a4527e (diff)
all protocols rewritten to CMPluginBase
Diffstat (limited to 'protocols/Discord')
-rw-r--r--protocols/Discord/src/main.cpp43
-rw-r--r--protocols/Discord/src/stdafx.h1
2 files changed, 25 insertions, 19 deletions
diff --git a/protocols/Discord/src/main.cpp b/protocols/Discord/src/main.cpp
index 1221db08b0..2bed58e39a 100644
--- a/protocols/Discord/src/main.cpp
+++ b/protocols/Discord/src/main.cpp
@@ -60,17 +60,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC
/////////////////////////////////////////////////////////////////////////////////////////
// Load
-static PROTO_INTERFACE* protoInit(const char *proto_name, const wchar_t *username)
-{
- return new CDiscordProto(proto_name, username);
-}
-
-static int protoUninit(PROTO_INTERFACE *proto)
-{
- delete proto;
- return 0;
-}
-
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
@@ -79,14 +68,6 @@ extern "C" int __declspec(dllexport) Load(void)
g_hwndHeartbeat = CreateWindowEx(0, L"STATIC", nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr);
Icon_Register(g_hInstance, "Discord", g_iconList, _countof(g_iconList));
-
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
- pd.szName = "Discord";
- pd.type = PROTOTYPE_PROTOCOL;
- pd.fnInit = protoInit;
- pd.fnUninit = protoUninit;
- Proto_RegisterModule(&pd);
return 0;
}
@@ -98,3 +79,27 @@ extern "C" int __declspec(dllexport) Unload(void)
DestroyWindow(g_hwndHeartbeat);
return 0;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static PROTO_INTERFACE* protoInit(const char *proto_name, const wchar_t *username)
+{
+ return new CDiscordProto(proto_name, username);
+}
+
+static int protoUninit(PROTO_INTERFACE *proto)
+{
+ delete (CDiscordProto*)proto;
+ return 0;
+}
+
+struct CMPlugin : public CMPluginBase
+{
+ CMPlugin() :
+ CMPluginBase("Discord")
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL, protoInit, protoUninit);
+ }
+}
+ g_plugin;
+
diff --git a/protocols/Discord/src/stdafx.h b/protocols/Discord/src/stdafx.h
index 12b741fa85..d09c1a7499 100644
--- a/protocols/Discord/src/stdafx.h
+++ b/protocols/Discord/src/stdafx.h
@@ -38,6 +38,7 @@
#include <m_hotkeys.h>
#include <m_json.h>
#include <m_avatars.h>
+#include <m_plugin.h>
#include <win2k.h>
#include "../../libs/zlib/src/zlib.h"