summaryrefslogtreecommitdiff
path: root/plugins/CloudFile/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-07-11 21:32:58 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-07-11 21:33:11 +0300
commitf719c8b921c7a46b76453476204224d40c682914 (patch)
treec6d92dc450893e7f5abe60c2046ec9c2d1e3db36 /plugins/CloudFile/src
parent16ad355c8bdc438c3107ee3ba3ad0bf0b8c395fa (diff)
int hLangpack/m_hLang removed and replaced with HPLUGIN
Diffstat (limited to 'plugins/CloudFile/src')
-rw-r--r--plugins/CloudFile/src/Services/dropbox_service.cpp32
-rw-r--r--plugins/CloudFile/src/Services/google_service.cpp33
-rw-r--r--plugins/CloudFile/src/Services/microsoft_service.cpp32
-rw-r--r--plugins/CloudFile/src/Services/yandex_service.cpp32
-rw-r--r--plugins/CloudFile/src/cloud_file.cpp13
-rw-r--r--plugins/CloudFile/src/cloud_file.h6
-rw-r--r--plugins/CloudFile/src/menus.cpp5
-rw-r--r--plugins/CloudFile/src/options.cpp2
-rw-r--r--plugins/CloudFile/src/srmm.cpp3
9 files changed, 78 insertions, 80 deletions
diff --git a/plugins/CloudFile/src/Services/dropbox_service.cpp b/plugins/CloudFile/src/Services/dropbox_service.cpp
index bb67ff24fe..9634eba955 100644
--- a/plugins/CloudFile/src/Services/dropbox_service.cpp
+++ b/plugins/CloudFile/src/Services/dropbox_service.cpp
@@ -1,8 +1,22 @@
#include "..\stdafx.h"
#include "dropbox_api.h"
-CDropboxService::CDropboxService(const char *protoName, const wchar_t *userName)
- : CCloudService(protoName, userName)
+struct CMPluginDropbox : public PLUGIN<CMPluginDropbox>
+{
+ CMPluginDropbox() :
+ PLUGIN<CMPluginDropbox>(MODULENAME "/Dropbox", pluginInfoEx)
+ {
+ m_hInst = g_plugin.getInst();
+
+ RegisterProtocol(PROTOTYPE_PROTOWITHACCS, (pfnInitProto)CDropboxService::Init, (pfnUninitProto)CDropboxService::UnInit);
+ }
+}
+g_pluginDropbox;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CDropboxService::CDropboxService(const char *protoName, const wchar_t *userName) :
+ CCloudService(protoName, userName, &g_pluginDropbox)
{
m_hProtoIcon = GetIconHandle(IDI_DROPBOX);
}
@@ -286,17 +300,3 @@ void CDropboxService::Upload(FileTransferParam *ftp)
}
} while (ftp->NextFile());
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CMPluginDropbox : public PLUGIN<CMPluginDropbox>
-{
- CMPluginDropbox() :
- PLUGIN<CMPluginDropbox>(MODULENAME "/Dropbox", pluginInfoEx)
- {
- m_hInst = g_plugin.getInst();
-
- RegisterProtocol(PROTOTYPE_PROTOWITHACCS, (pfnInitProto)CDropboxService::Init, (pfnUninitProto)CDropboxService::UnInit);
- }
-}
-g_pluginDropbox;
diff --git a/plugins/CloudFile/src/Services/google_service.cpp b/plugins/CloudFile/src/Services/google_service.cpp
index 906e9e817d..9679c17fc0 100644
--- a/plugins/CloudFile/src/Services/google_service.cpp
+++ b/plugins/CloudFile/src/Services/google_service.cpp
@@ -1,8 +1,23 @@
#include "..\stdafx.h"
#include "google_api.h"
-CGDriveService::CGDriveService(const char *protoName, const wchar_t *userName)
- : CCloudService(protoName, userName)
+
+struct CMPluginGoogle : public CMPluginBase
+{
+ CMPluginGoogle() :
+ CMPluginBase(MODULENAME "/GDrive", pluginInfoEx)
+ {
+ m_hInst = g_plugin.getInst();
+
+ RegisterProtocol(PROTOTYPE_PROTOWITHACCS, (pfnInitProto)CGDriveService::Init, (pfnUninitProto)CGDriveService::UnInit);
+ }
+}
+g_pluginGoogle;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CGDriveService::CGDriveService(const char *protoName, const wchar_t *userName) :
+ CCloudService(protoName, userName, &g_pluginGoogle)
{
m_hProtoIcon = GetIconHandle(IDI_GDRIVE);
}
@@ -280,17 +295,3 @@ void CGDriveService::Upload(FileTransferParam *ftp)
}
} while (ftp->NextFile());
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CMPluginGoogle : public CMPluginBase
-{
- CMPluginGoogle() :
- CMPluginBase(MODULENAME "/GDrive", pluginInfoEx)
- {
- m_hInst = g_plugin.getInst();
-
- RegisterProtocol(PROTOTYPE_PROTOWITHACCS, (pfnInitProto)CGDriveService::Init, (pfnUninitProto)CGDriveService::UnInit);
- }
-}
-g_pluginGoogle;
diff --git a/plugins/CloudFile/src/Services/microsoft_service.cpp b/plugins/CloudFile/src/Services/microsoft_service.cpp
index 5adf66649a..c435bc19b4 100644
--- a/plugins/CloudFile/src/Services/microsoft_service.cpp
+++ b/plugins/CloudFile/src/Services/microsoft_service.cpp
@@ -1,8 +1,22 @@
#include "..\stdafx.h"
#include "microsoft_api.h"
-COneDriveService::COneDriveService(const char *protoName, const wchar_t *userName)
- : CCloudService(protoName, userName)
+struct CMPluginOnedrive : public CMPluginBase
+{
+ CMPluginOnedrive() :
+ CMPluginBase(MODULENAME "/OneDrive", pluginInfoEx)
+ {
+ m_hInst = g_plugin.getInst();
+
+ RegisterProtocol(PROTOTYPE_PROTOWITHACCS, (pfnInitProto)COneDriveService::Init, (pfnUninitProto)COneDriveService::UnInit);
+ }
+}
+g_pluginOnedrive;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+COneDriveService::COneDriveService(const char *protoName, const wchar_t *userName) :
+ CCloudService(protoName, userName, &g_pluginOnedrive)
{
m_hProtoIcon = GetIconHandle(IDI_ONEDRIVE);
}
@@ -253,17 +267,3 @@ void COneDriveService::Upload(FileTransferParam *ftp)
}
} while (ftp->NextFile());
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CMPluginOnedrive : public CMPluginBase
-{
- CMPluginOnedrive() :
- CMPluginBase(MODULENAME "/OneDrive", pluginInfoEx)
- {
- m_hInst = g_plugin.getInst();
-
- RegisterProtocol(PROTOTYPE_PROTOWITHACCS, (pfnInitProto)COneDriveService::Init, (pfnUninitProto)COneDriveService::UnInit);
- }
-}
-g_pluginOnedrive;
diff --git a/plugins/CloudFile/src/Services/yandex_service.cpp b/plugins/CloudFile/src/Services/yandex_service.cpp
index c5dbb50400..ca8ba197d6 100644
--- a/plugins/CloudFile/src/Services/yandex_service.cpp
+++ b/plugins/CloudFile/src/Services/yandex_service.cpp
@@ -1,8 +1,22 @@
#include "..\stdafx.h"
#include "yandex_api.h"
-CYandexService::CYandexService(const char *protoName, const wchar_t *userName)
- : CCloudService(protoName, userName)
+struct CMPluginYandex : public CMPluginBase
+{
+ CMPluginYandex() :
+ CMPluginBase(MODULENAME "/YandexDisk", pluginInfoEx)
+ {
+ m_hInst = g_plugin.getInst();
+
+ RegisterProtocol(PROTOTYPE_PROTOWITHACCS, (pfnInitProto)CYandexService::Init, (pfnUninitProto)CYandexService::UnInit);
+ }
+}
+g_pluginYandex;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CYandexService::CYandexService(const char *protoName, const wchar_t *userName) :
+ CCloudService(protoName, userName, &g_pluginYandex)
{
m_hProtoIcon = GetIconHandle(IDI_YADISK);
}
@@ -274,17 +288,3 @@ void CYandexService::Upload(FileTransferParam *ftp)
}
} while (ftp->NextFile());
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CMPluginYandex : public CMPluginBase
-{
- CMPluginYandex() :
- CMPluginBase(MODULENAME "/YandexDisk", pluginInfoEx)
- {
- m_hInst = g_plugin.getInst();
-
- RegisterProtocol(PROTOTYPE_PROTOWITHACCS, (pfnInitProto)CYandexService::Init, (pfnUninitProto)CYandexService::UnInit);
- }
-}
-g_pluginYandex;
diff --git a/plugins/CloudFile/src/cloud_file.cpp b/plugins/CloudFile/src/cloud_file.cpp
index 13ba742690..d1993b6d27 100644
--- a/plugins/CloudFile/src/cloud_file.cpp
+++ b/plugins/CloudFile/src/cloud_file.cpp
@@ -1,10 +1,9 @@
#include "stdafx.h"
-CCloudService::CCloudService(const char *protoName, const wchar_t *userName)
- : PROTO<CCloudService>(protoName, userName)
+CCloudService::CCloudService(const char *protoName, const wchar_t *userName, HPLUGIN pPlugin)
+ : PROTO<CCloudService>(protoName, userName),
+ m_pPlugin(pPlugin)
{
- m_hLangpack = GetPluginLangId(MIID_LAST, 0);
-
NETLIBUSER nlu = {};
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE;
nlu.szSettingsModule = (char*)protoName;
@@ -22,12 +21,12 @@ CCloudService::~CCloudService()
void CCloudService::OnErase()
{
- KillModuleMenus(m_hLangpack);
+ KillModuleMenus(m_pPlugin);
}
-int CCloudService::GetId() const
+HPLUGIN CCloudService::GetId() const
{
- return m_hLangpack;
+ return m_pPlugin;
}
const char* CCloudService::GetAccountName() const
diff --git a/plugins/CloudFile/src/cloud_file.h b/plugins/CloudFile/src/cloud_file.h
index f16d5affe4..1e70671054 100644
--- a/plugins/CloudFile/src/cloud_file.h
+++ b/plugins/CloudFile/src/cloud_file.h
@@ -11,7 +11,7 @@ enum OnConflict
class CCloudService : public PROTO<CCloudService>
{
protected:
- int m_hLangpack;
+ HPLUGIN m_pPlugin;
HNETLIBUSER m_hConnection;
INT_PTR __cdecl OnAccountManagerInit(WPARAM, LPARAM);
@@ -34,7 +34,7 @@ protected:
public:
std::map<MCONTACT, HWND> InterceptedContacts;
- CCloudService(const char *protoName, const wchar_t *userName);
+ CCloudService(const char *protoName, const wchar_t *userName, HPLUGIN);
virtual ~CCloudService();
INT_PTR GetCaps(int type, MCONTACT) override;
@@ -42,7 +42,7 @@ public:
int FileCancel(MCONTACT hContact, HANDLE hTransfer) override;
HANDLE SendFile(MCONTACT hContact, const wchar_t *msg, wchar_t **ppszFiles) override;
- int GetId() const;
+ HPLUGIN GetId() const;
virtual const char* GetModuleName() const = 0;
const char* GetAccountName() const;
const wchar_t* GetUserName() const;
diff --git a/plugins/CloudFile/src/menus.cpp b/plugins/CloudFile/src/menus.cpp
index c6861e27a2..7a5ddb084d 100644
--- a/plugins/CloudFile/src/menus.cpp
+++ b/plugins/CloudFile/src/menus.cpp
@@ -11,7 +11,7 @@ static INT_PTR UploadMenuCommand(void *obj, WPARAM hContact, LPARAM)
void InitializeMenus()
{
- CMenuItem mi(g_plugin);
+ CMenuItem mi(&g_plugin);
SET_UID(mi, 0x93d4495b, 0x259b, 0x4fba, 0xbc, 0x14, 0xf9, 0x46, 0x2c, 0xda, 0xfc, 0x6d);
mi.name.a = LPGEN("Upload to...");
@@ -32,11 +32,10 @@ void InitializeMenus()
void CCloudService::OnModulesLoaded()
{
- CMenuItem mi(g_plugin);
+ CMenuItem mi(GetId());
mi.root = hContactMenu;
CMStringA serviceName(FORMAT, "/%s/Upload", GetAccountName());
mi.pszService = serviceName.GetBuffer();
- mi.langId = GetId();
mi.flags = CMIF_SYSTEM | CMIF_UNICODE;
mi.name.w = (wchar_t*)GetUserName();
mi.position = Services.getCount();
diff --git a/plugins/CloudFile/src/options.cpp b/plugins/CloudFile/src/options.cpp
index ee3aaec11e..c17ef8d9d2 100644
--- a/plugins/CloudFile/src/options.cpp
+++ b/plugins/CloudFile/src/options.cpp
@@ -75,7 +75,7 @@ bool COptionsMainDlg::OnApply()
int OnOptionsInitialized(WPARAM wParam, LPARAM)
{
- OPTIONSDIALOGPAGE odp = { 0 };
+ OPTIONSDIALOGPAGE odp = {};
odp.szTitle.w = _A2W(MODULENAME);
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE;
odp.szGroup.w = LPGENW("Services");
diff --git a/plugins/CloudFile/src/srmm.cpp b/plugins/CloudFile/src/srmm.cpp
index 2690a97a28..ae12de3bf1 100644
--- a/plugins/CloudFile/src/srmm.cpp
+++ b/plugins/CloudFile/src/srmm.cpp
@@ -11,8 +11,7 @@ int OnSrmmToolbarLoaded(WPARAM, LPARAM)
bbd.hIcon = GetIconHandle(IDI_UPLOAD);
bbd.dwButtonID = BBB_ID_FILE_SEND;
bbd.dwDefPos = 100 + bbd.dwButtonID;
- Srmm_AddButton(&bbd, g_plugin.m_hLang);
-
+ Srmm_AddButton(&bbd, &g_plugin);
return 0;
}