diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-28 14:29:31 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-28 14:29:31 +0300 |
commit | a905c9c3f92fd54f37a5466649ac378db69e7cb0 (patch) | |
tree | 87a60dadfbf9fd8d916ea9100c26b6e314293242 /plugins | |
parent | d75fed3bfc9c252f5d20b889e0bec95fb0a4527e (diff) |
all protocols rewritten to CMPluginBase
Diffstat (limited to 'plugins')
25 files changed, 172 insertions, 84 deletions
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 <m_metacontacts.h> #include <m_protoint.h> #include <m_protosvc.h> +#include <m_plugin.h> #include <m_cloudfile.h> 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 <m_utils.h>
#include <m_protosvc.h>
#include <m_system.h>
+#include <m_plugin.h>
#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 <m_plugin.h>
#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 <m_utils.h>
#include <m_protosvc.h>
#include <m_system.h>
-//debug.h
#include <m_netlib.h>
-
-
+#include <m_plugin.h>
// 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 <m_avatars.h>
#include <m_hotkeys.h>
#include <m_gui.h>
+#include <m_plugin.h>
#include <m_folders.h>
#include <m_toptoolbar.h>
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 <m_utils.h>
#include <m_ignore.h>
#include <m_netlib.h>
+#include <m_plugin.h>
#include <m_string.h>
#include <win2k.h>
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 <m_netlib.h>
#include <m_popup.h>
#include <m_userinfo.h>
+#include <m_plugin.h>
#include <m_variables.h>
#include <m_Quotes.h>
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 <http://www.gnu.org/licenses/>. #include <m_popup.h>
#include <win2k.h>
#include <m_acc.h>
+#include <m_plugin.h>
#include <m_weather.h>
#include <m_toptoolbar.h>
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 <m_netlib.h>
#include <m_langpack.h>
#include <m_findadd.h>
+#include <m_plugin.h>
#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 <m_yamn.h>
#include <m_protoplugin.h>
#include <m_folders.h>
+#include <m_plugin.h>
#include "main.h"
#include "mails/decode.h"
|