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/IRCG | |
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/IRCG')
-rw-r--r-- | protocols/IRCG/src/ircproto.cpp | 39 | ||||
-rw-r--r-- | protocols/IRCG/src/ircproto.h | 51 | ||||
-rw-r--r-- | protocols/IRCG/src/services.cpp | 3 |
3 files changed, 43 insertions, 50 deletions
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index aedd341e74..a5939a76a6 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -175,7 +175,7 @@ static int sttCheckPerform(const char *szSetting, void *lParam) return 0;
}
-int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
+void CIrcProto::OnModulesLoaded()
{
wchar_t name[128];
mir_snwprintf(name, TranslateT("%s server connection"), m_tszUserName);
@@ -274,14 +274,12 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) mir_wstrncpy(m_name, szBuf, 200);
}
}
-
- return 0;
}
////////////////////////////////////////////////////////////////////////////////////////
// AddToList - adds a contact to the contact list
-MCONTACT __cdecl CIrcProto::AddToList(int, PROTOSEARCHRESULT* psr)
+MCONTACT CIrcProto::AddToList(int, PROTOSEARCHRESULT* psr)
{
if (m_iStatus == ID_STATUS_OFFLINE || m_iStatus == ID_STATUS_CONNECTING)
return 0;
@@ -322,7 +320,7 @@ MCONTACT __cdecl CIrcProto::AddToList(int, PROTOSEARCHRESULT* psr) ////////////////////////////////////////////////////////////////////////////////////////
// AuthAllow - processes the successful authorization
-int __cdecl CIrcProto::Authorize(MEVENT)
+int CIrcProto::Authorize(MEVENT)
{
return 0;
}
@@ -330,7 +328,7 @@ int __cdecl CIrcProto::Authorize(MEVENT) ////////////////////////////////////////////////////////////////////////////////////////
// AuthDeny - handles the unsuccessful authorization
-int __cdecl CIrcProto::AuthDeny(MEVENT, const wchar_t*)
+int CIrcProto::AuthDeny(MEVENT, const wchar_t*)
{
return 0;
}
@@ -338,7 +336,7 @@ int __cdecl CIrcProto::AuthDeny(MEVENT, const wchar_t*) ////////////////////////////////////////////////////////////////////////////////////////
// FileAllow - starts a file transfer
-HANDLE __cdecl CIrcProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* szPath)
+HANDLE CIrcProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* szPath)
{
DCCINFO* di = (DCCINFO*)hTransfer;
@@ -359,7 +357,7 @@ HANDLE __cdecl CIrcProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* s ////////////////////////////////////////////////////////////////////////////////////////
// FileCancel - cancels a file transfer
-int __cdecl CIrcProto::FileCancel(MCONTACT, HANDLE hTransfer)
+int CIrcProto::FileCancel(MCONTACT, HANDLE hTransfer)
{
DCCINFO* di = (DCCINFO*)hTransfer;
@@ -375,7 +373,7 @@ int __cdecl CIrcProto::FileCancel(MCONTACT, HANDLE hTransfer) ////////////////////////////////////////////////////////////////////////////////////////
// FileDeny - denies a file transfer
-int __cdecl CIrcProto::FileDeny(MCONTACT, HANDLE hTransfer, const wchar_t*)
+int CIrcProto::FileDeny(MCONTACT, HANDLE hTransfer, const wchar_t*)
{
DCCINFO* di = (DCCINFO*)hTransfer;
delete di;
@@ -385,7 +383,7 @@ int __cdecl CIrcProto::FileDeny(MCONTACT, HANDLE hTransfer, const wchar_t*) ////////////////////////////////////////////////////////////////////////////////////////
// FileResume - processes file renaming etc
-int __cdecl CIrcProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename)
+int CIrcProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename)
{
DCCINFO* di = (DCCINFO*)hTransfer;
@@ -431,7 +429,7 @@ int __cdecl CIrcProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** ////////////////////////////////////////////////////////////////////////////////////////
// GetCaps - return protocol capabilities bits
-DWORD_PTR __cdecl CIrcProto::GetCaps(int type, MCONTACT)
+INT_PTR CIrcProto::GetCaps(int type, MCONTACT)
{
switch (type) {
case PFLAGNUM_1:
@@ -447,7 +445,7 @@ DWORD_PTR __cdecl CIrcProto::GetCaps(int type, MCONTACT) return PF4_NOAUTHDENYREASON | PF4_NOCUSTOMAUTH;
case PFLAG_UNIQUEIDTEXT:
- return (DWORD_PTR)Translate("Nickname");
+ return (INT_PTR)Translate("Nickname");
case PFLAG_MAXLENOFMESSAGE:
return 400;
@@ -477,7 +475,7 @@ void __cdecl CIrcProto::AckBasicSearch(void *arg) delete param;
}
-HANDLE __cdecl CIrcProto::SearchBasic(const wchar_t* szId)
+HANDLE CIrcProto::SearchBasic(const wchar_t* szId)
{
if (szId) {
if (m_iStatus != ID_STATUS_OFFLINE && m_iStatus != ID_STATUS_CONNECTING &&
@@ -495,7 +493,7 @@ HANDLE __cdecl CIrcProto::SearchBasic(const wchar_t* szId) ////////////////////////////////////////////////////////////////////////////////////////
// SendFile - sends a file
-HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** ppszFiles)
+HANDLE CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** ppszFiles)
{
DCCINFO* dci = nullptr;
int iPort = 0;
@@ -664,7 +662,7 @@ void __cdecl CIrcProto::AckMessageSuccess(void *info) delete param;
}
-int __cdecl CIrcProto::SendMsg(MCONTACT hContact, int, const char* pszSrc)
+int CIrcProto::SendMsg(MCONTACT hContact, int, const char* pszSrc)
{
BYTE bDcc = getByte(hContact, "DCC", 0);
WORD wStatus = getWord(hContact, "Status", ID_STATUS_OFFLINE);
@@ -691,7 +689,7 @@ int __cdecl CIrcProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) ////////////////////////////////////////////////////////////////////////////////////////
// SetStatus - sets the protocol status
-int __cdecl CIrcProto::SetStatus(int iNewStatus)
+int CIrcProto::SetStatus(int iNewStatus)
{
return SetStatusInternal(iNewStatus, false);
}
@@ -758,7 +756,7 @@ int CIrcProto::SetStatusInternal(int iNewStatus, bool bIsInternal) ////////////////////////////////////////////////////////////////////////////////////////
// GetAwayMsg - returns a contact's away message
-HANDLE __cdecl CIrcProto::GetAwayMsg(MCONTACT hContact)
+HANDLE CIrcProto::GetAwayMsg(MCONTACT hContact)
{
WhoisAwayReply = L"";
DBVARIANT dbv;
@@ -785,7 +783,7 @@ HANDLE __cdecl CIrcProto::GetAwayMsg(MCONTACT hContact) ////////////////////////////////////////////////////////////////////////////////////////
// SetAwayMsg - sets the away status message
-int __cdecl CIrcProto::SetAwayMsg(int status, const wchar_t* msg)
+int CIrcProto::SetAwayMsg(int status, const wchar_t* msg)
{
switch (status) {
case ID_STATUS_ONLINE: case ID_STATUS_INVISIBLE: case ID_STATUS_FREECHAT:
@@ -812,12 +810,9 @@ int __cdecl CIrcProto::SetAwayMsg(int status, const wchar_t* msg) /////////////////////////////////////////////////////////////////////////////////////////
// OnEvent - maintain protocol events
-int __cdecl CIrcProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam)
+int CIrcProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam)
{
switch (eventType) {
- case EV_PROTO_ONLOAD: return OnModulesLoaded(0, 0);
- case EV_PROTO_ONEXIT: return OnPreShutdown(0, 0);
-
case EV_PROTO_ONMENU:
InitMainMenus();
break;
diff --git a/protocols/IRCG/src/ircproto.h b/protocols/IRCG/src/ircproto.h index 4a3e27fd43..6948098cd2 100644 --- a/protocols/IRCG/src/ircproto.h +++ b/protocols/IRCG/src/ircproto.h @@ -47,30 +47,31 @@ struct CIrcProto : public PROTO<CIrcProto> ~CIrcProto(); // Protocol interface - - virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr); - - virtual int __cdecl Authorize(MEVENT hDbEvent); - virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t* szReason); - - virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szPath); - virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer); - virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szReason); - virtual int __cdecl FileResume(HANDLE hTransfer, int *action, const wchar_t **szFilename); - - virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL); - - virtual HANDLE __cdecl SearchBasic(const wchar_t* id); - - virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles); - virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg); - - virtual int __cdecl SetStatus(int iNewStatus); - - virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact); - virtual int __cdecl SetAwayMsg(int m_iStatus, const wchar_t *msg); - - virtual int __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam); + MCONTACT AddToList(int flags, PROTOSEARCHRESULT* psr) override; + + int Authorize(MEVENT hDbEvent) override; + int AuthDeny(MEVENT hDbEvent, const wchar_t* szReason) override; + + HANDLE FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szPath) override; + int FileCancel(MCONTACT hContact, HANDLE hTransfer) override; + int FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szReason) override; + int FileResume(HANDLE hTransfer, int *action, const wchar_t **szFilename) override; + + INT_PTR GetCaps(int type, MCONTACT hContact = NULL) override; + + HANDLE SearchBasic(const wchar_t* id) override; + + HANDLE SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles) override; + int SendMsg(MCONTACT hContact, int flags, const char* msg) override; + + int SetStatus(int iNewStatus) override; + + HANDLE GetAwayMsg(MCONTACT hContact) override; + int SetAwayMsg(int m_iStatus, const wchar_t *msg) override; + + int OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) override; + void OnModulesLoaded() override; + void OnShutdown() override; // Services INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM, LPARAM); @@ -93,9 +94,7 @@ struct CIrcProto : public PROTO<CIrcProto> int __cdecl OnContactDeleted(WPARAM, LPARAM); int __cdecl OnInitOptionsPages(WPARAM, LPARAM); int __cdecl OnInitUserInfo(WPARAM, LPARAM); - int __cdecl OnModulesLoaded(WPARAM, LPARAM); int __cdecl OnMenuPreBuild(WPARAM, LPARAM); - int __cdecl OnPreShutdown(WPARAM, LPARAM); int __cdecl OnDbSettingChanged(WPARAM, LPARAM); int __cdecl GCEventHook(WPARAM, LPARAM); diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index b6775b8b05..0c798257f9 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -839,7 +839,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam) return 0;
}
-int __cdecl CIrcProto::OnPreShutdown(WPARAM, LPARAM)
+void CIrcProto::OnShutdown()
{
mir_cslock lock(cs);
@@ -857,7 +857,6 @@ int __cdecl CIrcProto::OnPreShutdown(WPARAM, LPARAM) m_nickDlg->Close();
if (m_joinDlg)
m_joinDlg->Close();
- return 0;
}
int __cdecl CIrcProto::OnMenuPreBuild(WPARAM hContact, LPARAM)
|