summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Discord/src/main.cpp43
-rw-r--r--protocols/Discord/src/stdafx.h1
-rw-r--r--protocols/Dummy/src/main.cpp45
-rw-r--r--protocols/Dummy/src/stdafx.h1
-rw-r--r--protocols/EmLanProto/src/amdproto.cpp17
-rw-r--r--protocols/EmLanProto/src/stdafx.h1
-rw-r--r--protocols/FacebookRM/src/main.cpp20
-rw-r--r--protocols/FacebookRM/src/stdafx.h1
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp57
-rw-r--r--protocols/Gadu-Gadu/src/gg.h1
-rw-r--r--protocols/ICQCorp/src/corp.cpp33
-rw-r--r--protocols/ICQCorp/src/stdafx.h1
-rw-r--r--protocols/IRCG/src/main.cpp49
-rw-r--r--protocols/IRCG/src/stdafx.h1
-rw-r--r--protocols/IcqOscarJ/src/init.cpp49
-rw-r--r--protocols/IcqOscarJ/src/stdafx.h1
-rwxr-xr-xprotocols/JabberG/src/jabber.cpp50
-rw-r--r--protocols/MRA/src/Mra.cpp50
-rw-r--r--protocols/MRA/src/stdafx.h1
-rw-r--r--protocols/MSN/src/msn.cpp46
-rw-r--r--protocols/MSN/src/stdafx.h1
-rw-r--r--protocols/MinecraftDynmap/src/main.cpp46
-rw-r--r--protocols/MinecraftDynmap/src/stdafx.h1
-rw-r--r--protocols/Omegle/src/main.cpp46
-rw-r--r--protocols/Omegle/src/stdafx.h1
-rw-r--r--protocols/Sametime/src/StdAfx.h1
-rw-r--r--protocols/Sametime/src/sametime.cpp43
-rw-r--r--protocols/SkypeWeb/src/main.cpp22
-rw-r--r--protocols/SkypeWeb/src/stdafx.h1
-rw-r--r--protocols/Steam/src/main.cpp22
-rw-r--r--protocols/Steam/src/stdafx.h1
-rw-r--r--protocols/Tox/src/main.cpp22
-rw-r--r--protocols/Tox/src/stdafx.h1
-rw-r--r--protocols/Twitter/src/main.cpp48
-rw-r--r--protocols/Twitter/src/stdafx.h1
-rw-r--r--protocols/VKontakte/src/main.cpp47
-rw-r--r--protocols/VKontakte/src/stdafx.h1
37 files changed, 429 insertions, 344 deletions
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 <m_hotkeys.h>
#include <m_json.h>
#include <m_avatars.h>
+#include <m_plugin.h>
#include <win2k.h>
#include "../../libs/zlib/src/zlib.h"
diff --git a/protocols/Dummy/src/main.cpp b/protocols/Dummy/src/main.cpp
index 03623c4351..da1fccd10a 100644
--- a/protocols/Dummy/src/main.cpp
+++ b/protocols/Dummy/src/main.cpp
@@ -62,32 +62,11 @@ static int OnModulesLoaded(WPARAM, LPARAM)
/////////////////////////////////////////////////////////////////////////////////////////
// OnLoad - initialize the plugin instance
-static CDummyProto* dummyProtoInit(const char* pszProtoName, const wchar_t *tszUserName)
-{
- CDummyProto *ppro = new CDummyProto(pszProtoName, tszUserName);
- return ppro;
-}
-
-static int dummyProtoUninit(CDummyProto *ppro)
-{
- delete ppro;
- return 0;
-}
-
extern "C" int __declspec(dllexport) Load()
{
mir_getLP(&pluginInfo);
pcli = Clist_GetInterface();
- // Register protocol module
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
- pd.szName = "Dummy";
- pd.fnInit = (pfnInitProto)dummyProtoInit;
- pd.fnUninit = (pfnUninitProto)dummyProtoUninit;
- pd.type = PROTOTYPE_PROTOCOL;
- Proto_RegisterModule(&pd);
-
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
return 0;
}
@@ -99,3 +78,27 @@ extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static PROTO_INTERFACE* dummyProtoInit(const char* pszProtoName, const wchar_t *tszUserName)
+{
+ CDummyProto *ppro = new CDummyProto(pszProtoName, tszUserName);
+ return ppro;
+}
+
+static int dummyProtoUninit(PROTO_INTERFACE *ppro)
+{
+ delete (CDummyProto*)ppro;
+ return 0;
+}
+
+struct CMPlugin : public CMPluginBase
+{
+ CMPlugin() :
+ CMPluginBase("Dummy")
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL, dummyProtoInit, dummyProtoUninit);
+ }
+}
+ g_plugin;
diff --git a/protocols/Dummy/src/stdafx.h b/protocols/Dummy/src/stdafx.h
index 2b45096df8..0ea0d3d493 100644
--- a/protocols/Dummy/src/stdafx.h
+++ b/protocols/Dummy/src/stdafx.h
@@ -54,6 +54,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <m_userinfo.h>
#include <m_utils.h>
#include <m_proto_listeningto.h>
+#include <m_plugin.h>
#include <m_folders.h>
diff --git a/protocols/EmLanProto/src/amdproto.cpp b/protocols/EmLanProto/src/amdproto.cpp
index 1bcc43a24d..366a508a84 100644
--- a/protocols/EmLanProto/src/amdproto.cpp
+++ b/protocols/EmLanProto/src/amdproto.cpp
@@ -332,11 +332,6 @@ extern "C" int __declspec(dllexport) __cdecl Load()
mir_getLP(&pluginInfo);
g_lan = new CMLan();
- PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
- pd.szName = PROTONAME;
- pd.type = PROTOTYPE_PROTOCOL;
- Proto_RegisterModule(&pd);
-
CreateProtoServiceFunction(PROTONAME, PS_GETCAPS, EMPGetCaps);
CreateProtoServiceFunction(PROTONAME, PS_GETNAME, EMPGetName);
CreateProtoServiceFunction(PROTONAME, PS_LOADICON, EMPLoadIcon);
@@ -367,3 +362,15 @@ extern "C" int __declspec(dllexport) __cdecl Unload()
delete g_lan;
return 0;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct CMPlugin : public CMPluginBase
+{
+ CMPlugin() :
+ CMPluginBase(PROTONAME)
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL);
+ }
+}
+ g_plugin;
diff --git a/protocols/EmLanProto/src/stdafx.h b/protocols/EmLanProto/src/stdafx.h
index 8fefd8f2f8..d80030c4b1 100644
--- a/protocols/EmLanProto/src/stdafx.h
+++ b/protocols/EmLanProto/src/stdafx.h
@@ -16,6 +16,7 @@
#include <m_protosvc.h>
#include <m_database.h>
#include <m_langpack.h>
+#include <m_plugin.h>
#include "resource.h"
#include "version.h"
diff --git a/protocols/FacebookRM/src/main.cpp b/protocols/FacebookRM/src/main.cpp
index 849ceec906..28bc66d172 100644
--- a/protocols/FacebookRM/src/main.cpp
+++ b/protocols/FacebookRM/src/main.cpp
@@ -91,14 +91,6 @@ extern "C" int __declspec(dllexport) Load(void)
mir_getLP(&pluginInfo);
pcli = Clist_GetInterface();
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
- pd.szName = FACEBOOK_NAME;
- pd.type = PROTOTYPE_PROTOCOL;
- pd.fnInit = protoInit;
- pd.fnUninit = protoUninit;
- Proto_RegisterModule(&pd);
-
InitIcons();
InitContactMenus();
@@ -128,3 +120,15 @@ extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct CMPlugin : public CMPluginBase
+{
+ CMPlugin() :
+ CMPluginBase(FACEBOOK_NAME)
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL, protoInit, protoUninit);
+ }
+}
+ g_plugin;
diff --git a/protocols/FacebookRM/src/stdafx.h b/protocols/FacebookRM/src/stdafx.h
index ea411d908f..7e044a4bb7 100644
--- a/protocols/FacebookRM/src/stdafx.h
+++ b/protocols/FacebookRM/src/stdafx.h
@@ -62,6 +62,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <m_http.h>
#include <m_messagestate.h>
#include <m_gui.h>
+#include <m_plugin.h>
class FacebookProto;
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp
index c46aee7c65..31ba420df2 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -310,27 +310,6 @@ void GaduProto::menus_init()
}
//////////////////////////////////////////////////////////
-// Module instance initialization
-//
-static GaduProto *gg_proto_init(const char* pszProtoName, const wchar_t* tszUserName)
-{
- GaduProto *gg = new GaduProto(pszProtoName, tszUserName);
- g_Instances.insert(gg);
- return gg;
-}
-
-//////////////////////////////////////////////////////////
-// Module instance uninitialization
-//
-static int gg_proto_uninit(PROTO_INTERFACE *proto)
-{
- GaduProto *gg = (GaduProto *)proto;
- g_Instances.remove(gg);
- delete gg;
- return 0;
-}
-
-//////////////////////////////////////////////////////////
// When plugin is loaded
//
extern "C" int __declspec(dllexport) Load(void)
@@ -340,15 +319,6 @@ extern "C" int __declspec(dllexport) Load(void)
HookEvent(ME_SYSTEM_MODULESLOADED, gg_modulesloaded);
- // Prepare protocol name
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
- pd.szName = GGDEF_PROTO;
- pd.fnInit = (pfnInitProto)gg_proto_init;
- pd.fnUninit = (pfnUninitProto)gg_proto_uninit;
- pd.type = PROTOTYPE_PROTOCOL;
- Proto_RegisterModule(&pd);
-
gg_links_instancemenu_init();
return 0;
}
@@ -467,3 +437,30 @@ BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD, LPVOID)
#endif
return TRUE;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static PROTO_INTERFACE* gg_proto_init(const char *pszProtoName, const wchar_t *tszUserName)
+{
+ GaduProto *gg = new GaduProto(pszProtoName, tszUserName);
+ g_Instances.insert(gg);
+ return gg;
+}
+
+static int gg_proto_uninit(PROTO_INTERFACE *proto)
+{
+ GaduProto *gg = (GaduProto*)proto;
+ g_Instances.remove(gg);
+ delete gg;
+ return 0;
+}
+
+struct CMPlugin : public CMPluginBase
+{
+ CMPlugin() :
+ CMPluginBase(GGDEF_PROTO)
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL, gg_proto_init, gg_proto_uninit);
+ }
+}
+ g_plugin;
diff --git a/protocols/Gadu-Gadu/src/gg.h b/protocols/Gadu-Gadu/src/gg.h
index c4f6f76c7b..558c3227d3 100644
--- a/protocols/Gadu-Gadu/src/gg.h
+++ b/protocols/Gadu-Gadu/src/gg.h
@@ -69,6 +69,7 @@
#include <win2k.h>
#include <m_folders.h>
#include <m_gui.h>
+#include <m_plugin.h>
// libgadu headers
#include "libgadu.h"
diff --git a/protocols/ICQCorp/src/corp.cpp b/protocols/ICQCorp/src/corp.cpp
index 2687a3e9fc..4eabd5862c 100644
--- a/protocols/ICQCorp/src/corp.cpp
+++ b/protocols/ICQCorp/src/corp.cpp
@@ -61,19 +61,6 @@ extern "C" __declspec(dllexport) int Load()
{
mir_getLP(&pluginInfo);
- char fileName[MAX_PATH];
- GetModuleFileNameA(hInstance, fileName, MAX_PATH);
-
- WIN32_FIND_DATAA findData;
- FindClose(FindFirstFileA(fileName, &findData));
- findData.cFileName[strlen(findData.cFileName) - 4] = 0;
- strncpy_s(protoName, findData.cFileName, _TRUNCATE);
-
- PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
- pd.szName = protoName;
- pd.type = PROTOTYPE_PROTOCOL;
- Proto_RegisterModule(&pd);
-
LoadServices();
return 0;
}
@@ -85,6 +72,26 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct CMPlugin : public CMPluginBase
+{
+ CMPlugin() :
+ CMPluginBase(protoName)
+ {
+ char fileName[MAX_PATH];
+ GetModuleFileNameA(hInstance, fileName, MAX_PATH);
+
+ WIN32_FIND_DATAA findData;
+ FindClose(FindFirstFileA(fileName, &findData));
+ findData.cFileName[strlen(findData.cFileName) - 4] = 0;
+ strncpy_s(protoName, findData.cFileName, _TRUNCATE);
+
+ RegisterProtocol(PROTOTYPE_PROTOCOL);
+ }
+}
+ g_plugin;
+
///////////////////////////////////////////////////////////////////////////////
#ifdef _DEBUG
diff --git a/protocols/ICQCorp/src/stdafx.h b/protocols/ICQCorp/src/stdafx.h
index 5aac37d71e..536858d2f6 100644
--- a/protocols/ICQCorp/src/stdafx.h
+++ b/protocols/ICQCorp/src/stdafx.h
@@ -37,6 +37,7 @@
#include <m_clist.h>
#include <m_userinfo.h>
#include <m_timezones.h>
+#include <m_plugin.h>
#include "user.h"
#include "transfer.h"
diff --git a/protocols/IRCG/src/main.cpp b/protocols/IRCG/src/main.cpp
index c821c183c2..81ff6f6581 100644
--- a/protocols/IRCG/src/main.cpp
+++ b/protocols/IRCG/src/main.cpp
@@ -73,20 +73,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC
/////////////////////////////////////////////////////////////////////////////////////////
-static CIrcProto* ircProtoInit(const char* pszProtoName, const wchar_t* tszUserName)
-{
- CIrcProto *ppro = new CIrcProto(pszProtoName, tszUserName);
- g_Instances.insert(ppro);
- return ppro;
-}
-
-static int ircProtoUninit(CIrcProto *ppro)
-{
- g_Instances.remove((CIrcProto*)ppro);
- delete ppro;
- return 0;
-}
-
extern "C" int __declspec(dllexport) Load()
{
mir_getLP(&pluginInfo);
@@ -96,15 +82,6 @@ extern "C" int __declspec(dllexport) Load()
InitIcons();
InitServers();
InitContactMenus();
-
- // register protocol
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
- pd.szName = "IRC";
- pd.type = PROTOTYPE_PROTOCOL;
- pd.fnInit = (pfnInitProto)ircProtoInit;
- pd.fnUninit = (pfnUninitProto)ircProtoUninit;
- Proto_RegisterModule(&pd);
return 0;
}
@@ -116,3 +93,29 @@ extern "C" int __declspec(dllexport) Unload(void)
UninitTimers();
return 0;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static PROTO_INTERFACE* ircProtoInit(const char* pszProtoName, const wchar_t* tszUserName)
+{
+ CIrcProto *ppro = new CIrcProto(pszProtoName, tszUserName);
+ g_Instances.insert(ppro);
+ return ppro;
+}
+
+static int ircProtoUninit(PROTO_INTERFACE *ppro)
+{
+ g_Instances.remove((CIrcProto*)ppro);
+ delete (CIrcProto*)ppro;
+ return 0;
+}
+
+struct CMPlugin : public CMPluginBase
+{
+ CMPlugin() :
+ CMPluginBase("IRC")
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL, ircProtoInit, ircProtoUninit);
+ }
+}
+ g_plugin;
diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h
index 16f753c395..eef1cb6a10 100644
--- a/protocols/IRCG/src/stdafx.h
+++ b/protocols/IRCG/src/stdafx.h
@@ -66,6 +66,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "m_string.h"
#include "win2k.h"
#include "m_gui.h"
+#include <m_plugin.h>
#include "resource.h"
diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp
index 5eb94cfed0..fb53d2312e 100644
--- a/protocols/IcqOscarJ/src/init.cpp
+++ b/protocols/IcqOscarJ/src/init.cpp
@@ -64,20 +64,6 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
/////////////////////////////////////////////////////////////////////////////////////////
-static PROTO_INTERFACE* icqProtoInit(const char* pszProtoName, const wchar_t* tszUserName)
-{
- CIcqProto *ppro = new CIcqProto(pszProtoName, tszUserName);
- g_Instances.insert(ppro);
- return ppro;
-}
-
-static int icqProtoUninit(PROTO_INTERFACE* ppro)
-{
- g_Instances.remove((CIcqProto*)ppro);
- delete (CIcqProto*)ppro;
- return 0;
-}
-
int ModuleLoad(WPARAM, LPARAM)
{
bPopupService = ServiceExists(MS_POPUP_ADDPOPUPT);
@@ -103,15 +89,6 @@ extern "C" int __declspec(dllexport) Load(void)
srand(time(nullptr));
_tzset();
- // Register the module
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
- pd.szName = ICQ_PROTOCOL_NAME;
- pd.type = PROTOTYPE_PROTOCOL;
- pd.fnInit = icqProtoInit;
- pd.fnUninit = icqProtoUninit;
- Proto_RegisterModule(&pd);
-
// Initialize charset conversion routines
InitI18N();
@@ -183,3 +160,29 @@ void CIcqProto::UpdateGlobalSettings()
m_bXStatusEnabled = getByte("XStatusEnabled", DEFAULT_XSTATUS_ENABLED);
m_bMoodsEnabled = getByte("MoodsEnabled", DEFAULT_MOODS_ENABLED);
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static PROTO_INTERFACE* icqProtoInit(const char* pszProtoName, const wchar_t* tszUserName)
+{
+ CIcqProto *ppro = new CIcqProto(pszProtoName, tszUserName);
+ g_Instances.insert(ppro);
+ return ppro;
+}
+
+static int icqProtoUninit(PROTO_INTERFACE* ppro)
+{
+ g_Instances.remove((CIcqProto*)ppro);
+ delete (CIcqProto*)ppro;
+ return 0;
+}
+
+struct CMPlugin : public CMPluginBase
+{
+ CMPlugin() :
+ CMPluginBase(ICQ_PROTOCOL_NAME)
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL, icqProtoInit, icqProtoUninit);
+ }
+}
+ g_plugin;
diff --git a/protocols/IcqOscarJ/src/stdafx.h b/protocols/IcqOscarJ/src/stdafx.h
index 27c90396b8..61877a2a58 100644
--- a/protocols/IcqOscarJ/src/stdafx.h
+++ b/protocols/IcqOscarJ/src/stdafx.h
@@ -80,6 +80,7 @@
#include <m_timezones.h>
#include <win2k.h>
#include <m_gui.h>
+#include <m_plugin.h>
// Project resources
#include "resource.h"
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp
index c6046e2b2e..06523ae7eb 100755
--- a/protocols/JabberG/src/jabber.cpp
+++ b/protocols/JabberG/src/jabber.cpp
@@ -163,21 +163,6 @@ static int OnModulesLoaded(WPARAM, LPARAM)
///////////////////////////////////////////////////////////////////////////////
// OnLoad - initialize the plugin instance
-static CJabberProto* jabberProtoInit(const char* pszProtoName, const wchar_t *tszUserName)
-{
- CJabberProto *ppro = new CJabberProto(pszProtoName, tszUserName);
- g_Instances.insert(ppro);
- return ppro;
-}
-
-static int jabberProtoUninit(CJabberProto *ppro)
-{
- g_Instances.remove(ppro);
- delete ppro;
- return 0;
-}
-
-
extern "C" int __declspec(dllexport) Load()
{
// set the memory, lists & utf8 managers
@@ -196,15 +181,6 @@ extern "C" int __declspec(dllexport) Load()
hExtListInit = CreateHookableEvent(ME_JABBER_EXTLISTINIT);
hDiscoInfoResult = CreateHookableEvent(ME_JABBER_SRVDISCOINFO);
- // Register protocol module
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
- pd.szName = "JABBER";
- pd.fnInit = (pfnInitProto)jabberProtoInit;
- pd.fnUninit = (pfnUninitProto)jabberProtoUninit;
- pd.type = PROTOTYPE_PROTOCOL;
- Proto_RegisterModule(&pd);
-
g_IconsInit();
g_XstatusIconsInit();
@@ -251,3 +227,29 @@ extern "C" int __declspec(dllexport) Unload(void)
g_MenuUninit();
return 0;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static PROTO_INTERFACE* jabberProtoInit(const char* pszProtoName, const wchar_t *tszUserName)
+{
+ CJabberProto *ppro = new CJabberProto(pszProtoName, tszUserName);
+ g_Instances.insert(ppro);
+ return ppro;
+}
+
+static int jabberProtoUninit(PROTO_INTERFACE *ppro)
+{
+ g_Instances.remove((CJabberProto*)ppro);
+ delete (CJabberProto*)ppro;
+ return 0;
+}
+
+struct CMPlugin : public CMPluginBase
+{
+ CMPlugin() :
+ CMPluginBase(GLOBAL_SETTING_MODULE)
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL, jabberProtoInit, jabberProtoUninit);
+ }
+}
+ g_plugin;
diff --git a/protocols/MRA/src/Mra.cpp b/protocols/MRA/src/Mra.cpp
index 0c863e3c3a..49eded7d0a 100644
--- a/protocols/MRA/src/Mra.cpp
+++ b/protocols/MRA/src/Mra.cpp
@@ -50,22 +50,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
///////////////////////////////////////////////////////////////////////////////
-static CMraProto* mraProtoInit(const char* pszProtoName, const wchar_t* tszUserName)
-{
- CMraProto *ppro = new CMraProto(pszProtoName, tszUserName);
- g_Instances.insert(ppro);
- return ppro;
-}
-
-static int mraProtoUninit(CMraProto *ppro)
-{
- g_Instances.remove(ppro);
- delete ppro;
- return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
static int __cdecl OnPreShutdown(WPARAM, LPARAM)
{
g_bShutdown = true;
@@ -81,14 +65,6 @@ extern "C" __declspec(dllexport) int Load(void)
InitXStatusIcons();
HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
-
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
- pd.szName = "MRA";
- pd.type = PROTOTYPE_PROTOCOL;
- pd.fnInit = (pfnInitProto)mraProtoInit;
- pd.fnUninit = (pfnUninitProto)mraProtoUninit;
- Proto_RegisterModule(&pd);
return 0;
}
@@ -102,3 +78,29 @@ extern "C" __declspec(dllexport) int Unload(void)
return 0;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static PROTO_INTERFACE* mraProtoInit(const char* pszProtoName, const wchar_t* tszUserName)
+{
+ CMraProto *ppro = new CMraProto(pszProtoName, tszUserName);
+ g_Instances.insert(ppro);
+ return ppro;
+}
+
+static int mraProtoUninit(PROTO_INTERFACE *ppro)
+{
+ g_Instances.remove((CMraProto*)ppro);
+ delete (CMraProto*)ppro;
+ return 0;
+}
+
+struct CMPlugin : public CMPluginBase
+{
+ CMPlugin() :
+ CMPluginBase("MRA")
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL, mraProtoInit, mraProtoUninit);
+ }
+}
+ g_plugin;
diff --git a/protocols/MRA/src/stdafx.h b/protocols/MRA/src/stdafx.h
index e7bd1a649a..dd94bdfbb9 100644
--- a/protocols/MRA/src/stdafx.h
+++ b/protocols/MRA/src/stdafx.h
@@ -50,6 +50,7 @@
#include <m_xstatus.h>
#include <m_nudge.h>
#include <m_proto_listeningto.h>
+#include <m_plugin.h>
#define PROTO_VERSION_MAJOR 1
#define PROTO_VERSION_MINOR 21
diff --git a/protocols/MSN/src/msn.cpp b/protocols/MSN/src/msn.cpp
index 697c1f6569..71dc64eb4f 100644
--- a/protocols/MSN/src/msn.cpp
+++ b/protocols/MSN/src/msn.cpp
@@ -82,19 +82,6 @@ static int OnModulesLoaded(WPARAM, LPARAM)
return 0;
}
-static CMsnProto* msnProtoInit(const char* pszProtoName, const wchar_t* tszUserName)
-{
- CMsnProto *ppro = new CMsnProto(pszProtoName, tszUserName);
- g_Instances.insert(ppro);
- return ppro;
-}
-
-static int msnProtoUninit(CMsnProto* ppro)
-{
- g_Instances.remove(ppro);
- return 0;
-}
-
// Performs a primary set of actions upon plugin loading
extern "C" int __declspec(dllexport) Load(void)
{
@@ -103,14 +90,6 @@ extern "C" int __declspec(dllexport) Load(void)
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
- pd.szName = "MSN";
- pd.fnInit = (pfnInitProto)msnProtoInit;
- pd.fnUninit = (pfnUninitProto)msnProtoUninit;
- pd.type = PROTOTYPE_PROTOCOL;
- Proto_RegisterModule(&pd);
-
MsnInitIcons();
MSN_InitContactMenu();
return 0;
@@ -135,3 +114,28 @@ extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD)
// MirandaInterfaces - returns the protocol interface to the core
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static PROTO_INTERFACE* msnProtoInit(const char *pszProtoName, const wchar_t *tszUserName)
+{
+ CMsnProto *ppro = new CMsnProto(pszProtoName, tszUserName);
+ g_Instances.insert(ppro);
+ return ppro;
+}
+
+static int msnProtoUninit(PROTO_INTERFACE *ppro)
+{
+ g_Instances.remove((CMsnProto*)ppro);
+ return 0;
+}
+
+struct CMPlugin : public CMPluginBase
+{
+ CMPlugin() :
+ CMPluginBase("MSN")
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL, msnProtoInit, msnProtoUninit);
+ }
+}
+ g_plugin;
diff --git a/protocols/MSN/src/stdafx.h b/protocols/MSN/src/stdafx.h
index df61064891..1eb9ce25a3 100644
--- a/protocols/MSN/src/stdafx.h
+++ b/protocols/MSN/src/stdafx.h
@@ -63,6 +63,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <m_nudge.h>
#include <m_string.h>
#include <m_json.h>
+#include <m_plugin.h>
#include "m_proto_listeningto.h"
#include "m_folders.h"
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"
diff --git a/protocols/Omegle/src/main.cpp b/protocols/Omegle/src/main.cpp
index a27baa0e5b..4d5cc3be73 100644
--- a/protocols/Omegle/src/main.cpp
+++ b/protocols/Omegle/src/main.cpp
@@ -73,19 +73,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC
/////////////////////////////////////////////////////////////////////////////////////////
// Load
-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;
-}
-
static HANDLE g_hEvents[1];
extern "C" int __declspec(dllexport) Load(void)
@@ -93,14 +80,6 @@ extern "C" int __declspec(dllexport) Load(void)
mir_getLP(&pluginInfo);
pcli = Clist_GetInterface();
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
- pd.szName = "Omegle";
- pd.type = PROTOTYPE_PROTOCOL;
- pd.fnInit = protoInit;
- pd.fnUninit = protoUninit;
- Proto_RegisterModule(&pd);
-
InitIcons();
//InitContactMenus();
@@ -138,3 +117,28 @@ 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/stdafx.h b/protocols/Omegle/src/stdafx.h
index f216b4932c..e492ad25d2 100644
--- a/protocols/Omegle/src/stdafx.h
+++ b/protocols/Omegle/src/stdafx.h
@@ -58,6 +58,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <m_message.h>
#include <m_http.h>
#include <m_json.h>
+#include <m_plugin.h>
#include "version.h"
diff --git a/protocols/Sametime/src/StdAfx.h b/protocols/Sametime/src/StdAfx.h
index 5fa7d2b4d3..9f8fe88525 100644
--- a/protocols/Sametime/src/StdAfx.h
+++ b/protocols/Sametime/src/StdAfx.h
@@ -75,3 +75,4 @@ extern "C" {
#include <m_genmenu.h>
#include <m_icolib.h>
#include <m_string.h>
+#include <m_plugin.h> \ No newline at end of file
diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp
index 6f0d783b14..faebb0d6c3 100644
--- a/protocols/Sametime/src/sametime.cpp
+++ b/protocols/Sametime/src/sametime.cpp
@@ -246,7 +246,22 @@ void CSametimeProto::BroadcastNewStatus(int iNewStatus)
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)previous_status, m_iStatus);
}
-static CSametimeProto* sametime_proto_init(const char* pszProtoName, const wchar_t* tszUserName)
+extern "C" int __declspec(dllexport) Load(void)
+{
+ mir_getLP(&pluginInfo);
+ pcli = Clist_GetInterface();
+ return 0;
+}
+
+extern "C" int __declspec(dllexport) Unload()
+{
+ g_Instances.destroy();
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static PROTO_INTERFACE* sametime_proto_init(const char* pszProtoName, const wchar_t* tszUserName)
{
CSametimeProto* proto = new CSametimeProto(pszProtoName, tszUserName);
g_Instances.insert(proto);
@@ -261,24 +276,12 @@ static int sametime_proto_uninit(PROTO_INTERFACE* ppro)
return 0;
}
-extern "C" int __declspec(dllexport) Load(void)
+struct CMPlugin : public CMPluginBase
{
- mir_getLP(&pluginInfo);
- pcli = Clist_GetInterface();
-
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
- pd.type = PROTOTYPE_PROTOCOL;
- pd.szName = "Sametime";
- pd.fnInit = (pfnInitProto)sametime_proto_init;
- pd.fnUninit = (pfnUninitProto)sametime_proto_uninit;
- Proto_RegisterModule(&pd);
- return 0;
-}
-
-extern "C" int __declspec(dllexport) Unload()
-{
- g_Instances.destroy();
- return 0;
+ CMPlugin() :
+ CMPluginBase("Sametime")
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL, sametime_proto_init, sametime_proto_uninit);
+ }
}
-
+ g_plugin;
diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp
index 1b512abb87..678d2003a1 100644
--- a/protocols/SkypeWeb/src/main.cpp
+++ b/protocols/SkypeWeb/src/main.cpp
@@ -59,14 +59,6 @@ extern "C" int __declspec(dllexport) Load(void)
pci = Chat_GetInterface();
Miranda_GetVersionText(g_szMirVer, sizeof(g_szMirVer));
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
- pd.szName = "SKYPE";
- pd.type = PROTOTYPE_PROTOCOL;
- pd.fnInit = (pfnInitProto)CSkypeProto::InitAccount;
- pd.fnUninit = (pfnUninitProto)CSkypeProto::UninitAccount;
- Proto_RegisterModule(&pd);
-
CSkypeProto::InitIcons();
CSkypeProto::InitMenus();
CSkypeProto::InitLanguages();
@@ -98,4 +90,16 @@ int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM)
AssocMgr_AddNewUrlTypeT("skype:", TranslateT("Skype Link Protocol"), g_hInstance, IDI_SKYPE, MODULE "/ParseUri", 0);
}
return 0;
-} \ No newline at end of file
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct CMPlugin : public CMPluginBase
+{
+ CMPlugin() :
+ CMPluginBase("SKYPE")
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CSkypeProto::InitAccount, (pfnUninitProto)CSkypeProto::UninitAccount);
+ }
+}
+ g_plugin;
diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h
index 94abd8398d..2ad4940055 100644
--- a/protocols/SkypeWeb/src/stdafx.h
+++ b/protocols/SkypeWeb/src/stdafx.h
@@ -54,6 +54,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <m_xml.h>
#include <m_assocmgr.h>
#include <m_file.h>
+#include <m_plugin.h>
struct CSkypeProto;
diff --git a/protocols/Steam/src/main.cpp b/protocols/Steam/src/main.cpp
index eefe4967c6..57632115d9 100644
--- a/protocols/Steam/src/main.cpp
+++ b/protocols/Steam/src/main.cpp
@@ -31,20 +31,12 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
return &pluginInfo;
}
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCOL, MIID_LAST};
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
- pd.szName = "STEAM";
- pd.type = PROTOTYPE_PROTOCOL;
- pd.fnInit = (pfnInitProto)CSteamProto::InitAccount;
- pd.fnUninit = (pfnUninitProto)CSteamProto::UninitAccount;
- Proto_RegisterModule(&pd);
-
char iconName[100];
mir_snprintf(iconName, "%s_%s", MODULE, "gaming");
@@ -60,3 +52,15 @@ extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct CMPlugin : public CMPluginBase
+{
+ CMPlugin() :
+ CMPluginBase("STEAM")
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CSteamProto::InitAccount, (pfnUninitProto)CSteamProto::UninitAccount);
+ }
+}
+ g_plugin;
diff --git a/protocols/Steam/src/stdafx.h b/protocols/Steam/src/stdafx.h
index 8e1320dd22..744cbb7f6d 100644
--- a/protocols/Steam/src/stdafx.h
+++ b/protocols/Steam/src/stdafx.h
@@ -35,6 +35,7 @@
#include <m_gui.h>
#include <m_http.h>
#include <m_system.h>
+#include <m_plugin.h>
#include "resource.h"
#include "version.h"
diff --git a/protocols/Tox/src/main.cpp b/protocols/Tox/src/main.cpp
index 6bff578137..8cf2c4b80d 100644
--- a/protocols/Tox/src/main.cpp
+++ b/protocols/Tox/src/main.cpp
@@ -54,14 +54,6 @@ extern "C" int __declspec(dllexport) Load(void)
pci = Chat_GetInterface();
pcli = Clist_GetInterface();
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
- pd.szName = "TOX";
- pd.type = PROTOTYPE_PROTOCOL;
- pd.fnInit = (pfnInitProto)CToxProto::InitAccount;
- pd.fnUninit = (pfnUninitProto)CToxProto::UninitAccount;
- Proto_RegisterModule(&pd);
-
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
return 0;
@@ -70,4 +62,16 @@ extern "C" int __declspec(dllexport) Load(void)
extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
-} \ No newline at end of file
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct CMPlugin : public CMPluginBase
+{
+ CMPlugin() :
+ CMPluginBase("TOX")
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CToxProto::InitAccount, (pfnUninitProto)CToxProto::UninitAccount);
+ }
+}
+ g_plugin;
diff --git a/protocols/Tox/src/stdafx.h b/protocols/Tox/src/stdafx.h
index cb16bf8078..d6270b9373 100644
--- a/protocols/Tox/src/stdafx.h
+++ b/protocols/Tox/src/stdafx.h
@@ -36,6 +36,7 @@
#include <m_assocmgr.h>
#include <m_json.h>
#include <m_http.h>
+#include <m_plugin.h>
#include <tox.h>
#include <toxencryptsave.h>
diff --git a/protocols/Twitter/src/main.cpp b/protocols/Twitter/src/main.cpp
index 88c8cf1c31..a4e714ba7e 100644
--- a/protocols/Twitter/src/main.cpp
+++ b/protocols/Twitter/src/main.cpp
@@ -69,32 +69,11 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC
/////////////////////////////////////////////////////////////////////////////////////////
// Load
-static PROTO_INTERFACE* protoInit(const char *proto_name, const wchar_t *username)
-{
- TwitterProto *proto = new TwitterProto(proto_name, username);
- g_Instances.insert(proto);
- return proto;
-}
-
-static int protoUninit(PROTO_INTERFACE *proto)
-{
- g_Instances.remove(static_cast<TwitterProto*>(proto));
- return 0;
-}
-
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
pcli = Clist_GetInterface();
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
- pd.szName = "Twitter";
- pd.type = PROTOTYPE_PROTOCOL;
- pd.fnInit = protoInit;
- pd.fnUninit = protoUninit;
- Proto_RegisterModule(&pd);
-
InitIcons();
InitContactMenus();
TwitterInitSounds();
@@ -107,4 +86,29 @@ extern "C" int __declspec(dllexport) Load(void)
extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
-} \ No newline at end of file
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static PROTO_INTERFACE* protoInit(const char *proto_name, const wchar_t *username)
+{
+ TwitterProto *proto = new TwitterProto(proto_name, username);
+ g_Instances.insert(proto);
+ return proto;
+}
+
+static int protoUninit(PROTO_INTERFACE *proto)
+{
+ g_Instances.remove(static_cast<TwitterProto*>(proto));
+ return 0;
+}
+
+struct CMPlugin : public CMPluginBase
+{
+ CMPlugin() :
+ CMPluginBase("Twitter")
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL, protoInit, protoUninit);
+ }
+}
+ g_plugin;
diff --git a/protocols/Twitter/src/stdafx.h b/protocols/Twitter/src/stdafx.h
index 115feae40b..bda1603983 100644
--- a/protocols/Twitter/src/stdafx.h
+++ b/protocols/Twitter/src/stdafx.h
@@ -58,6 +58,7 @@ typedef std::basic_string<wchar_t> wstring;
#include <m_icolib.h>
#include <m_utils.h>
#include <m_hotkeys.h>
+#include <m_plugin.h>
#include <m_json.h>
#include <win2k.h>
#pragma warning(pop)
diff --git a/protocols/VKontakte/src/main.cpp b/protocols/VKontakte/src/main.cpp
index dd9687a554..1db46892eb 100644
--- a/protocols/VKontakte/src/main.cpp
+++ b/protocols/VKontakte/src/main.cpp
@@ -54,33 +54,12 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC
/////////////////////////////////////////////////////////////////////////////////////////
// OnLoad - initialize the plugin instance
-static CVkProto* vkProtoInit(const char *pszProtoName, const wchar_t *wszUserName)
-{
- CVkProto *ppro = new CVkProto(pszProtoName, wszUserName);
- return ppro;
-}
-
-static int vkProtoUninit(CVkProto *ppro)
-{
- delete ppro;
- return 0;
-}
-
extern "C" int __declspec(dllexport) Load()
{
mir_getLP(&pluginInfo);
pcli = Clist_GetInterface();
InitIcons();
-
- // Register protocol module
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
- pd.szName = "VKontakte";
- pd.fnInit = (pfnInitProto)vkProtoInit;
- pd.fnUninit = (pfnUninitProto)vkProtoUninit;
- pd.type = PROTOTYPE_PROTOCOL;
- Proto_RegisterModule(&pd);
return 0;
}
@@ -90,4 +69,28 @@ extern "C" int __declspec(dllexport) Load()
extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
-} \ No newline at end of file
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static PROTO_INTERFACE* protoInit(const char *pszProtoName, const wchar_t *wszUserName)
+{
+ CVkProto *ppro = new CVkProto(pszProtoName, wszUserName);
+ return ppro;
+}
+
+static int protoUninit(PROTO_INTERFACE *ppro)
+{
+ delete (CVkProto*)ppro;
+ return 0;
+}
+
+struct CMPlugin : public CMPluginBase
+{
+ CMPlugin() :
+ CMPluginBase("VKontakte")
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL, protoInit, protoUninit);
+ }
+}
+ g_plugin;
diff --git a/protocols/VKontakte/src/stdafx.h b/protocols/VKontakte/src/stdafx.h
index 148637c0a0..5af8993529 100644
--- a/protocols/VKontakte/src/stdafx.h
+++ b/protocols/VKontakte/src/stdafx.h
@@ -48,6 +48,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <m_userinfo.h>
#include <m_proto_listeningto.h>
#include <m_gui.h>
+#include <m_plugin.h>
#include <m_messagestate.h>
#include <m_popup.h>