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 --- 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 + 25 files changed, 172 insertions(+), 84 deletions(-) (limited to 'plugins') 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" -- cgit v1.2.3