From 35d5b1cc47ac444524c087615033d5856f8a5dc3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 10 Apr 2025 16:45:33 +0300 Subject: no need to declare the same template in each protocol --- protocols/SkypeWeb/src/skype_proto.h | 9 +-------- protocols/Steam/src/steam_menus.cpp | 13 +++---------- protocols/Steam/src/steam_proto.h | 6 +++--- protocols/Teams/src/teams_proto.h | 7 ------- protocols/Twitter/src/main.cpp | 2 +- protocols/Twitter/src/proto.h | 1 + protocols/Twitter/src/theme.cpp | 9 +-------- protocols/Twitter/src/theme.h | 1 - 8 files changed, 10 insertions(+), 38 deletions(-) (limited to 'protocols') diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index e81c733f31..d6528c20d4 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -35,7 +35,7 @@ struct CSkypeTransfer int iFileSize = 0, iWidth = -1, iHeight = -1; }; -struct CSkypeProto : public PROTO +struct CSkypeProto : public PROTO { friend class CSkypeOptionsMain; friend class CSkypeGCCreateDlg; @@ -359,13 +359,6 @@ private: INT_PTR __cdecl SvcCreateChat(WPARAM, LPARAM); INT_PTR __cdecl SvcSetMood(WPARAM, LPARAM); INT_PTR __cdecl ParseSkypeUriService(WPARAM, LPARAM lParam); - - template - static INT_PTR __cdecl GlobalService(WPARAM wParam, LPARAM lParam) - { - CSkypeProto *proto = CMPlugin::getInstance((MCONTACT)wParam); - return proto ? (proto->*Service)(wParam, lParam) : 0; - } }; typedef CProtoDlgBase CSkypeDlgBase; diff --git a/protocols/Steam/src/steam_menus.cpp b/protocols/Steam/src/steam_menus.cpp index d82d3e46cf..1926c27179 100644 --- a/protocols/Steam/src/steam_menus.cpp +++ b/protocols/Steam/src/steam_menus.cpp @@ -3,13 +3,6 @@ int CSteamProto::hChooserMenu; HGENMENU CSteamProto::contactMenuItems[CMI_MAX]; -template -INT_PTR GlobalService(WPARAM hContact, LPARAM lParam) -{ - CSteamProto *ppro = CMPlugin::getInstance((MCONTACT)hContact); - return ppro ? (ppro->*Service)(hContact, lParam) : 0; -} - INT_PTR CSteamProto::AuthRequestCommand(WPARAM hContact, LPARAM) { ProtoChainSend(hContact, PSS_AUTHREQUEST, 0, 0); @@ -22,19 +15,19 @@ INT_PTR CSteamProto::AuthRevokeCommand(WPARAM hContact, LPARAM) return 0; } -int CSteamProto::BlockCommand(WPARAM hContact, LPARAM) +INT_PTR CSteamProto::BlockCommand(WPARAM hContact, LPARAM) { SendUserIgnoreRequest(hContact, true); return 0; } -int CSteamProto::UnblockCommand(WPARAM hContact, LPARAM) +INT_PTR CSteamProto::UnblockCommand(WPARAM hContact, LPARAM) { SendUserIgnoreRequest(hContact, false); return 0; } -int CSteamProto::JoinToGameCommand(WPARAM hContact, LPARAM) +INT_PTR CSteamProto::JoinToGameCommand(WPARAM hContact, LPARAM) { char url[MAX_PATH]; uint32_t gameId = getDword(hContact, "GameID", 0); diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h index 360a7403b3..f21bcb4869 100644 --- a/protocols/Steam/src/steam_proto.h +++ b/protocols/Steam/src/steam_proto.h @@ -300,9 +300,9 @@ class CSteamProto : public PROTO INT_PTR __cdecl AuthRequestCommand(WPARAM, LPARAM); INT_PTR __cdecl AuthRevokeCommand(WPARAM, LPARAM); - int __cdecl BlockCommand(WPARAM, LPARAM); - int __cdecl UnblockCommand(WPARAM, LPARAM); - int __cdecl JoinToGameCommand(WPARAM, LPARAM); + INT_PTR __cdecl BlockCommand(WPARAM, LPARAM); + INT_PTR __cdecl UnblockCommand(WPARAM, LPARAM); + INT_PTR __cdecl JoinToGameCommand(WPARAM, LPARAM); INT_PTR __cdecl OpenBlockListCommand(WPARAM, LPARAM); diff --git a/protocols/Teams/src/teams_proto.h b/protocols/Teams/src/teams_proto.h index c6ad876e86..2cff3431e3 100644 --- a/protocols/Teams/src/teams_proto.h +++ b/protocols/Teams/src/teams_proto.h @@ -341,13 +341,6 @@ private: INT_PTR __cdecl SvcSetMood(WPARAM, LPARAM); INT_PTR __cdecl ParseSkypeUriService(WPARAM, LPARAM lParam); - template - static INT_PTR __cdecl GlobalService(WPARAM wParam, LPARAM lParam) - { - auto *proto = CMPlugin::getInstance((MCONTACT)wParam); - return proto ? (proto->*Service)(wParam, lParam) : 0; - } - // trouter public: void TRouterProcess(const char *str); diff --git a/protocols/Twitter/src/main.cpp b/protocols/Twitter/src/main.cpp index ddfca4e698..cbbbb3ae14 100644 --- a/protocols/Twitter/src/main.cpp +++ b/protocols/Twitter/src/main.cpp @@ -54,7 +54,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC int CMPlugin::Load() { InitIcons(); - InitContactMenus(); + CTwitterProto::InitContactMenus(); TwitterInitSounds(); return 0; } diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h index 0b91476259..0945761c82 100644 --- a/protocols/Twitter/src/proto.h +++ b/protocols/Twitter/src/proto.h @@ -189,6 +189,7 @@ public: void OnModulesLoaded() override; void UpdateSettings(); + static void InitContactMenus(void); ////////////////////////////////////////////////////////////////////////////////////// // Services diff --git a/protocols/Twitter/src/theme.cpp b/protocols/Twitter/src/theme.cpp index 378e57447e..7470ea1a38 100644 --- a/protocols/Twitter/src/theme.cpp +++ b/protocols/Twitter/src/theme.cpp @@ -55,13 +55,6 @@ static HGENMENU g_hMenuItems[2]; // Helper functions -template -INT_PTR GlobalService(WPARAM hContact, LPARAM lParam) -{ - CTwitterProto *proto = CMPlugin::getInstance(MCONTACT(hContact)); - return proto ? (proto->*Fcn)(hContact, lParam) : 0; -} - static int PrebuildContactMenu(WPARAM hContact, LPARAM lParam) { ShowContactMenus(false); @@ -70,7 +63,7 @@ static int PrebuildContactMenu(WPARAM hContact, LPARAM lParam) return proto ? proto->OnPrebuildContactMenu(hContact, lParam) : 0; } -void InitContactMenus() +void CTwitterProto::InitContactMenus() { HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); diff --git a/protocols/Twitter/src/theme.h b/protocols/Twitter/src/theme.h index 6bd91241fd..5aed016764 100644 --- a/protocols/Twitter/src/theme.h +++ b/protocols/Twitter/src/theme.h @@ -21,6 +21,5 @@ along with this program. If not, see . void InitIcons(void); HANDLE GetIconHandle(const char *name); -void InitContactMenus(void); void ShowContactMenus(bool show); void TwitterInitSounds(void); \ No newline at end of file -- cgit v1.2.3