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/MinecraftDynmap/src | |
parent | d75fed3bfc9c252f5d20b889e0bec95fb0a4527e (diff) |
all protocols rewritten to CMPluginBase
Diffstat (limited to 'protocols/MinecraftDynmap/src')
-rw-r--r-- | protocols/MinecraftDynmap/src/main.cpp | 46 | ||||
-rw-r--r-- | protocols/MinecraftDynmap/src/stdafx.h | 1 |
2 files changed, 26 insertions, 21 deletions
diff --git a/protocols/MinecraftDynmap/src/main.cpp b/protocols/MinecraftDynmap/src/main.cpp index 04505be56e..525a037711 100644 --- a/protocols/MinecraftDynmap/src/main.cpp +++ b/protocols/MinecraftDynmap/src/main.cpp @@ -71,19 +71,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCO ///////////////////////////////////////////////////////////////////////////////////////// // Load -static PROTO_INTERFACE* protoInit(const char *proto_name,const wchar_t *username) -{ - MinecraftDynmapProto *proto = new MinecraftDynmapProto(proto_name, username); - g_Instances.insert(proto); - return proto; -} - -static int protoUninit(PROTO_INTERFACE* proto) -{ - g_Instances.remove((MinecraftDynmapProto*)proto); - return EXIT_SUCCESS; -} - static HANDLE g_hEvents[1]; extern "C" int __declspec(dllexport) Load(void) @@ -91,14 +78,6 @@ extern "C" int __declspec(dllexport) Load(void) mir_getLP(&pluginInfo); pcli = Clist_GetInterface(); - PROTOCOLDESCRIPTOR pd = { 0 }; - pd.cbSize = sizeof(pd); - pd.szName = "MinecraftDynmap"; - pd.type = PROTOTYPE_PROTOCOL; - pd.fnInit = protoInit; - pd.fnUninit = protoUninit; - Proto_RegisterModule(&pd); - InitIcons(); // Init native User-Agent @@ -134,3 +113,28 @@ extern "C" int __declspec(dllexport) Unload(void) return 0; } + +///////////////////////////////////////////////////////////////////////////////////////// + +static PROTO_INTERFACE* protoInit(const char *proto_name, const wchar_t *username) +{ + MinecraftDynmapProto *proto = new MinecraftDynmapProto(proto_name, username); + g_Instances.insert(proto); + return proto; +} + +static int protoUninit(PROTO_INTERFACE* proto) +{ + g_Instances.remove((MinecraftDynmapProto*)proto); + return EXIT_SUCCESS; +} + +struct CMPlugin : public CMPluginBase +{ + CMPlugin() : + CMPluginBase("MinecraftDynmap") + { + RegisterProtocol(PROTOTYPE_PROTOCOL, protoInit, protoUninit); + } +} + g_plugin; diff --git a/protocols/MinecraftDynmap/src/stdafx.h b/protocols/MinecraftDynmap/src/stdafx.h index 634b6a7be2..0e784465e6 100644 --- a/protocols/MinecraftDynmap/src/stdafx.h +++ b/protocols/MinecraftDynmap/src/stdafx.h @@ -57,6 +57,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <m_message.h> #include <m_json.h> #include <m_http.h> +#include <m_plugin.h> #include "version.h" |