summaryrefslogtreecommitdiff
path: root/protocols/MinecraftDynmap/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-28 16:34:30 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-28 16:34:30 +0300
commit81ce57622c3166830b23eae534dacc6b008c659d (patch)
tree6d6ac74667f733a20b94fa27cc01c2f45688c533 /protocols/MinecraftDynmap/src
parentc2bb7727483b9b5620e8cc0ce6adae35ee78d0a4 (diff)
common protocol instance management code went into template
Diffstat (limited to 'protocols/MinecraftDynmap/src')
-rw-r--r--protocols/MinecraftDynmap/src/main.cpp31
-rw-r--r--protocols/MinecraftDynmap/src/proto.h6
2 files changed, 7 insertions, 30 deletions
diff --git a/protocols/MinecraftDynmap/src/main.cpp b/protocols/MinecraftDynmap/src/main.cpp
index 525a037711..3c39f05077 100644
--- a/protocols/MinecraftDynmap/src/main.cpp
+++ b/protocols/MinecraftDynmap/src/main.cpp
@@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
+CMPlugin g_plugin;
CLIST_INTERFACE* pcli;
int hLangpack;
@@ -44,12 +45,6 @@ PLUGININFOEX pluginInfo = {
/////////////////////////////////////////////////////////////////////////////
// Protocol instances
-static int compare_protos(const MinecraftDynmapProto *p1, const MinecraftDynmapProto *p2)
-{
- return wcscmp(p1->m_tszUserName, p2->m_tszUserName);
-}
-
-OBJLIST<MinecraftDynmapProto> g_Instances(1, compare_protos);
DWORD WINAPI DllMain(HINSTANCE hInstance,DWORD,LPVOID)
{
@@ -114,27 +109,3 @@ 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/proto.h b/protocols/MinecraftDynmap/src/proto.h
index 15327988f5..15be7bac17 100644
--- a/protocols/MinecraftDynmap/src/proto.h
+++ b/protocols/MinecraftDynmap/src/proto.h
@@ -129,5 +129,11 @@ public:
std::string m_timestamp;
int m_interval;
int m_updateRate;
+};
+struct CMPlugin : public ACCPROTOPLUGIN<MinecraftDynmapProto>
+{
+ CMPlugin() :
+ ACCPROTOPLUGIN<MinecraftDynmapProto>("MinecraftDynmap")
+ {}
};