From 4bbe001b15dec9cacd882ee55fe54f85c56a147f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 15 Dec 2024 15:50:25 +0300 Subject: Steam: service calls switched to static handlers --- protocols/Steam/src/main.cpp | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'protocols/Steam/src/main.cpp') diff --git a/protocols/Steam/src/main.cpp b/protocols/Steam/src/main.cpp index be3991d116..a39ce0aef5 100644 --- a/protocols/Steam/src/main.cpp +++ b/protocols/Steam/src/main.cpp @@ -32,15 +32,42 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC ///////////////////////////////////////////////////////////////////////////////////////// +void CMPlugin::InitSteamServices() +{ + // services from steammessages_auth.steamclient.proto + services["Authentication"] = &authentication__descriptor; + services["AuthenticationSupport"] = &authentication_support__descriptor; + + // services from steammessages_chat.steamclient.proto + services["Chat"] = &chat__descriptor; + services["ChatRoom"] = &chat_room__descriptor; + services["ChatRoomClient"] = &chat_room_client__descriptor; + + // services from steammessages_friendmessages.steamclient.proto + services["FriendMessages"] = &friend_messages__descriptor; + services["FriendMessagesClient"] = &friend_messages_client__descriptor; + + // static service handlers + serviceHandlers[PollAuthSessionStatus] = ServiceResponseHandler(&CSteamProto::OnPollSession); + serviceHandlers[GetPasswordRSAPublicKey] = ServiceResponseHandler(&CSteamProto::OnGotRsaKey); + serviceHandlers[BeginAuthSessionViaCredentials] = ServiceResponseHandler(&CSteamProto::OnBeginSession); + serviceHandlers[UpdateAuthSessionWithSteamGuardCode] = ServiceResponseHandler(&CSteamProto::OnGotConfirmationCode); + + serviceHandlers[FriendSendMessage] = ServiceResponseHandler(&CSteamProto::OnMessageSent); +} + int CMPlugin::Load() { + InitSteamServices(); + + // extra statuses char iconName[100]; mir_snprintf(iconName, "%s_%s", MODULE, "gaming"); + hExtraXStatus = ExtraIcon_RegisterIcolib("steam_game", LPGEN("Steam game"), iconName); - // extra statuses HookEvent(ME_SKIN_ICONSCHANGED, OnReloadIcons); - hExtraXStatus = ExtraIcon_RegisterIcolib("steam_game", LPGEN("Steam game"), iconName); + // menus CSteamProto::InitMenus(); return 0; } -- cgit v1.2.3