From a905c9c3f92fd54f37a5466649ac378db69e7cb0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 28 Mar 2018 14:29:31 +0300 Subject: all protocols rewritten to CMPluginBase --- protocols/IcqOscarJ/src/init.cpp | 49 +++++++++++++++++++++------------------- protocols/IcqOscarJ/src/stdafx.h | 1 + 2 files changed, 27 insertions(+), 23 deletions(-) (limited to 'protocols/IcqOscarJ') 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 #include #include +#include // Project resources #include "resource.h" -- cgit v1.2.3