summaryrefslogtreecommitdiff
path: root/protocols/Dummy/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-28 14:29:31 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-28 14:29:31 +0300
commita905c9c3f92fd54f37a5466649ac378db69e7cb0 (patch)
tree87a60dadfbf9fd8d916ea9100c26b6e314293242 /protocols/Dummy/src
parentd75fed3bfc9c252f5d20b889e0bec95fb0a4527e (diff)
all protocols rewritten to CMPluginBase
Diffstat (limited to 'protocols/Dummy/src')
-rw-r--r--protocols/Dummy/src/main.cpp45
-rw-r--r--protocols/Dummy/src/stdafx.h1
2 files changed, 25 insertions, 21 deletions
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>