From 8a74e7495ce5ad39de4f5c25121a84d35df90c36 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 20 May 2018 15:08:48 +0300 Subject: CMPlugin to receive a reference to PLUGININFOEX --- protocols/Dummy/src/dummy.h | 10 +--------- protocols/Dummy/src/main.cpp | 33 ++++++++++++++++++++------------- 2 files changed, 21 insertions(+), 22 deletions(-) (limited to 'protocols/Dummy/src') diff --git a/protocols/Dummy/src/dummy.h b/protocols/Dummy/src/dummy.h index 32ddb8d345..2dd22bc769 100644 --- a/protocols/Dummy/src/dummy.h +++ b/protocols/Dummy/src/dummy.h @@ -70,13 +70,5 @@ static const ttemplate templates[] = struct CMPlugin : public ACCPROTOPLUGIN { - CMPlugin() : - ACCPROTOPLUGIN("Dummy") - { - int id = db_get_b(0, m_szModuleName, DUMMY_ID_TEMPLATE, -1); - if (id < 0 || id >= _countof(templates)) - SetUniqueId(ptrA(db_get_sa(0, m_szModuleName, DUMMY_ID_SETTING))); - else - SetUniqueId(templates[id].setting); - } + CMPlugin(); }; diff --git a/protocols/Dummy/src/main.cpp b/protocols/Dummy/src/main.cpp index 960fd7380b..692df7f35a 100644 --- a/protocols/Dummy/src/main.cpp +++ b/protocols/Dummy/src/main.cpp @@ -18,10 +18,11 @@ along with this program. If not, see . #include "stdafx.h" #include "version.h" +CMPlugin g_plugin; int &hLangpack(g_plugin.m_hLang); CLIST_INTERFACE *pcli; -PLUGININFOEX pluginInfo = +PLUGININFOEX pluginInfoEx = { sizeof(PLUGININFOEX), __PLUGIN_NAME, @@ -35,14 +36,24 @@ PLUGININFOEX pluginInfo = { 0x2a1081d1, 0xaee3, 0x4091, {0xb7, 0xd, 0xae, 0x46, 0xd0, 0x9f, 0x9a, 0x7f}} }; +CMPlugin::CMPlugin() : + ACCPROTOPLUGIN("Dummy", pluginInfoEx) +{ + int id = db_get_b(0, m_szModuleName, DUMMY_ID_TEMPLATE, -1); + if (id < 0 || id >= _countof(templates)) + SetUniqueId(ptrA(db_get_sa(0, m_szModuleName, DUMMY_ID_SETTING))); + else + SetUniqueId(templates[id].setting); +} + extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD) { - return &pluginInfo; + return &pluginInfoEx; } ///////////////////////////////////////////////////////////////////////////////////////// -extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCOL, MIID_LAST}; +extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST }; ///////////////////////////////////////////////////////////////////////////////////////// // OnModulesLoaded - execute some code when all plugins are initialized @@ -57,7 +68,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) extern "C" int __declspec(dllexport) Load() { - mir_getLP(&pluginInfo); + mir_getLP(&pluginInfoEx); pcli = Clist_GetInterface(); HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); @@ -72,16 +83,12 @@ extern "C" int __declspec(dllexport) Unload(void) return 0; } -///////////////////////////////////////////////////////////////////////////////////////// - -CMPlugin g_plugin; - ///////////////////////////////////////////////////////////////////////////////////////// // stubs for obsoleted protocols struct CMPluginAim : public ACCPROTOPLUGIN { - CMPluginAim() : ACCPROTOPLUGIN("AIM") + CMPluginAim() : ACCPROTOPLUGIN("AIM", pluginInfoEx) { SetUniqueId("SN"); } @@ -90,7 +97,7 @@ static g_pluginAim; struct CMPluginYahoo : public ACCPROTOPLUGIN { - CMPluginYahoo() : ACCPROTOPLUGIN("YAHOO") + CMPluginYahoo() : ACCPROTOPLUGIN("YAHOO", pluginInfoEx) { SetUniqueId("yahoo_id"); } @@ -99,7 +106,7 @@ static g_pluginYahoo; struct CMPluginTlen : public ACCPROTOPLUGIN { - CMPluginTlen() : ACCPROTOPLUGIN("TLEN") + CMPluginTlen() : ACCPROTOPLUGIN("TLEN", pluginInfoEx) { SetUniqueId("jid"); } @@ -108,7 +115,7 @@ static g_pluginTlen; struct CMPluginXFire : public ACCPROTOPLUGIN { - CMPluginXFire() : ACCPROTOPLUGIN("XFire") + CMPluginXFire() : ACCPROTOPLUGIN("XFire", pluginInfoEx) { SetUniqueId("Username"); } @@ -117,7 +124,7 @@ static g_pluginXFire; struct CMPluginWhatsapp : public ACCPROTOPLUGIN { - CMPluginWhatsapp() : ACCPROTOPLUGIN("WhatsApp") + CMPluginWhatsapp() : ACCPROTOPLUGIN("WhatsApp", pluginInfoEx) { SetUniqueId("ID"); } -- cgit v1.2.3