summaryrefslogtreecommitdiff
path: root/protocols/Omegle/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/Omegle/src
parentc2bb7727483b9b5620e8cc0ce6adae35ee78d0a4 (diff)
common protocol instance management code went into template
Diffstat (limited to 'protocols/Omegle/src')
-rw-r--r--protocols/Omegle/src/main.cpp35
-rw-r--r--protocols/Omegle/src/proto.h11
-rw-r--r--protocols/Omegle/src/theme.cpp2
3 files changed, 8 insertions, 40 deletions
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 <http://www.gnu.org/licenses/>.
// 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<OmegleProto> 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<OmegleProto>
+{
+ CMPlugin() :
+ ACCPROTOPLUGIN<OmegleProto>("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 <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-extern OBJLIST<OmegleProto> g_Instances;
-
static IconItem icons[] =
{
{ LPGEN("Omegle Icon"), "omegle", IDI_OMEGLE },