From 81ce57622c3166830b23eae534dacc6b008c659d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 28 Mar 2018 16:34:30 +0300 Subject: common protocol instance management code went into template --- protocols/Omegle/src/main.cpp | 35 +---------------------------------- protocols/Omegle/src/proto.h | 11 +++++++---- protocols/Omegle/src/theme.cpp | 2 -- 3 files changed, 8 insertions(+), 40 deletions(-) (limited to 'protocols/Omegle') diff --git a/protocols/Omegle/src/main.cpp b/protocols/Omegle/src/main.cpp index 4d5cc3be73..d1226e7f6e 100644 --- a/protocols/Omegle/src/main.cpp +++ b/protocols/Omegle/src/main.cpp @@ -24,6 +24,7 @@ along with this program. If not, see . // TODO: Make following as "globals" structure? +CMPlugin g_plugin; CLIST_INTERFACE* pcli; int hLangpack; @@ -44,15 +45,6 @@ PLUGININFOEX pluginInfo = { { 0x9e1d9244, 0x606c, 0x4ef4, { 0x99, 0xa0, 0x1d, 0x7d, 0x23, 0xcb, 0x76, 0x1 } } }; -///////////////////////////////////////////////////////////////////////////// -// Protocol instances -static int compare_protos(const OmegleProto *p1, const OmegleProto *p2) -{ - return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName); -} - -OBJLIST g_Instances(1, compare_protos); - DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID) { g_hInstance = hInstance; @@ -117,28 +109,3 @@ extern "C" int __declspec(dllexport) Unload(void) return 0; } - -///////////////////////////////////////////////////////////////////////////////////////// - -static PROTO_INTERFACE* protoInit(const char *proto_name, const wchar_t *username) -{ - OmegleProto *proto = new OmegleProto(proto_name, username); - g_Instances.insert(proto); - return proto; -} - -static int protoUninit(PROTO_INTERFACE* proto) -{ - g_Instances.remove((OmegleProto*)proto); - return EXIT_SUCCESS; -} - -struct CMPlugin : public CMPluginBase -{ - CMPlugin() : - CMPluginBase("Omegle") - { - RegisterProtocol(PROTOTYPE_PROTOCOL, protoInit, protoUninit); - } -} - g_plugin; diff --git a/protocols/Omegle/src/proto.h b/protocols/Omegle/src/proto.h index 4eac66f67e..332746c792 100644 --- a/protocols/Omegle/src/proto.h +++ b/protocols/Omegle/src/proto.h @@ -84,11 +84,7 @@ public: void StopChat(bool disconnect = true); void NewChat(); - // Contacts handling - //bool IsMyContact(HANDLE, bool include_chat = false); - // Chat handling - void AddChat(const wchar_t *id, const wchar_t *name); void UpdateChat(const wchar_t *name, const wchar_t *message, bool addtochat = true); void SendChatMessage(std::string message); void AddChatContact(const wchar_t *nick); @@ -107,3 +103,10 @@ public: static void CALLBACK APC_callback(ULONG_PTR p); }; + +struct CMPlugin : public ACCPROTOPLUGIN +{ + CMPlugin() : + ACCPROTOPLUGIN("Omegle") + {} +}; diff --git a/protocols/Omegle/src/theme.cpp b/protocols/Omegle/src/theme.cpp index 0dd1f6d27f..fa89da9717 100644 --- a/protocols/Omegle/src/theme.cpp +++ b/protocols/Omegle/src/theme.cpp @@ -22,8 +22,6 @@ along with this program. If not, see . #include "stdafx.h" -extern OBJLIST g_Instances; - static IconItem icons[] = { { LPGEN("Omegle Icon"), "omegle", IDI_OMEGLE }, -- cgit v1.2.3