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 /protocols/SkypeWeb/src | |
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 'protocols/SkypeWeb/src')
-rw-r--r-- | protocols/SkypeWeb/src/skype_accounts.cpp | 15 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 27 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 43 |
3 files changed, 38 insertions, 47 deletions
diff --git a/protocols/SkypeWeb/src/skype_accounts.cpp b/protocols/SkypeWeb/src/skype_accounts.cpp index 9ab67acff8..bdc09aac6e 100644 --- a/protocols/SkypeWeb/src/skype_accounts.cpp +++ b/protocols/SkypeWeb/src/skype_accounts.cpp @@ -17,21 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-int CSkypeProto::OnAccountLoaded(WPARAM, LPARAM)
-{
- setAllContactStatuses(ID_STATUS_OFFLINE, true);
-
- HookProtoEvent(ME_OPT_INITIALISE, &CSkypeProto::OnOptionsInit);
- HookProtoEvent(ME_MSG_PRECREATEEVENT, &CSkypeProto::OnPreCreateMessage);
- HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CSkypeProto::OnDbEventRead);
-
- InitDBEvents();
- InitPopups();
- InitGroupChatModule();
-
- return 0;
-}
-
INT_PTR CSkypeProto::OnAccountManagerInit(WPARAM, LPARAM lParam)
{
return (INT_PTR)(CSkypeOptionsMain::CreateAccountManagerPage(this, (HWND)lParam))->GetHwnd();
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 459bfe04bf..e1a702e565 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -81,7 +81,20 @@ CSkypeProto::~CSkypeProto() SkypeUnsetTimer(); } -int CSkypeProto::OnExit() +void CSkypeProto::OnModulesLoaded() +{ + setAllContactStatuses(ID_STATUS_OFFLINE, true); + + HookProtoEvent(ME_OPT_INITIALISE, &CSkypeProto::OnOptionsInit); + HookProtoEvent(ME_MSG_PRECREATEEVENT, &CSkypeProto::OnPreCreateMessage); + HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CSkypeProto::OnDbEventRead); + + InitDBEvents(); + InitPopups(); + InitGroupChatModule(); +} + +void CSkypeProto::OnShutdown() { debugLogA(__FUNCTION__); @@ -91,11 +104,9 @@ int CSkypeProto::OnExit() m_hPollingEvent.Set(); m_hTrouterEvent.Set(); - - return 0; } -DWORD_PTR CSkypeProto::GetCaps(int type, MCONTACT) +INT_PTR CSkypeProto::GetCaps(int type, MCONTACT) { switch (type) { case PFLAGNUM_1: @@ -107,7 +118,7 @@ DWORD_PTR CSkypeProto::GetCaps(int type, MCONTACT) case PFLAGNUM_4: return PF4_FORCEADDED | PF4_NOAUTHDENYREASON | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_IMSENDOFFLINE | PF4_OFFLINEFILES; case PFLAG_UNIQUEIDTEXT: - return (DWORD_PTR)Translate("Skypename"); + return (INT_PTR)Translate("Skypename"); } return 0; } @@ -290,17 +301,11 @@ int CSkypeProto::UserIsTyping(MCONTACT hContact, int type) int CSkypeProto::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam) { switch (iEventType) { - case EV_PROTO_ONLOAD: - return OnAccountLoaded(wParam, lParam); - case EV_PROTO_ONCONTACTDELETED: return OnContactDeleted(wParam, lParam); case EV_PROTO_ONMENU: return OnInitStatusMenu(); - - case EV_PROTO_ONEXIT: - return OnExit(); } return 1; diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index d9b7f1ec91..7162695ea3 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -37,23 +37,26 @@ public: //////////////////////////////////////////////////////////////////////////////////////
// Virtual functions
- virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr);
- virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent);
- virtual int __cdecl AuthRequest(MCONTACT hContact, const wchar_t* szMessage);
- virtual int __cdecl Authorize(MEVENT hDbEvent);
- virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t* szReason);
- virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*);
- virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
- virtual int __cdecl GetInfo(MCONTACT hContact, int infoType);
- virtual HANDLE __cdecl SearchBasic(const wchar_t* id);
- virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg);
- virtual int __cdecl SetStatus(int iNewStatus);
- virtual int __cdecl UserIsTyping(MCONTACT hContact, int type);
- virtual int __cdecl OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam);
- virtual int __cdecl RecvContacts(MCONTACT hContact, PROTORECVEVENT*);
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles);
- virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact);
- virtual int __cdecl SetAwayMsg(int m_iStatus, const wchar_t *msg);
+ MCONTACT AddToList(int flags, PROTOSEARCHRESULT* psr) override;
+ MCONTACT AddToListByEvent(int flags, int iContact, MEVENT hDbEvent) override;
+ int AuthRequest(MCONTACT hContact, const wchar_t* szMessage) override;
+ int Authorize(MEVENT hDbEvent) override;
+ int AuthDeny(MEVENT hDbEvent, const wchar_t* szReason) override;
+ int AuthRecv(MCONTACT hContact, PROTORECVEVENT*) override;
+ INT_PTR GetCaps(int type, MCONTACT hContact = NULL) override;
+ int GetInfo(MCONTACT hContact, int infoType) override;
+ HANDLE SearchBasic(const wchar_t* id) override;
+ int SendMsg(MCONTACT hContact, int flags, const char* msg) override;
+ int SetStatus(int iNewStatus) override;
+ int UserIsTyping(MCONTACT hContact, int type) override;
+ int RecvContacts(MCONTACT hContact, PROTORECVEVENT*) override;
+ HANDLE SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles) override;
+ HANDLE GetAwayMsg(MCONTACT hContact) override;
+ int SetAwayMsg(int m_iStatus, const wchar_t *msg) override;
+
+ int OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam) override;
+ void OnModulesLoaded() override;
+ void OnShutdown() override;
// icons
static void InitIcons();
@@ -71,8 +74,8 @@ public: // events
static int OnModulesLoaded(WPARAM, LPARAM);
int __cdecl OnDbEventRead(WPARAM, LPARAM);
- int __cdecl OnExit();
- //search
+
+ // search
void __cdecl SearchBasicThread(void* id);
////////////////////////////////////////////
@@ -156,8 +159,6 @@ private: EventHandle m_hTrouterHealthEvent;
- int __cdecl OnAccountLoaded(WPARAM, LPARAM);
-
INT_PTR __cdecl OnAccountManagerInit(WPARAM, LPARAM);
std::wstring m_tszAvatarFolder;
|