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/Tox | |
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/Tox')
-rw-r--r-- | protocols/Tox/src/tox_accounts.cpp | 12 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.cpp | 16 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.h | 38 |
3 files changed, 31 insertions, 35 deletions
diff --git a/protocols/Tox/src/tox_accounts.cpp b/protocols/Tox/src/tox_accounts.cpp index c9cb35c921..2d02f68c4b 100644 --- a/protocols/Tox/src/tox_accounts.cpp +++ b/protocols/Tox/src/tox_accounts.cpp @@ -1,17 +1,5 @@ #include "stdafx.h"
-int CToxProto::OnAccountLoaded(WPARAM, LPARAM)
-{
- Clist_GroupCreate(0, m_defaultGroup);
-
- HookProtoEvent(ME_OPT_INITIALISE, &CToxProto::OnOptionsInit);
- HookProtoEvent(ME_USERINFO_INITIALISE, &CToxProto::OnUserInfoInit);
- HookProtoEvent(ME_MSG_PRECREATEEVENT, &CToxProto::OnPreCreateMessage);
-
- InitCustomDbEvents();
- return 0;
-}
-
int CToxProto::OnAccountRenamed(WPARAM, LPARAM)
{
mir_cslock lock(m_profileLock);
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index f5a169797b..6e95610f26 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -43,7 +43,18 @@ CToxProto::~CToxProto() UninitNetlib();
}
-DWORD_PTR CToxProto::GetCaps(int type, MCONTACT)
+void CToxProto::OnModulesLoaded()
+{
+ Clist_GroupCreate(0, m_defaultGroup);
+
+ HookProtoEvent(ME_OPT_INITIALISE, &CToxProto::OnOptionsInit);
+ HookProtoEvent(ME_USERINFO_INITIALISE, &CToxProto::OnUserInfoInit);
+ HookProtoEvent(ME_MSG_PRECREATEEVENT, &CToxProto::OnPreCreateMessage);
+
+ InitCustomDbEvents();
+}
+
+INT_PTR CToxProto::GetCaps(int type, MCONTACT)
{
switch (type) {
case PFLAGNUM_1:
@@ -216,9 +227,6 @@ int CToxProto::UserIsTyping(MCONTACT hContact, int type) int CToxProto::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam)
{
switch (iEventType) {
- case EV_PROTO_ONLOAD:
- return OnAccountLoaded(wParam, lParam);
-
case EV_PROTO_ONRENAME:
return OnAccountRenamed(wParam, lParam);
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index 90e6ab8e47..acf1cc0898 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -19,34 +19,35 @@ public: //////////////////////////////////////////////////////////////////////////////////////
// Virtual functions
- virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr);
+ MCONTACT AddToList(int flags, PROTOSEARCHRESULT* psr) override;
- virtual int __cdecl Authorize(MEVENT hDbEvent);
- virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*);
- virtual int __cdecl AuthRequest(MCONTACT hContact, const wchar_t* szMessage);
+ int Authorize(MEVENT hDbEvent) override;
+ int AuthRecv(MCONTACT hContact, PROTORECVEVENT*) override;
+ int AuthRequest(MCONTACT hContact, const wchar_t* szMessage) override;
- virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* tszPath);
- virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer);
- virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* tszReason);
- virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const wchar_t** tszFilename);
+ HANDLE FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* tszPath) override;
+ int FileCancel(MCONTACT hContact, HANDLE hTransfer) override;
+ int FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* tszReason) override;
+ int FileResume(HANDLE hTransfer, int* action, const wchar_t** tszFilename) override;
- virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
+ INT_PTR GetCaps(int type, MCONTACT hContact = NULL) override;
- virtual HWND __cdecl SearchAdvanced(HWND owner);
- virtual HWND __cdecl CreateExtendedSearchUI(HWND owner);
+ HWND SearchAdvanced(HWND owner) override;
+ HWND CreateExtendedSearchUI(HWND owner) override;
- virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg);
+ int SendMsg(MCONTACT hContact, int flags, const char* msg) override;
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t*, wchar_t **ppszFiles);
+ HANDLE SendFile(MCONTACT hContact, const wchar_t*, wchar_t **ppszFiles) override;
- virtual int __cdecl SetStatus(int iNewStatus);
+ int SetStatus(int iNewStatus) override;
- virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact);
- virtual int __cdecl SetAwayMsg(int iStatus, const wchar_t* msg);
+ HANDLE GetAwayMsg(MCONTACT hContact) override;
+ int SetAwayMsg(int iStatus, const wchar_t* msg) override;
- virtual int __cdecl UserIsTyping(MCONTACT hContact, int type);
+ int UserIsTyping(MCONTACT hContact, int type) override;
- virtual int __cdecl OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam);
+ int OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam) override;
+ void OnModulesLoaded() override;
// icons
static void InitIcons();
@@ -114,7 +115,6 @@ private: void __cdecl PollingThread(void*);
// accounts
- int __cdecl OnAccountLoaded(WPARAM, LPARAM);
int __cdecl OnAccountRenamed(WPARAM, LPARAM);
INT_PTR __cdecl OnAccountManagerInit(WPARAM, LPARAM);
|