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 --- bin15/mir_full.sln | 11 +++- include/m_plugin.h | 16 +++-- libs/win32/mir_app.lib | Bin 141746 -> 142962 bytes libs/win64/mir_app.lib | Bin 137694 -> 138934 bytes plugins/CloudFile/src/Services/dropbox_service.cpp | 12 ++++ plugins/CloudFile/src/Services/google_service.cpp | 12 ++++ .../CloudFile/src/Services/microsoft_service.cpp | 12 ++++ plugins/CloudFile/src/Services/yandex_service.cpp | 12 ++++ plugins/CloudFile/src/main.cpp | 2 +- plugins/CloudFile/src/services.cpp | 26 +------- plugins/CloudFile/src/stdafx.h | 1 + plugins/ConnectionNotify/src/ConnectionNotify.cpp | 20 +++--- plugins/ConnectionNotify/src/stdafx.h | 1 + plugins/GmailNotifier/src/main.cpp | 17 +++-- plugins/GmailNotifier/src/stdafx.h | 1 + plugins/LotusNotify/src/LotusNotify.cpp | 19 +++--- plugins/LotusNotify/src/stdafx.h | 4 +- plugins/NewsAggregator/Src/NewsAggregator.cpp | 19 +++--- plugins/NewsAggregator/Src/stdafx.h | 1 + plugins/Non-IM Contact/src/main.cpp | 17 +++-- plugins/Non-IM Contact/src/stdafx.h | 1 + plugins/Quotes/src/Forex.cpp | 18 ++++-- plugins/Quotes/src/stdafx.h | 1 + plugins/Weather/src/stdafx.h | 1 + plugins/Weather/src/weather.cpp | 20 +++--- plugins/WebView/src/main.cpp | 19 +++--- plugins/WebView/src/stdafx.h | 1 + plugins/YAMN/src/main.cpp | 18 ++++-- plugins/YAMN/src/stdafx.h | 1 + protocols/Discord/src/main.cpp | 43 +++++++------ protocols/Discord/src/stdafx.h | 1 + protocols/Dummy/src/main.cpp | 45 +++++++------- protocols/Dummy/src/stdafx.h | 1 + protocols/EmLanProto/src/amdproto.cpp | 17 +++-- protocols/EmLanProto/src/stdafx.h | 1 + protocols/FacebookRM/src/main.cpp | 20 +++--- protocols/FacebookRM/src/stdafx.h | 1 + protocols/Gadu-Gadu/src/gg.cpp | 57 ++++++++--------- protocols/Gadu-Gadu/src/gg.h | 1 + protocols/ICQCorp/src/corp.cpp | 33 ++++++---- protocols/ICQCorp/src/stdafx.h | 1 + protocols/IRCG/src/main.cpp | 49 ++++++++------- protocols/IRCG/src/stdafx.h | 1 + protocols/IcqOscarJ/src/init.cpp | 49 ++++++++------- protocols/IcqOscarJ/src/stdafx.h | 1 + protocols/JabberG/src/jabber.cpp | 50 ++++++++------- protocols/MRA/src/Mra.cpp | 50 ++++++++------- protocols/MRA/src/stdafx.h | 1 + protocols/MSN/src/msn.cpp | 46 +++++++------- protocols/MSN/src/stdafx.h | 1 + protocols/MinecraftDynmap/src/main.cpp | 46 +++++++------- protocols/MinecraftDynmap/src/stdafx.h | 1 + protocols/Omegle/src/main.cpp | 46 +++++++------- protocols/Omegle/src/stdafx.h | 1 + protocols/Sametime/src/StdAfx.h | 1 + protocols/Sametime/src/sametime.cpp | 43 +++++++------ protocols/SkypeWeb/src/main.cpp | 22 ++++--- protocols/SkypeWeb/src/stdafx.h | 1 + protocols/Steam/src/main.cpp | 22 ++++--- protocols/Steam/src/stdafx.h | 1 + protocols/Tox/src/main.cpp | 22 ++++--- protocols/Tox/src/stdafx.h | 1 + protocols/Twitter/src/main.cpp | 48 +++++++------- protocols/Twitter/src/stdafx.h | 1 + protocols/VKontakte/src/main.cpp | 47 +++++++------- protocols/VKontakte/src/stdafx.h | 1 + src/mir_app/src/CMPluginBase.cpp | 21 +++++-- src/mir_app/src/mir_app.def | 69 +++++++++++---------- src/mir_app/src/mir_app64.def | 69 +++++++++++---------- 69 files changed, 705 insertions(+), 510 deletions(-) diff --git a/bin15/mir_full.sln b/bin15/mir_full.sln index 6abca21f9e..1ee2289904 100644 --- a/bin15/mir_full.sln +++ b/bin15/mir_full.sln @@ -2041,7 +2041,6 @@ Global {B988F96C-F87A-484C-AB15-D0674B22F291} = {D8EA3AE1-64AA-42ED-9F13-83F6C7B5AA55} {DD76B998-ED0D-4BFD-9660-3ADC3A334872} = {D8EA3AE1-64AA-42ED-9F13-83F6C7B5AA55} {27CA5499-B3F2-4FB6-8414-651819B0B96C} = {D8EA3AE1-64AA-42ED-9F13-83F6C7B5AA55} - {C09A0E86-E7C3-4229-B817-C86A0AE8ACE5} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} {37C2B9A4-63EF-49E8-BF23-677B5EBD73E9} = {D8EA3AE1-64AA-42ED-9F13-83F6C7B5AA55} {EE182018-5D3D-43F3-955F-7B5AB0BE2FCA} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} {DADE9455-DC28-465A-9604-2CA28052B9FB} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} @@ -2066,27 +2065,33 @@ Global {F47EAB99-C78F-4A92-87D5-B0E16FE5A133} = {E7FB43FB-3563-4568-8846-A88FC37449BF} {8D0F60DE-DB07-49FD-8E1F-0DE558BE6DE3} = {E7FB43FB-3563-4568-8846-A88FC37449BF} {2C9F6CB6-3E70-4E7A-945D-2A7C148B0DF3} = {E7FB43FB-3563-4568-8846-A88FC37449BF} - {73482497-9F57-4819-A9AB-5D841A9F072D} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} {9C6040B8-1173-40FA-A3DB-DE044CCD8250} = {F13387B0-1C74-48EC-9AEC-65E3B9DE29E4} {576EEEFD-E423-482B-879A-F0515D40B8E1} = {E7FB43FB-3563-4568-8846-A88FC37449BF} {4CE78D43-FF23-4134-A5AC-B2CF0F8D9F3B} = {D8EA3AE1-64AA-42ED-9F13-83F6C7B5AA55} {ABF05E2C-C335-4BD1-8C3E-4C63285362CF} = {D8EA3AE1-64AA-42ED-9F13-83F6C7B5AA55} + {C5A87409-F08C-4A07-A8F9-1F5D52BA6D72} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} + {6DE11A47-2268-4B08-8DE5-15A1705FCE28} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} {C619A811-8023-4441-B3D7-785388A09DF0} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} {6BFE3E13-BD5D-4C1C-BB29-A82FB51A16CE} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} {155211F8-08E1-4864-A3B8-9F04F4270360} = {D8EA3AE1-64AA-42ED-9F13-83F6C7B5AA55} {2E15C462-A150-4A37-ACD6-FBAECF1724F5} = {F9C41695-3353-4564-A154-58106829B19C} {01F9E227-06F5-4BED-907F-402CA7DFAFE6} = {37EDFBEA-8446-4BF3-9F2E-655908CDFB62} + {A556E0B5-73A1-4676-BA1F-133820DE7D5A} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} {0E046380-14CA-4C23-A807-8C678519A605} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} - {F462FDA1-BDCD-49B2-B996-D7DE71D07393} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} + {3C83B0AB-9739-41C1-A127-ED7DB9551F76} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} + {475ED6ED-C311-4188-ACB2-1C41830B22EE} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} {BF6E1942-7E42-4564-9DF5-FD0A00D71173} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} {B5BCDC2F-81FC-4324-90C6-E5540A225EFF} = {D8EA3AE1-64AA-42ED-9F13-83F6C7B5AA55} + {BE22A21F-73B7-453F-86A0-B867F0056490} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} {12BCA020-EABF-429E-876A-A476BC9C10C0} = {37EDFBEA-8446-4BF3-9F2E-655908CDFB62} {EDAAD28B-505B-4969-A8BB-97EAE818DEEA} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} {6124E997-426E-4A0B-9617-D6D577D5E7D7} = {37EDFBEA-8446-4BF3-9F2E-655908CDFB62} {7F5EA8BC-8F2B-478E-8F05-0ED4B691B776} = {D8EA3AE1-64AA-42ED-9F13-83F6C7B5AA55} + {D3B4DDFF-D3A5-4452-AE9D-B43B3C97C821} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} {8236EA1F-579A-4AFB-9DFE-5FA056AEDDBB} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} {6C0C35E7-6522-403C-BB60-9805CDB9E52F} = {30218E20-9E62-4027-BB87-2627B17F6CA3} {66A9BDEB-150F-45DC-B20F-9892C0B43834} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} + {BCFAB658-326E-466D-995B-E76636C1DEA4} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} {B4327D10-ACDC-4C12-9555-749DD49A7BB0} = {A035B524-0F2D-45D0-BCF2-3C20279C77E2} {27D41D81-991F-4DC6-8749-B0321C87E694} = {329B4E94-C846-4C78-AFD5-8B6B839DCCE1} {BD291BF0-D804-4818-8311-DE871E6BCEAA} = {37EDFBEA-8446-4BF3-9F2E-655908CDFB62} diff --git a/include/m_plugin.h b/include/m_plugin.h index 5588f7c865..b54d64aea3 100644 --- a/include/m_plugin.h +++ b/include/m_plugin.h @@ -2,8 +2,9 @@ #include #include +#include -class MIR_APP_EXPORT CMPlugin +class MIR_APP_EXPORT CMPluginBase { void tryOpenLog(); @@ -11,8 +12,11 @@ protected: const char *m_szModuleName; HANDLE m_hLogger = nullptr; - CMPlugin(const char *moduleName); - ~CMPlugin(); + CMPluginBase(const char *moduleName); + ~CMPluginBase(); + + // pass one of PROTOTYPE_* constants as type + void RegisterProtocol(int type, pfnInitProto = nullptr, pfnUninitProto = nullptr); public: void debugLogA(LPCSTR szFormat, ...); @@ -145,14 +149,14 @@ public: } }; -extern CMPlugin g_plugin; +extern struct CMPlugin g_plugin; ///////////////////////////////////////////////////////////////////////////////////////// // Basic class for plugins (not protocols) written in C++ -template class PLUGIN : public CMPlugin +template class PLUGIN : public CMPluginBase { - typedef CMPlugin CSuper; + typedef CMPluginBase CSuper; protected: PLUGIN(const char *moduleName) diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index 24fa479955..4cc21599c5 100644 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index 8b301eaec8..a9c9c37fe0 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/plugins/CloudFile/src/Services/dropbox_service.cpp b/plugins/CloudFile/src/Services/dropbox_service.cpp index a9c902e13a..573fe90dbb 100644 --- a/plugins/CloudFile/src/Services/dropbox_service.cpp +++ b/plugins/CloudFile/src/Services/dropbox_service.cpp @@ -299,3 +299,15 @@ UINT CDropboxService::Upload(FileTransferParam *ftp) ftp->SetStatus(ACKRESULT_SUCCESS); return ACKRESULT_SUCCESS; } + +///////////////////////////////////////////////////////////////////////////////////////// + +struct CMPlugin : public CMPluginBase +{ + CMPlugin() : + CMPluginBase(MODULE "/Dropbox") + { + RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CDropboxService::Init, (pfnUninitProto)CDropboxService::UnInit); + } +} +static g_plugin; diff --git a/plugins/CloudFile/src/Services/google_service.cpp b/plugins/CloudFile/src/Services/google_service.cpp index 6a40d3ec46..be818596a6 100644 --- a/plugins/CloudFile/src/Services/google_service.cpp +++ b/plugins/CloudFile/src/Services/google_service.cpp @@ -284,3 +284,15 @@ UINT CGDriveService::Upload(FileTransferParam *ftp) ftp->SetStatus(ACKRESULT_SUCCESS); return ACKRESULT_SUCCESS; } + +///////////////////////////////////////////////////////////////////////////////////////// + +struct CMPlugin : public CMPluginBase +{ + CMPlugin() : + CMPluginBase(MODULE "/GDrive") + { + RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CGDriveService::Init, (pfnUninitProto)CGDriveService::UnInit); + } +} +static g_plugin; diff --git a/plugins/CloudFile/src/Services/microsoft_service.cpp b/plugins/CloudFile/src/Services/microsoft_service.cpp index 3f5ebeab4d..3366779d33 100644 --- a/plugins/CloudFile/src/Services/microsoft_service.cpp +++ b/plugins/CloudFile/src/Services/microsoft_service.cpp @@ -273,3 +273,15 @@ UINT COneDriveService::Upload(FileTransferParam *ftp) ftp->SetStatus(ACKRESULT_SUCCESS); return ACKRESULT_SUCCESS; } + +///////////////////////////////////////////////////////////////////////////////////////// + +struct CMPlugin : public CMPluginBase +{ + CMPlugin() : + CMPluginBase(MODULE "/OneDrive") + { + RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)COneDriveService::Init, (pfnUninitProto)COneDriveService::UnInit); + } +} +static g_plugin; diff --git a/plugins/CloudFile/src/Services/yandex_service.cpp b/plugins/CloudFile/src/Services/yandex_service.cpp index 97ce0eda46..88419fffc4 100644 --- a/plugins/CloudFile/src/Services/yandex_service.cpp +++ b/plugins/CloudFile/src/Services/yandex_service.cpp @@ -279,3 +279,15 @@ UINT CYandexService::Upload(FileTransferParam *ftp) ftp->SetStatus(ACKRESULT_SUCCESS); return ACKRESULT_SUCCESS; } + +///////////////////////////////////////////////////////////////////////////////////////// + +struct CMPlugin : public CMPluginBase +{ + CMPlugin() : + CMPluginBase(MODULE "/YandexDisk") + { + RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CYandexService::Init, (pfnUninitProto)CYandexService::UnInit); + } +} +static g_plugin; diff --git a/plugins/CloudFile/src/main.cpp b/plugins/CloudFile/src/main.cpp index 28627c612e..c01ca5eba7 100644 --- a/plugins/CloudFile/src/main.cpp +++ b/plugins/CloudFile/src/main.cpp @@ -44,4 +44,4 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void) { return 0; -} \ No newline at end of file +} diff --git a/plugins/CloudFile/src/services.cpp b/plugins/CloudFile/src/services.cpp index 80fc88a852..0b9e062b09 100644 --- a/plugins/CloudFile/src/services.cpp +++ b/plugins/CloudFile/src/services.cpp @@ -89,30 +89,8 @@ INT_PTR Upload(WPARAM wParam, LPARAM lParam) void InitializeServices() { PROTOCOLDESCRIPTOR pd = { sizeof(pd) }; - pd.type = PROTOTYPE_PROTOCOL; - - pd.szName = MODULE "/Dropbox"; - pd.fnInit = (pfnInitProto)CDropboxService::Init; - pd.fnUninit = (pfnUninitProto)CDropboxService::UnInit; - Proto_RegisterModule(&pd); - - pd.szName = MODULE "/GDrive"; - pd.fnInit = (pfnInitProto)CGDriveService::Init; - pd.fnUninit = (pfnUninitProto)CGDriveService::UnInit; - Proto_RegisterModule(&pd); - - pd.szName = MODULE "/OneDrivre"; - pd.fnInit = (pfnInitProto)COneDriveService::Init; - pd.fnUninit = (pfnUninitProto)COneDriveService::UnInit; - Proto_RegisterModule(&pd); - - pd.szName = MODULE "/YandexDisk"; - pd.fnInit = (pfnInitProto)CYandexService::Init; - pd.fnUninit = (pfnUninitProto)CYandexService::UnInit; - Proto_RegisterModule(&pd); - - pd.szName = MODULE; pd.type = PROTOTYPE_FILTER; + pd.szName = MODULE; Proto_RegisterModule(&pd); CreateServiceFunction(MODULE PSS_FILE, SendFileInterceptor); @@ -120,4 +98,4 @@ void InitializeServices() CreateServiceFunction(MS_CLOUDFILE_GETSERVICE, GetService); CreateServiceFunction(MS_CLOUDFILE_ENUMSERVICES, EnumServices); CreateServiceFunction(MS_CLOUDFILE_UPLOAD, Upload); -} \ No newline at end of file +} diff --git a/plugins/CloudFile/src/stdafx.h b/plugins/CloudFile/src/stdafx.h index 61d86ce5fa..b35ab0ed8c 100644 --- a/plugins/CloudFile/src/stdafx.h +++ b/plugins/CloudFile/src/stdafx.h @@ -30,6 +30,7 @@ #include #include #include +#include #include diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp index cb1e82dbec..a703a9f5a2 100644 --- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp +++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp @@ -859,13 +859,7 @@ extern "C" int __declspec(dllexport) Load(void) LoadSettings(); connExceptions = LoadSettingsConnections(); - PROTOCOLDESCRIPTOR pd = { 0 }; - pd.cbSize = sizeof(pd); - pd.szName = PLUGINNAME; - pd.type = PROTOTYPE_PROTOCOL; - Proto_RegisterModule(&pd); - - //set all contacts to offline + // set all contacts to offline for (auto &hContact : Contacts(PLUGINNAME)) db_set_w(hContact, PLUGINNAME, "status", ID_STATUS_OFFLINE); @@ -903,3 +897,15 @@ extern "C" int __declspec(dllexport) Unload(void) #endif return 0; } + +///////////////////////////////////////////////////////////////////////////////////////// + +struct CMPlugin : public CMPluginBase +{ + CMPlugin() : + CMPluginBase(PLUGINNAME) + { + RegisterProtocol(PROTOTYPE_PROTOCOL); + } +} + g_plugin; diff --git a/plugins/ConnectionNotify/src/stdafx.h b/plugins/ConnectionNotify/src/stdafx.h index 2837c72125..201a5a233f 100644 --- a/plugins/ConnectionNotify/src/stdafx.h +++ b/plugins/ConnectionNotify/src/stdafx.h @@ -16,6 +16,7 @@ #include #include #include +#include #ifdef _DEBUG #include "debug.h" diff --git a/plugins/GmailNotifier/src/main.cpp b/plugins/GmailNotifier/src/main.cpp index 3a715ca048..9dccc5965d 100644 --- a/plugins/GmailNotifier/src/main.cpp +++ b/plugins/GmailNotifier/src/main.cpp @@ -94,11 +94,6 @@ extern "C" int __declspec(dllexport) Load() Skin_AddSound("Gmail", LPGENW("Other"), LPGENW("Gmail: New thread(s)")); HookEvent(ME_CLIST_DOUBLECLICKED, OpenBrowser); - PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE }; - pd.szName = MODULE_NAME; - pd.type = PROTOTYPE_VIRTUAL; - Proto_RegisterModule(&pd); - NETLIBUSER nlu = {}; nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE; nlu.szSettingsModule = MODULE_NAME; @@ -172,3 +167,15 @@ extern "C" int __declspec(dllexport) Unload(void) UnhookEvent(hOptionsInitial); return 0; } + +///////////////////////////////////////////////////////////////////////////////////////// + +struct CMPlugin : public CMPluginBase +{ + CMPlugin() : + CMPluginBase(MODULE_NAME) + { + RegisterProtocol(PROTOTYPE_VIRTUAL); + } +} + g_plugin; diff --git a/plugins/GmailNotifier/src/stdafx.h b/plugins/GmailNotifier/src/stdafx.h index 936a16376a..40a8bedf68 100644 --- a/plugins/GmailNotifier/src/stdafx.h +++ b/plugins/GmailNotifier/src/stdafx.h @@ -20,6 +20,7 @@ #include "m_clc.h" #include "m_popup.h" #include "m_netlib.h" +#include #define WM_SHELLNOTIFY WM_USER+5 #define IDI_TRAY WM_USER+6 diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index d13ff2253c..344bf56f18 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -1708,13 +1708,6 @@ extern "C" int __declspec(dllexport) Load(void) Menu_EnableItem(hMenuHandle, FALSE); } - // create protocol - PROTOCOLDESCRIPTOR pd = { 0 }; - pd.cbSize = sizeof(pd); - pd.szName = PLUGINNAME; - pd.type = PROTOTYPE_PROTOCOL; - Proto_RegisterModule(&pd); - // set all contacts to offline for (auto &hContact : Contacts(PLUGINNAME)) db_set_w(hContact, PLUGINNAME, "status", ID_STATUS_OFFLINE); @@ -1777,3 +1770,15 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID ) } return TRUE; } + +///////////////////////////////////////////////////////////////////////////////////////// + +struct CMPlugin : public CMPluginBase +{ + CMPlugin() : + CMPluginBase(PLUGINNAME) + { + RegisterProtocol(PROTOTYPE_PROTOCOL); + } +} + g_plugin; diff --git a/plugins/LotusNotify/src/stdafx.h b/plugins/LotusNotify/src/stdafx.h index f94dbb2002..9e66d0cc79 100644 --- a/plugins/LotusNotify/src/stdafx.h +++ b/plugins/LotusNotify/src/stdafx.h @@ -21,10 +21,8 @@ #include #include #include -//debug.h #include - - +#include // Notesapi headers #define W32 diff --git a/plugins/NewsAggregator/Src/NewsAggregator.cpp b/plugins/NewsAggregator/Src/NewsAggregator.cpp index ab1ac2f830..421fe9666b 100644 --- a/plugins/NewsAggregator/Src/NewsAggregator.cpp +++ b/plugins/NewsAggregator/Src/NewsAggregator.cpp @@ -66,13 +66,6 @@ extern "C" __declspec(dllexport) int Load(void) hUpdateMutex = CreateMutex(nullptr, FALSE, nullptr); - // register weather protocol - PROTOCOLDESCRIPTOR pd = { 0 }; - pd.cbSize = sizeof(pd); - pd.szName = MODULE; - pd.type = PROTOTYPE_VIRTUAL; - Proto_RegisterModule(&pd); - CreateProtoServiceFunction(MODULE, PS_GETNAME, NewsAggrGetName); CreateProtoServiceFunction(MODULE, PS_GETCAPS, NewsAggrGetCaps); CreateProtoServiceFunction(MODULE, PS_SETSTATUS, NewsAggrSetStatus); @@ -110,3 +103,15 @@ extern "C" __declspec(dllexport) int Unload(void) CloseHandle(hUpdateMutex); return 0; } + +///////////////////////////////////////////////////////////////////////////////////////// + +struct CMPlugin : public CMPluginBase +{ + CMPlugin() : + CMPluginBase(MODULE) + { + RegisterProtocol(PROTOTYPE_VIRTUAL); + } +} + g_plugin; diff --git a/plugins/NewsAggregator/Src/stdafx.h b/plugins/NewsAggregator/Src/stdafx.h index 0c5fa1436d..40fc6f7002 100644 --- a/plugins/NewsAggregator/Src/stdafx.h +++ b/plugins/NewsAggregator/Src/stdafx.h @@ -45,6 +45,7 @@ Boston, MA 02111-1307, USA. #include #include #include +#include #include #include diff --git a/plugins/Non-IM Contact/src/main.cpp b/plugins/Non-IM Contact/src/main.cpp index 43123d7a3f..fd7de1059d 100644 --- a/plugins/Non-IM Contact/src/main.cpp +++ b/plugins/Non-IM Contact/src/main.cpp @@ -127,10 +127,7 @@ extern "C" __declspec(dllexport) int Load() HookEvent(ME_OPT_INITIALISE, NimcOptInit); HookEvent(ME_CLIST_STATUSMODECHANGE, SetLCStatus); - PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE, MODNAME, PROTOTYPE_VIRTUAL }; - Proto_RegisterModule(&pd); - - //load services (the first 5 are the basic ones needed to make a new protocol) + // load services (the first 5 are the basic ones needed to make a new protocol) CreateProtoServiceFunction(MODNAME, PS_GETCAPS, GetLCCaps); CreateProtoServiceFunction(MODNAME, PS_GETNAME, GetLCName); CreateProtoServiceFunction(MODNAME, PS_LOADICON, LoadLCIcon); @@ -204,3 +201,15 @@ extern "C" __declspec(dllexport) int Unload(void) killTimer(); return 0; } + +///////////////////////////////////////////////////////////////////////////////////////// + +struct CMPlugin : public CMPluginBase +{ + CMPlugin() : + CMPluginBase(MODNAME) + { + RegisterProtocol(PROTOTYPE_VIRTUAL); + } +} + g_plugin; diff --git a/plugins/Non-IM Contact/src/stdafx.h b/plugins/Non-IM Contact/src/stdafx.h index ce265a31bd..c5495b3b09 100644 --- a/plugins/Non-IM Contact/src/stdafx.h +++ b/plugins/Non-IM Contact/src/stdafx.h @@ -44,6 +44,7 @@ struct DLGTEMPLATEEX #include #include #include +#include #include #include diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index 28e645cdea..7a99cd754d 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -315,12 +315,6 @@ EXTERN_C int __declspec(dllexport) Load(void) Quotes_IconsInit(); Quotes_InitExtraIcons(); - PROTOCOLDESCRIPTOR pd = { 0 }; - pd.cbSize = PROTOCOLDESCRIPTOR_V3_SIZE; - pd.szName = QUOTES_PROTOCOL_NAME; - pd.type = PROTOTYPE_VIRTUAL; - Proto_RegisterModule(&pd); - CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETCAPS, QuoteProtoFunc_GetCaps); CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETSTATUS, QuoteProtoFunc_GetStatus); @@ -343,3 +337,15 @@ EXTERN_C __declspec(dllexport) int Unload(void) return 0; } + +///////////////////////////////////////////////////////////////////////////////////////// + +struct CMPlugin : public CMPluginBase +{ + CMPlugin() : + CMPluginBase(QUOTES_PROTOCOL_NAME) + { + RegisterProtocol(PROTOTYPE_VIRTUAL); + } +} + g_plugin; diff --git a/plugins/Quotes/src/stdafx.h b/plugins/Quotes/src/stdafx.h index 838c01b6e9..abdfcb6ea4 100644 --- a/plugins/Quotes/src/stdafx.h +++ b/plugins/Quotes/src/stdafx.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include diff --git a/plugins/Weather/src/stdafx.h b/plugins/Weather/src/stdafx.h index d9ec87c558..17eca030b2 100644 --- a/plugins/Weather/src/stdafx.h +++ b/plugins/Weather/src/stdafx.h @@ -54,6 +54,7 @@ along with this program. If not, see . #include #include #include +#include #include #include diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp index 8ea8f6605f..1a01b18802 100644 --- a/plugins/Weather/src/weather.cpp +++ b/plugins/Weather/src/weather.cpp @@ -216,13 +216,6 @@ extern "C" int __declspec(dllexport) Load(void) hUpdateMutex = CreateMutex(nullptr, FALSE, nullptr); - // register weather protocol - PROTOCOLDESCRIPTOR pd = { 0 }; - pd.cbSize = sizeof(pd); - pd.szName = WEATHERPROTONAME; - pd.type = (opt.NoProtoCondition) ? PROTOTYPE_VIRTUAL : PROTOTYPE_PROTOCOL; - Proto_RegisterModule(&pd); - // initialize weather protocol services InitServices(); @@ -238,3 +231,16 @@ extern "C" int __declspec(dllexport) Load(void) SetWindowLongPtr(hPopupWindow, GWLP_WNDPROC, (LONG_PTR)PopupWndProc); return 0; } + +///////////////////////////////////////////////////////////////////////////////////////// + +struct CMPlugin : public CMPluginBase +{ + CMPlugin() : + CMPluginBase(WEATHERPROTONAME) + { + opt.NoProtoCondition = db_get_b(NULL, WEATHERPROTONAME, "NoStatus", true); + RegisterProtocol((opt.NoProtoCondition) ? PROTOTYPE_VIRTUAL : PROTOTYPE_PROTOCOL); + } +} + g_plugin; diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp index c69558c13f..712dc64f0c 100644 --- a/plugins/WebView/src/main.cpp +++ b/plugins/WebView/src/main.cpp @@ -152,13 +152,6 @@ extern "C" int __declspec(dllexport) Load() nlu.szDescriptiveName.a = tempNdesc; hNetlibUser = Netlib_RegisterUser(&nlu); - // register webview protocol - PROTOCOLDESCRIPTOR pd = { 0 }; - pd.cbSize = sizeof(pd); - pd.szName = MODULENAME; - pd.type = PROTOTYPE_PROTOCOL; - Proto_RegisterModule(&pd); - //protocol services InitServices(); @@ -290,3 +283,15 @@ extern "C" int __declspec(dllexport) Load() db_set_b(NULL, MODULENAME, HAS_CRASHED_KEY, 1); return 0; } + +///////////////////////////////////////////////////////////////////////////////////////// + +struct CMPlugin : public CMPluginBase +{ + CMPlugin() : + CMPluginBase(MODULENAME) + { + RegisterProtocol(PROTOTYPE_PROTOCOL); + } +} + g_plugin; diff --git a/plugins/WebView/src/stdafx.h b/plugins/WebView/src/stdafx.h index 3ce8c77b06..64808dddad 100644 --- a/plugins/WebView/src/stdafx.h +++ b/plugins/WebView/src/stdafx.h @@ -31,6 +31,7 @@ #include #include #include +#include #include "resource.h" #include "version.h" diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index 8c3b95350a..1e5a26ecb9 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -265,12 +265,6 @@ extern "C" int __declspec(dllexport) Load(void) } } - // Registering YAMN as protocol - PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE }; - pd.szName = YAMN_DBMODULE; - pd.type = PROTOTYPE_VIRTUAL; - Proto_RegisterModule(&pd); - if (nullptr == (NoWriterEV = CreateEvent(nullptr, TRUE, TRUE, nullptr))) return 1; if (nullptr == (WriteToFileEV = CreateEvent(nullptr, FALSE, FALSE, nullptr))) @@ -365,3 +359,15 @@ extern "C" int __declspec(dllexport) Unload(void) delete[] CodePageNamesSupp; return 0; } + +///////////////////////////////////////////////////////////////////////////////////////// + +struct CMPlugin : public CMPluginBase +{ + CMPlugin() : + CMPluginBase(YAMN_DBMODULE) + { + RegisterProtocol(PROTOTYPE_VIRTUAL); + } +} + g_plugin; diff --git a/plugins/YAMN/src/stdafx.h b/plugins/YAMN/src/stdafx.h index 9785e95622..813f4848a9 100644 --- a/plugins/YAMN/src/stdafx.h +++ b/plugins/YAMN/src/stdafx.h @@ -29,6 +29,7 @@ #include #include #include +#include #include "main.h" #include "mails/decode.h" 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 #include #include +#include #include #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 . #include #include #include +#include #include 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 #include #include +#include #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 . #include #include #include +#include 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 @@ -309,27 +309,6 @@ void GaduProto::menus_init() sessions_menus_init(hRoot); } -////////////////////////////////////////////////////////// -// 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 // @@ -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 #include #include +#include // 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 #include #include +#include #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 #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 #include #include +#include // 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 #include #include +#include #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 . #include #include #include +#include #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 . #include #include #include +#include #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 . #include #include #include +#include #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 #include #include +#include \ 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 . #include #include #include +#include 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 #include #include +#include #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 #include #include +#include #include #include 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(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(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 wstring; #include #include #include +#include #include #include #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 . #include #include #include +#include #include #include diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp index a6dad00e44..8a17a6ac8e 100644 --- a/src/mir_app/src/CMPluginBase.cpp +++ b/src/mir_app/src/CMPluginBase.cpp @@ -24,12 +24,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -CMPlugin::CMPlugin(const char *moduleName) : +CMPluginBase::CMPluginBase(const char *moduleName) : m_szModuleName(moduleName) { } -CMPlugin::~CMPlugin() +CMPluginBase::~CMPluginBase() { if (m_hLogger) { mir_closeLog(m_hLogger); @@ -37,14 +37,14 @@ CMPlugin::~CMPlugin() } } -void CMPlugin::tryOpenLog() +void CMPluginBase::tryOpenLog() { wchar_t path[MAX_PATH]; mir_snwprintf(path, L"%s\\%s.txt", VARSW(L"%miranda_logpath%"), m_szModuleName); m_hLogger = mir_createLog(m_szModuleName, nullptr, path, 0); } -void CMPlugin::debugLogA(LPCSTR szFormat, ...) +void CMPluginBase::debugLogA(LPCSTR szFormat, ...) { if (m_hLogger == nullptr) tryOpenLog(); @@ -55,7 +55,7 @@ void CMPlugin::debugLogA(LPCSTR szFormat, ...) va_end(args); } -void CMPlugin::debugLogW(LPCWSTR wszFormat, ...) +void CMPluginBase::debugLogW(LPCWSTR wszFormat, ...) { if (m_hLogger == nullptr) tryOpenLog(); @@ -65,3 +65,14 @@ void CMPlugin::debugLogW(LPCWSTR wszFormat, ...) mir_writeLogVW(m_hLogger, wszFormat, args); va_end(args); } + +void CMPluginBase::RegisterProtocol(int type, pfnInitProto fnInit, pfnUninitProto fnUninit) +{ + PROTOCOLDESCRIPTOR pd = {}; + pd.cbSize = (fnInit == nullptr) ? PROTOCOLDESCRIPTOR_V3_SIZE : sizeof(pd); + pd.szName = (char*)m_szModuleName; + pd.type = type; + pd.fnInit = fnInit; + pd.fnUninit = fnUninit; + Proto_RegisterModule(&pd); +} diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index da203dd583..97445ad173 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -492,37 +492,38 @@ GetDatabasePlugin @508 SetServiceModePlugin @510 Proto_CreateAccount @511 Proto_ActivateAccount @512 -??0CMPlugin@@IAE@PBD@Z @513 NONAME -??1CMPlugin@@IAE@XZ @514 NONAME -??4CMPlugin@@QAEAAV0@ABV0@@Z @515 NONAME -?debugLogA@CMPlugin@@QAAXPBDZZ @516 NONAME -?debugLogW@CMPlugin@@QAAXPB_WZZ @517 NONAME -?delSetting@CMPlugin@@QAEHIPBD@Z @518 NONAME -?delSetting@CMPlugin@@QAEHPBD@Z @519 NONAME -?getBool@CMPlugin@@QAE_NIPBD_N@Z @520 NONAME -?getBool@CMPlugin@@QAE_NPBD_N@Z @521 NONAME -?getByte@CMPlugin@@QAEHIPBDE@Z @522 NONAME -?getByte@CMPlugin@@QAEHPBDE@Z @523 NONAME -?getDword@CMPlugin@@QAEKIPBDK@Z @524 NONAME -?getDword@CMPlugin@@QAEKPBDK@Z @525 NONAME -?getString@CMPlugin@@QAEHIPBDPAUDBVARIANT@@@Z @526 NONAME -?getString@CMPlugin@@QAEHPBDPAUDBVARIANT@@@Z @527 NONAME -?getStringA@CMPlugin@@QAEPADIPBD@Z @528 NONAME -?getStringA@CMPlugin@@QAEPADPBD@Z @529 NONAME -?getWString@CMPlugin@@QAEHIPBDPAUDBVARIANT@@@Z @530 NONAME -?getWString@CMPlugin@@QAEHPBDPAUDBVARIANT@@@Z @531 NONAME -?getWStringA@CMPlugin@@QAEPA_WIPBD@Z @532 NONAME -?getWStringA@CMPlugin@@QAEPA_WPBD@Z @533 NONAME -?getWord@CMPlugin@@QAEHIPBDG@Z @534 NONAME -?getWord@CMPlugin@@QAEHPBDG@Z @535 NONAME -?setByte@CMPlugin@@QAEXIPBDE@Z @536 NONAME -?setByte@CMPlugin@@QAEXPBDE@Z @537 NONAME -?setDword@CMPlugin@@QAEXIPBDK@Z @538 NONAME -?setDword@CMPlugin@@QAEXPBDK@Z @539 NONAME -?setString@CMPlugin@@QAEXIPBD0@Z @540 NONAME -?setString@CMPlugin@@QAEXPBD0@Z @541 NONAME -?setWString@CMPlugin@@QAEXIPBDPB_W@Z @542 NONAME -?setWString@CMPlugin@@QAEXPBDPB_W@Z @543 NONAME -?setWord@CMPlugin@@QAEXIPBDG@Z @544 NONAME -?setWord@CMPlugin@@QAEXPBDG@Z @545 NONAME -?tryOpenLog@CMPlugin@@AAEXXZ @546 NONAME +??0CMPluginBase@@IAE@PBD@Z @513 NONAME +??1CMPluginBase@@IAE@XZ @514 NONAME +??4CMPluginBase@@QAEAAV0@ABV0@@Z @515 NONAME +?debugLogA@CMPluginBase@@QAAXPBDZZ @516 NONAME +?debugLogW@CMPluginBase@@QAAXPB_WZZ @517 NONAME +?delSetting@CMPluginBase@@QAEHIPBD@Z @518 NONAME +?delSetting@CMPluginBase@@QAEHPBD@Z @519 NONAME +?getBool@CMPluginBase@@QAE_NIPBD_N@Z @520 NONAME +?getBool@CMPluginBase@@QAE_NPBD_N@Z @521 NONAME +?getByte@CMPluginBase@@QAEHIPBDE@Z @522 NONAME +?getByte@CMPluginBase@@QAEHPBDE@Z @523 NONAME +?getDword@CMPluginBase@@QAEKIPBDK@Z @524 NONAME +?getDword@CMPluginBase@@QAEKPBDK@Z @525 NONAME +?getString@CMPluginBase@@QAEHIPBDPAUDBVARIANT@@@Z @526 NONAME +?getString@CMPluginBase@@QAEHPBDPAUDBVARIANT@@@Z @527 NONAME +?getStringA@CMPluginBase@@QAEPADIPBD@Z @528 NONAME +?getStringA@CMPluginBase@@QAEPADPBD@Z @529 NONAME +?getWString@CMPluginBase@@QAEHIPBDPAUDBVARIANT@@@Z @530 NONAME +?getWString@CMPluginBase@@QAEHPBDPAUDBVARIANT@@@Z @531 NONAME +?getWStringA@CMPluginBase@@QAEPA_WIPBD@Z @532 NONAME +?getWStringA@CMPluginBase@@QAEPA_WPBD@Z @533 NONAME +?getWord@CMPluginBase@@QAEHIPBDG@Z @534 NONAME +?getWord@CMPluginBase@@QAEHPBDG@Z @535 NONAME +?setByte@CMPluginBase@@QAEXIPBDE@Z @536 NONAME +?setByte@CMPluginBase@@QAEXPBDE@Z @537 NONAME +?setDword@CMPluginBase@@QAEXIPBDK@Z @538 NONAME +?setDword@CMPluginBase@@QAEXPBDK@Z @539 NONAME +?setString@CMPluginBase@@QAEXIPBD0@Z @540 NONAME +?setString@CMPluginBase@@QAEXPBD0@Z @541 NONAME +?setWString@CMPluginBase@@QAEXIPBDPB_W@Z @542 NONAME +?setWString@CMPluginBase@@QAEXPBDPB_W@Z @543 NONAME +?setWord@CMPluginBase@@QAEXIPBDG@Z @544 NONAME +?setWord@CMPluginBase@@QAEXPBDG@Z @545 NONAME +?tryOpenLog@CMPluginBase@@AAEXXZ @546 NONAME +?RegisterProtocol@CMPluginBase@@IAEXHP6APAUPROTO_INTERFACE@@PBDPB_W@ZP6AHPAU2@@Z@Z @547 NONAME diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 012dd53097..fbc4904145 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -492,37 +492,38 @@ GetDatabasePlugin @508 SetServiceModePlugin @510 Proto_CreateAccount @511 Proto_ActivateAccount @512 -??0CMPlugin@@IEAA@PEBD@Z @513 NONAME -??1CMPlugin@@IEAA@XZ @514 NONAME -??4CMPlugin@@QEAAAEAV0@AEBV0@@Z @515 NONAME -?debugLogA@CMPlugin@@QEAAXPEBDZZ @516 NONAME -?debugLogW@CMPlugin@@QEAAXPEB_WZZ @517 NONAME -?delSetting@CMPlugin@@QEAA_JIPEBD@Z @518 NONAME -?delSetting@CMPlugin@@QEAA_JPEBD@Z @519 NONAME -?getBool@CMPlugin@@QEAA_NIPEBD_N@Z @520 NONAME -?getBool@CMPlugin@@QEAA_NPEBD_N@Z @521 NONAME -?getByte@CMPlugin@@QEAAHIPEBDE@Z @522 NONAME -?getByte@CMPlugin@@QEAAHPEBDE@Z @523 NONAME -?getDword@CMPlugin@@QEAAKIPEBDK@Z @524 NONAME -?getDword@CMPlugin@@QEAAKPEBDK@Z @525 NONAME -?getString@CMPlugin@@QEAA_JIPEBDPEAUDBVARIANT@@@Z @526 NONAME -?getString@CMPlugin@@QEAA_JPEBDPEAUDBVARIANT@@@Z @527 NONAME -?getStringA@CMPlugin@@QEAAPEADIPEBD@Z @528 NONAME -?getStringA@CMPlugin@@QEAAPEADPEBD@Z @529 NONAME -?getWString@CMPlugin@@QEAA_JIPEBDPEAUDBVARIANT@@@Z @530 NONAME -?getWString@CMPlugin@@QEAA_JPEBDPEAUDBVARIANT@@@Z @531 NONAME -?getWStringA@CMPlugin@@QEAAPEA_WIPEBD@Z @532 NONAME -?getWStringA@CMPlugin@@QEAAPEA_WPEBD@Z @533 NONAME -?getWord@CMPlugin@@QEAAHIPEBDG@Z @534 NONAME -?getWord@CMPlugin@@QEAAHPEBDG@Z @535 NONAME -?setByte@CMPlugin@@QEAAXIPEBDE@Z @536 NONAME -?setByte@CMPlugin@@QEAAXPEBDE@Z @537 NONAME -?setDword@CMPlugin@@QEAAXIPEBDK@Z @538 NONAME -?setDword@CMPlugin@@QEAAXPEBDK@Z @539 NONAME -?setString@CMPlugin@@QEAAXIPEBD0@Z @540 NONAME -?setString@CMPlugin@@QEAAXPEBD0@Z @541 NONAME -?setWString@CMPlugin@@QEAAXIPEBDPEB_W@Z @542 NONAME -?setWString@CMPlugin@@QEAAXPEBDPEB_W@Z @543 NONAME -?setWord@CMPlugin@@QEAAXIPEBDG@Z @544 NONAME -?setWord@CMPlugin@@QEAAXPEBDG@Z @545 NONAME -?tryOpenLog@CMPlugin@@AEAAXXZ @546 NONAME +??0CMPluginBase@@IEAA@PEBD@Z @513 NONAME +??1CMPluginBase@@IEAA@XZ @514 NONAME +??4CMPluginBase@@QEAAAEAV0@AEBV0@@Z @515 NONAME +?debugLogA@CMPluginBase@@QEAAXPEBDZZ @516 NONAME +?debugLogW@CMPluginBase@@QEAAXPEB_WZZ @517 NONAME +?delSetting@CMPluginBase@@QEAA_JIPEBD@Z @518 NONAME +?delSetting@CMPluginBase@@QEAA_JPEBD@Z @519 NONAME +?getBool@CMPluginBase@@QEAA_NIPEBD_N@Z @520 NONAME +?getBool@CMPluginBase@@QEAA_NPEBD_N@Z @521 NONAME +?getByte@CMPluginBase@@QEAAHIPEBDE@Z @522 NONAME +?getByte@CMPluginBase@@QEAAHPEBDE@Z @523 NONAME +?getDword@CMPluginBase@@QEAAKIPEBDK@Z @524 NONAME +?getDword@CMPluginBase@@QEAAKPEBDK@Z @525 NONAME +?getString@CMPluginBase@@QEAA_JIPEBDPEAUDBVARIANT@@@Z @526 NONAME +?getString@CMPluginBase@@QEAA_JPEBDPEAUDBVARIANT@@@Z @527 NONAME +?getStringA@CMPluginBase@@QEAAPEADIPEBD@Z @528 NONAME +?getStringA@CMPluginBase@@QEAAPEADPEBD@Z @529 NONAME +?getWString@CMPluginBase@@QEAA_JIPEBDPEAUDBVARIANT@@@Z @530 NONAME +?getWString@CMPluginBase@@QEAA_JPEBDPEAUDBVARIANT@@@Z @531 NONAME +?getWStringA@CMPluginBase@@QEAAPEA_WIPEBD@Z @532 NONAME +?getWStringA@CMPluginBase@@QEAAPEA_WPEBD@Z @533 NONAME +?getWord@CMPluginBase@@QEAAHIPEBDG@Z @534 NONAME +?getWord@CMPluginBase@@QEAAHPEBDG@Z @535 NONAME +?setByte@CMPluginBase@@QEAAXIPEBDE@Z @536 NONAME +?setByte@CMPluginBase@@QEAAXPEBDE@Z @537 NONAME +?setDword@CMPluginBase@@QEAAXIPEBDK@Z @538 NONAME +?setDword@CMPluginBase@@QEAAXPEBDK@Z @539 NONAME +?setString@CMPluginBase@@QEAAXIPEBD0@Z @540 NONAME +?setString@CMPluginBase@@QEAAXPEBD0@Z @541 NONAME +?setWString@CMPluginBase@@QEAAXIPEBDPEB_W@Z @542 NONAME +?setWString@CMPluginBase@@QEAAXPEBDPEB_W@Z @543 NONAME +?setWord@CMPluginBase@@QEAAXIPEBDG@Z @544 NONAME +?setWord@CMPluginBase@@QEAAXPEBDG@Z @545 NONAME +?tryOpenLog@CMPluginBase@@AEAAXXZ @546 NONAME +?RegisterProtocol@CMPluginBase@@IEAAXHP6APEAUPROTO_INTERFACE@@PEBDPEB_W@ZP6AHPEAU2@@Z@Z @547 NONAME -- cgit v1.2.3