diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-18 20:51:18 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-18 20:51:18 +0300 |
commit | 9cf1444eb7888f2d942d220f938aa893396a8a1b (patch) | |
tree | ea87e4cb78e9c26a651af00b2d423324ce4a85a6 /plugins/CloudFile | |
parent | 3936ebbc665c9653d9f62527c1e136944d52e2ca (diff) |
g_hInstance incapulated into PLUGIN<>, no need in the separate variable
Diffstat (limited to 'plugins/CloudFile')
-rw-r--r-- | plugins/CloudFile/src/Services/dropbox_service.cpp | 4 | ||||
-rw-r--r-- | plugins/CloudFile/src/Services/google_service.cpp | 4 | ||||
-rw-r--r-- | plugins/CloudFile/src/Services/microsoft_service.cpp | 4 | ||||
-rw-r--r-- | plugins/CloudFile/src/Services/yandex_service.cpp | 4 | ||||
-rw-r--r-- | plugins/CloudFile/src/icons.cpp | 2 | ||||
-rw-r--r-- | plugins/CloudFile/src/main.cpp | 11 | ||||
-rw-r--r-- | plugins/CloudFile/src/oauth.cpp | 2 | ||||
-rw-r--r-- | plugins/CloudFile/src/options.cpp | 2 | ||||
-rw-r--r-- | plugins/CloudFile/src/stdafx.h | 8 |
9 files changed, 31 insertions, 10 deletions
diff --git a/plugins/CloudFile/src/Services/dropbox_service.cpp b/plugins/CloudFile/src/Services/dropbox_service.cpp index 1dacf3112e..a738bbe09b 100644 --- a/plugins/CloudFile/src/Services/dropbox_service.cpp +++ b/plugins/CloudFile/src/Services/dropbox_service.cpp @@ -313,9 +313,9 @@ struct CMPluginDropbox : public PLUGIN<CMPluginDropbox> CMPluginDropbox() : PLUGIN<CMPluginDropbox>(MODULE "/Dropbox") { + m_hInst = g_plugin.getInst(); + RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CDropboxService::Init, (pfnUninitProto)CDropboxService::UnInit); } } g_pluginDropbox; - -extern "C" _pfnCrtInit _pRawDllMain = &CMPluginDropbox::RawDllMain; diff --git a/plugins/CloudFile/src/Services/google_service.cpp b/plugins/CloudFile/src/Services/google_service.cpp index 665f5bc511..e3a7a95d15 100644 --- a/plugins/CloudFile/src/Services/google_service.cpp +++ b/plugins/CloudFile/src/Services/google_service.cpp @@ -295,8 +295,10 @@ UINT CGDriveService::Upload(FileTransferParam *ftp) struct CMPluginGoogle : public CMPluginBase { CMPluginGoogle() : - CMPluginBase(g_hInstance, MODULE "/GDrive") + CMPluginBase(MODULE "/GDrive") { + m_hInst = g_plugin.getInst(); + RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CGDriveService::Init, (pfnUninitProto)CGDriveService::UnInit); } } diff --git a/plugins/CloudFile/src/Services/microsoft_service.cpp b/plugins/CloudFile/src/Services/microsoft_service.cpp index 656ccbdd4b..c4ec053eaa 100644 --- a/plugins/CloudFile/src/Services/microsoft_service.cpp +++ b/plugins/CloudFile/src/Services/microsoft_service.cpp @@ -280,8 +280,10 @@ UINT COneDriveService::Upload(FileTransferParam *ftp) struct CMPluginOnedrive : public CMPluginBase { CMPluginOnedrive() : - CMPluginBase(g_hInstance, MODULE "/OneDrive") + CMPluginBase(MODULE "/OneDrive") { + m_hInst = g_plugin.getInst(); + RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)COneDriveService::Init, (pfnUninitProto)COneDriveService::UnInit); } } diff --git a/plugins/CloudFile/src/Services/yandex_service.cpp b/plugins/CloudFile/src/Services/yandex_service.cpp index 3212814db5..e05f216698 100644 --- a/plugins/CloudFile/src/Services/yandex_service.cpp +++ b/plugins/CloudFile/src/Services/yandex_service.cpp @@ -290,8 +290,10 @@ UINT CYandexService::Upload(FileTransferParam *ftp) struct CMPluginYandex : public CMPluginBase { CMPluginYandex() : - CMPluginBase(g_hInstance, MODULE "/YandexDisk") + CMPluginBase(MODULE "/YandexDisk") { + m_hInst = g_plugin.getInst(); + RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CYandexService::Init, (pfnUninitProto)CYandexService::UnInit); } } diff --git a/plugins/CloudFile/src/icons.cpp b/plugins/CloudFile/src/icons.cpp index bb9dd9096c..7f012e1815 100644 --- a/plugins/CloudFile/src/icons.cpp +++ b/plugins/CloudFile/src/icons.cpp @@ -11,7 +11,7 @@ static IconItem iconList[] = void InitializeIcons() { - Icon_Register(g_hInstance, "Protocols/" MODULE, iconList, _countof(iconList), MODULE); + Icon_Register(g_plugin.getInst(), "Protocols/" MODULE, iconList, _countof(iconList), MODULE); } HANDLE GetIconHandle(int iconId) diff --git a/plugins/CloudFile/src/main.cpp b/plugins/CloudFile/src/main.cpp index e9c8a6fdd2..147d477771 100644 --- a/plugins/CloudFile/src/main.cpp +++ b/plugins/CloudFile/src/main.cpp @@ -1,7 +1,6 @@ #include "stdafx.h" int hLangpack; -HINSTANCE g_hInstance; PLUGININFOEX pluginInfo = { @@ -22,6 +21,14 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) return &pluginInfo; } +///////////////////////////////////////////////////////////////////////////////////////// + +CMPlugin g_plugin; + +extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain; + +///////////////////////////////////////////////////////////////////////////////////////// + extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); @@ -34,6 +41,8 @@ extern "C" int __declspec(dllexport) Load(void) return 0; } +///////////////////////////////////////////////////////////////////////////////////////// + extern "C" int __declspec(dllexport) Unload(void) { return 0; diff --git a/plugins/CloudFile/src/oauth.cpp b/plugins/CloudFile/src/oauth.cpp index 0e0503f639..cad2bd8651 100644 --- a/plugins/CloudFile/src/oauth.cpp +++ b/plugins/CloudFile/src/oauth.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" COAuthDlg::COAuthDlg(CCloudService *service, const char *authUrl, pThreadFuncOwner requestAccessTokenThread) - : CDlgBase(g_hInstance, IDD_OAUTH), m_service(service), + : CDlgBase(g_plugin.getInst(), IDD_OAUTH), m_service(service), m_requestAccessTokenThread(requestAccessTokenThread), m_authorize(this, IDC_OAUTH_AUTHORIZE, authUrl), m_code(this, IDC_OAUTH_CODE), m_ok(this, IDOK) diff --git a/plugins/CloudFile/src/options.cpp b/plugins/CloudFile/src/options.cpp index 09fb7df117..88f411646a 100644 --- a/plugins/CloudFile/src/options.cpp +++ b/plugins/CloudFile/src/options.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" COptionsMainDlg::COptionsMainDlg() - : CPluginDlgBase(g_hInstance, IDD_OPTIONS_MAIN, MODULE), + : CPluginDlgBase(g_plugin.getInst(), IDD_OPTIONS_MAIN, MODULE), m_defaultService(this, IDC_DEFAULTSERVICE), m_doNothingOnConflict(this, IDC_DONOTHINGONCONFLICT), m_renameOnConflict(this, IDC_RENAMEONCONFLICT), diff --git a/plugins/CloudFile/src/stdafx.h b/plugins/CloudFile/src/stdafx.h index 85ce23b8d7..d475b54c11 100644 --- a/plugins/CloudFile/src/stdafx.h +++ b/plugins/CloudFile/src/stdafx.h @@ -41,7 +41,6 @@ class CCloudService; #include "options.h" -extern HINSTANCE g_hInstance; extern HNETLIBUSER hNetlibConnection; class Exception @@ -118,4 +117,11 @@ void Report(MCONTACT hContact, const wchar_t *data); CCloudService* FindService(const char *szProto); +struct CMPlugin : public PLUGIN<CMPlugin> +{ + CMPlugin() : + PLUGIN<CMPlugin>(MODULE) + {} +}; + #endif //_COMMON_H_
\ No newline at end of file |