diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-21 12:33:31 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-21 12:33:31 +0300 |
commit | ca5001026a94f702c4012c5e8d2093ad3f51c1fa (patch) | |
tree | 554ad80633528d530057fc61035b15f901860ed2 /plugins/CloudFile | |
parent | e0799755b3966d1d6d8275ee5127242ec029a4e6 (diff) |
code cleaning:
- in conformance to C++'11 rules, we don't declare a method as virtual if it's declared as override;
- cause this code isn't visible in Pascal anymore, there's no need to use __cdecl calling convention for virtual methods;
- since PROTO_INTERFACE is a regular C++ class, there's no need to use old style service declarations for virtual methods like OnModulesLoaded / OnShutdown
Diffstat (limited to 'plugins/CloudFile')
-rw-r--r-- | plugins/CloudFile/src/cloud_file.cpp | 6 | ||||
-rw-r--r-- | plugins/CloudFile/src/cloud_file.h | 10 | ||||
-rw-r--r-- | plugins/CloudFile/src/menus.cpp | 15 | ||||
-rw-r--r-- | plugins/CloudFile/src/stdafx.h | 1 |
4 files changed, 15 insertions, 17 deletions
diff --git a/plugins/CloudFile/src/cloud_file.cpp b/plugins/CloudFile/src/cloud_file.cpp index 0c2f048cd8..86e65b6b34 100644 --- a/plugins/CloudFile/src/cloud_file.cpp +++ b/plugins/CloudFile/src/cloud_file.cpp @@ -36,7 +36,7 @@ const wchar_t* CCloudService::GetUserName() const return m_tszUserName; } -DWORD_PTR CCloudService::GetCaps(int type, MCONTACT) +INT_PTR CCloudService::GetCaps(int type, MCONTACT) { switch (type) { case PFLAGNUM_1: @@ -91,10 +91,6 @@ void CCloudService::OpenUploadDialog(MCONTACT hContact) int CCloudService::OnEvent(PROTOEVENTTYPE iEventType, WPARAM, LPARAM) { switch (iEventType) { - case EV_PROTO_ONLOAD: - AddServiceMenuItem(this); - return 0; - case EV_PROTO_ONERASE: KillModuleMenus(m_hLangpack); return 0; diff --git a/plugins/CloudFile/src/cloud_file.h b/plugins/CloudFile/src/cloud_file.h index 3130b2ef65..bca4aa1703 100644 --- a/plugins/CloudFile/src/cloud_file.h +++ b/plugins/CloudFile/src/cloud_file.h @@ -24,6 +24,8 @@ protected: virtual void HandleHttpError(NETLIBHTTPREQUEST *response); virtual void HandleJsonError(JSONNode &node) = 0; + void OnModulesLoaded() override; + JSONNode GetJsonResponse(NETLIBHTTPREQUEST *response); public: @@ -32,11 +34,11 @@ public: CCloudService(const char *protoName, const wchar_t *userName); virtual ~CCloudService(); - DWORD_PTR __cdecl GetCaps(int type, MCONTACT) override; - int __cdecl OnEvent(PROTOEVENTTYPE iEventType, WPARAM, LPARAM) override; + INT_PTR GetCaps(int type, MCONTACT) override; + int OnEvent(PROTOEVENTTYPE iEventType, WPARAM, LPARAM) override; - int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer) override; - HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t *msg, wchar_t **ppszFiles) override; + int FileCancel(MCONTACT hContact, HANDLE hTransfer) override; + HANDLE SendFile(MCONTACT hContact, const wchar_t *msg, wchar_t **ppszFiles) override; int GetId() const; virtual const char* GetModuleName() const = 0; diff --git a/plugins/CloudFile/src/menus.cpp b/plugins/CloudFile/src/menus.cpp index c0ed61285b..fed19569f6 100644 --- a/plugins/CloudFile/src/menus.cpp +++ b/plugins/CloudFile/src/menus.cpp @@ -30,23 +30,24 @@ void InitializeMenus() hContactMenu = Menu_AddContactMenuItem(&mi); } -void AddServiceMenuItem(const CCloudService *service) +void CCloudService::OnModulesLoaded() { CMenuItem mi; mi.root = hContactMenu; - CMStringA serviceName(FORMAT, "/%s/Upload", service->GetAccountName()); + CMStringA serviceName(FORMAT, "/%s/Upload", GetAccountName()); mi.pszService = serviceName.GetBuffer(); - mi.hLangpack = service->GetId(); + mi.hLangpack = GetId(); mi.flags = CMIF_SYSTEM | CMIF_UNICODE; - mi.name.w = (wchar_t*)service->GetUserName(); + mi.name.w = (wchar_t*)GetUserName(); mi.position = Services.getCount(); - mi.hIcolibItem = GetIconHandle(service->GetIconId()); + mi.hIcolibItem = GetIconHandle(GetIconId()); Menu_AddContactMenuItem(&mi); - CreateServiceFunctionObj(mi.pszService, UploadMenuCommand, (void*)service); + + CreateServiceFunctionObj(mi.pszService, UploadMenuCommand, this); } int OnPrebuildContactMenu(WPARAM hContact, LPARAM) { Menu_ShowItem(hContactMenu, CanSendToContact(hContact)); return 0; -}
\ No newline at end of file +} diff --git a/plugins/CloudFile/src/stdafx.h b/plugins/CloudFile/src/stdafx.h index 5cfc53b59a..6edf174305 100644 --- a/plugins/CloudFile/src/stdafx.h +++ b/plugins/CloudFile/src/stdafx.h @@ -87,7 +87,6 @@ HICON LoadIconEx(int iconId, bool big = false); // menus extern HGENMENU hContactMenu; void InitializeMenus(); -void AddServiceMenuItem(const CCloudService *service); int OnPrebuildContactMenu(WPARAM, LPARAM); // srmm |