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/Discord/src/main.cpp | 43 +++++++++++++++++++++++------------------- protocols/Discord/src/stdafx.h | 1 + 2 files changed, 25 insertions(+), 19 deletions(-) (limited to 'protocols/Discord') 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 #include #include +#include #include #include "../../libs/zlib/src/zlib.h" -- cgit v1.2.3