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/Gadu-Gadu | |
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/Gadu-Gadu')
-rw-r--r-- | protocols/Gadu-Gadu/src/gg_proto.cpp | 57 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/gg_proto.h | 54 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/libgadu/dcc.cpp | 2 |
3 files changed, 58 insertions, 55 deletions
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index d5f822ca0b..7072330d25 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -139,7 +139,7 @@ MCONTACT GaduProto::AddToList(int flags, PROTOSEARCHRESULT *pmsr) //////////////////////////////////////////////////////////
// checks proto capabilities
//
-DWORD_PTR GaduProto::GetCaps(int type, MCONTACT)
+INT_PTR GaduProto::GetCaps(int type, MCONTACT)
{
switch (type) {
case PFLAGNUM_1:
@@ -155,7 +155,7 @@ DWORD_PTR GaduProto::GetCaps(int type, MCONTACT) case PFLAGNUM_5:
return PF2_LONGAWAY;
case PFLAG_UNIQUEIDTEXT:
- return (DWORD_PTR)Translate("Gadu-Gadu Number");
+ return (INT_PTR)Translate("Gadu-Gadu Number");
}
return 0;
}
@@ -699,36 +699,39 @@ int GaduProto::UserIsTyping(MCONTACT hContact, int type) //////////////////////////////////////////////////////////
// Custom protocol event
//
-int GaduProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam)
+
+void GaduProto::OnModulesLoaded()
{
- switch (eventType) {
- case EV_PROTO_ONLOAD:
- HookProtoEvent(ME_OPT_INITIALISE, &GaduProto::options_init);
- HookProtoEvent(ME_USERINFO_INITIALISE, &GaduProto::details_init);
-
- // Init misc stuff
- gg_icolib_init();
- initpopups();
- gc_init();
- keepalive_init();
- img_init();
- block_init();
-
- // Try to fetch user avatar
- getOwnAvatar();
- break;
+ HookProtoEvent(ME_OPT_INITIALISE, &GaduProto::options_init);
+ HookProtoEvent(ME_USERINFO_INITIALISE, &GaduProto::details_init);
+
+ // Init misc stuff
+ gg_icolib_init();
+ initpopups();
+ gc_init();
+ keepalive_init();
+ img_init();
+ block_init();
+
+ // Try to fetch user avatar
+ getOwnAvatar();
+}
- case EV_PROTO_ONEXIT:
- // Stop avatar request thread
- pth_avatar.dwThreadId = 0;
+void GaduProto::OnShutdown()
+{
+ // Stop avatar request thread
+ pth_avatar.dwThreadId = 0;
- // Stop main connection session thread
- pth_sess.dwThreadId = 0;
+ // Stop main connection session thread
+ pth_sess.dwThreadId = 0;
- img_shutdown();
- sessions_closedlg();
- break;
+ img_shutdown();
+ sessions_closedlg();
+}
+int GaduProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam)
+{
+ switch (eventType) {
case EV_PROTO_ONMENU:
menus_init();
break;
diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h index 87555b9d06..dbec00c7ac 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.h +++ b/protocols/Gadu-Gadu/src/gg_proto.h @@ -31,32 +31,34 @@ struct GaduProto : public PROTO<GaduProto> // PROTO_INTERFACE
//====================================================================================
- virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr);
-
- 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 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 HANDLE __cdecl SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName);
- virtual HWND __cdecl SearchAdvanced(HWND owner);
- virtual HWND __cdecl CreateExtendedSearchUI(HWND owner);
-
- 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 SetApparentMode(MCONTACT hContact, int mode);
- 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 UserIsTyping(MCONTACT hContact, int type);
-
- virtual int __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam);
+ MCONTACT AddToList(int flags, PROTOSEARCHRESULT* psr) 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_PTR GetCaps(int type, MCONTACT hContact = NULL) override;
+ int GetInfo(MCONTACT hContact, int infoType) override;
+
+ HANDLE SearchBasic(const wchar_t* id) override;
+ HANDLE SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName) override;
+ HWND SearchAdvanced(HWND owner) override;
+ HWND CreateExtendedSearchUI(HWND owner) override;
+
+ HANDLE SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles) override;
+ int SendMsg(MCONTACT hContact, int flags, const char* msg) override;
+
+ int SetApparentMode(MCONTACT hContact, int mode) override;
+ int SetStatus(int iNewStatus) override;
+
+ HANDLE GetAwayMsg(MCONTACT hContact) override;
+ int SetAwayMsg(int m_iStatus, const wchar_t* msg) override;
+
+ int UserIsTyping(MCONTACT hContact, int type) override;
+
+ int OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) override;
+ void OnModulesLoaded() override;
+ void OnShutdown() override;
//////////////////////////////////////////////////////////////////////////////////////
// Services
diff --git a/protocols/Gadu-Gadu/src/libgadu/dcc.cpp b/protocols/Gadu-Gadu/src/libgadu/dcc.cpp index 3e65559964..2f3b901ab9 100644 --- a/protocols/Gadu-Gadu/src/libgadu/dcc.cpp +++ b/protocols/Gadu-Gadu/src/libgadu/dcc.cpp @@ -1329,8 +1329,6 @@ struct gg_event *gg_dcc_watch_fd(struct gg_dcc *h) return e;
}
}
-
- return e;
}
/**
|