From 97bb35bf1222e14656a1d5db3aeb67312e094465 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 29 Dec 2024 19:26:53 +0300 Subject: Steam: added device authorization family --- protocols/Steam/Steam.vcxproj | 4 ++++ protocols/Steam/Steam.vcxproj.filters | 6 +++++ protocols/Steam/src/main.cpp | 5 +++++ .../steammessages_deviceauth.steamclient.pb-c.h | 10 +-------- protocols/Steam/src/stdafx.h | 1 + protocols/Steam/src/steam_login.cpp | 1 + protocols/Steam/src/steam_proto.h | 4 ++++ protocols/Steam/src/steam_server.cpp | 26 ++++++++++++++++++---- 8 files changed, 44 insertions(+), 13 deletions(-) (limited to 'protocols') diff --git a/protocols/Steam/Steam.vcxproj b/protocols/Steam/Steam.vcxproj index 5049b6d579..0f29dd2747 100644 --- a/protocols/Steam/Steam.vcxproj +++ b/protocols/Steam/Steam.vcxproj @@ -63,6 +63,9 @@ NotUsing + + NotUsing + NotUsing @@ -109,6 +112,7 @@ + diff --git a/protocols/Steam/Steam.vcxproj.filters b/protocols/Steam/Steam.vcxproj.filters index 360efb6dde..3bd5e7610d 100644 --- a/protocols/Steam/Steam.vcxproj.filters +++ b/protocols/Steam/Steam.vcxproj.filters @@ -108,6 +108,9 @@ Source Files\protobuf + + Source Files\protobuf + @@ -191,6 +194,9 @@ Source Files\protobuf + + Source Files\protobuf + diff --git a/protocols/Steam/src/main.cpp b/protocols/Steam/src/main.cpp index bc43925734..920345a2e5 100644 --- a/protocols/Steam/src/main.cpp +++ b/protocols/Steam/src/main.cpp @@ -150,6 +150,9 @@ void CMPlugin::InitSteamServices() services["ChatRoom"] = &chat_room__descriptor; services["ChatRoomClient"] = &chat_room_client__descriptor; + // services from steammessages_deviceauth.steamclient.proto + services["DeviceAuth"] = &device_auth__descriptor; + // services from steammessages_friendmessages.steamclient.proto services["FriendMessages"] = &friend_messages__descriptor; services["FriendMessagesClient"] = &friend_messages_client__descriptor; @@ -168,6 +171,8 @@ void CMPlugin::InitSteamServices() serviceHandlers[FriendGetRecentMessages] = ServiceResponseHandler(&CSteamProto::OnGotRecentMessages); serviceHandlers[FriendGetIncomingMessage] = ServiceResponseHandler(&CSteamProto::OnGotIncomingMessage); + serviceHandlers[GetOwnAuthorizedDevices] = ServiceResponseHandler(&CSteamProto::OnGotDeviceList); + serviceHandlers[NotificationReceived] = ServiceResponseHandler(&CSteamProto::OnGotNotification); } diff --git a/protocols/Steam/src/protobuf-c/steammessages_deviceauth.steamclient.pb-c.h b/protocols/Steam/src/protobuf-c/steammessages_deviceauth.steamclient.pb-c.h index c8b6a8d8a7..84db1e95da 100644 --- a/protocols/Steam/src/protobuf-c/steammessages_deviceauth.steamclient.pb-c.h +++ b/protocols/Steam/src/protobuf-c/steammessages_deviceauth.steamclient.pb-c.h @@ -4,7 +4,7 @@ #ifndef PROTOBUF_C_steammessages_5fdeviceauth_2esteamclient_2eproto__INCLUDED #define PROTOBUF_C_steammessages_5fdeviceauth_2esteamclient_2eproto__INCLUDED -#include +#include "protobuf-c.h" PROTOBUF_C__BEGIN_DECLS @@ -88,14 +88,6 @@ extern const ProtobufCServiceDescriptor device_auth__descriptor; extern "C" void message_init_generic(const ProtobufCMessageDescriptor * desc, ProtobufCMessage * message); -struct ProtobufCppMessage : public ProtobufCMessage -{ - ProtobufCppMessage(const ProtobufCMessageDescriptor &descr) - { - message_init_generic(&descr, this); - } -}; - struct CDeviceAuthGetOwnAuthorizedDevicesRequest : public ProtobufCppMessage { CDeviceAuthGetOwnAuthorizedDevicesRequest() : diff --git a/protocols/Steam/src/stdafx.h b/protocols/Steam/src/stdafx.h index ed82f77a07..56b6647f22 100644 --- a/protocols/Steam/src/stdafx.h +++ b/protocols/Steam/src/stdafx.h @@ -46,6 +46,7 @@ #include "protobuf-c/steammessages_clientserver_2.pb-c.h" #include "protobuf-c/steammessages_clientserver_appinfo.pb-c.h" #include "protobuf-c/steammessages_clientserver_login.pb-c.h" +#include "protobuf-c/steammessages_deviceauth.steamclient.pb-c.h" #include "protobuf-c/steammessages_friendmessages.steamclient.pb-c.h" #include "protobuf-c/steammessages_notifications.steamclient.pb-c.h" #include "proto.h" diff --git a/protocols/Steam/src/steam_login.cpp b/protocols/Steam/src/steam_login.cpp index acdc25f889..1c2c130287 100644 --- a/protocols/Steam/src/steam_login.cpp +++ b/protocols/Steam/src/steam_login.cpp @@ -262,6 +262,7 @@ void CSteamProto::OnClientLogon(const CMsgClientLogonResponse &reply, const CMsg ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_CONNECTING, m_iStatus = m_iDesiredStatus); SendPersonaStatus(m_iStatus); + SendDeviceListRequest(); WSSend(EMsg::ClientChatGetFriendMessageHistoryForOfflineMessages, NoResponse()); } diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h index 57531bacec..446680db43 100644 --- a/protocols/Steam/src/steam_proto.h +++ b/protocols/Steam/src/steam_proto.h @@ -22,6 +22,8 @@ #define BeginAuthSessionViaCredentials "Authentication.BeginAuthSessionViaCredentials#1" #define UpdateAuthSessionWithSteamGuardCode "Authentication.UpdateAuthSessionWithSteamGuardCode#1" +#define GetOwnAuthorizedDevices "DeviceAuth.GetOwnAuthorizedDevices#1" + #define FriendSendMessage "FriendMessages.SendMessage#1" #define FriendGetActiveSessions "FriendMessages.GetActiveMessageSessions#1" #define FriendGetRecentMessages "FriendMessages.GetRecentMessages#1" @@ -154,6 +156,7 @@ class CSteamProto : public PROTO bool SendRequest(HttpRequest *request, JsonCallback callback, void *param = nullptr); void SendAppInfoRequest(uint32_t appId); + void SendDeviceListRequest(); void SendHeartBeat(); void SendLogout(); void SendPersonaStatus(int iStatus); @@ -172,6 +175,7 @@ class CSteamProto : public PROTO void OnClientLogon(const CMsgClientLogonResponse &pResponse, const CMsgProtoBufHeader &hdr); void OnClientLogoff(const CMsgClientLoggedOff &pResponse, const CMsgProtoBufHeader &hdr); void OnGotAppInfo(const CMsgClientPICSProductInfoResponse &pResponse, const CMsgProtoBufHeader &hdr); + void OnGotDeviceList(const CDeviceAuthGetOwnAuthorizedDevicesResponse &pResponse, const CMsgProtoBufHeader &hdr); void OnGotRsaKey(const CAuthenticationGetPasswordRSAPublicKeyResponse &pResponse, const CMsgProtoBufHeader &hdr); void OnGotConfirmationCode(const CAuthenticationUpdateAuthSessionWithSteamGuardCodeResponse &pResponse, const CMsgProtoBufHeader &hdr); void OnPollSession(const CAuthenticationPollAuthSessionStatusResponse &pResponse, const CMsgProtoBufHeader &hdr); diff --git a/protocols/Steam/src/steam_server.cpp b/protocols/Steam/src/steam_server.cpp index c96e821e19..a5e4895dfe 100644 --- a/protocols/Steam/src/steam_server.cpp +++ b/protocols/Steam/src/steam_server.cpp @@ -66,11 +66,16 @@ void CSteamProto::OnGotAppInfo(const CMsgClientPICSProductInfoResponse &reply, c ///////////////////////////////////////////////////////////////////////////////////////// -void CSteamProto::SendPersonaStatus(int status) +void CSteamProto::SendDeviceListRequest() { - CMsgClientChangeStatus request; - request.persona_state = (int)MirandaToSteamState(status); request.has_persona_state = true; - WSSend(EMsg::ClientChangeStatus, request); + CDeviceAuthGetOwnAuthorizedDevicesRequest request; + request.steamid = m_iSteamId; request.has_steamid = true; + WSSendService(GetOwnAuthorizedDevices, request); +} + +void CSteamProto::OnGotDeviceList(const CDeviceAuthGetOwnAuthorizedDevicesResponse &pResponse, const CMsgProtoBufHeader &hdr) +{ + } ///////////////////////////////////////////////////////////////////////////////////////// @@ -85,6 +90,15 @@ void CSteamProto::SendFriendActiveSessions() ///////////////////////////////////////////////////////////////////////////////////////// +void CSteamProto::SendPersonaStatus(int status) +{ + CMsgClientChangeStatus request; + request.persona_state = (int)MirandaToSteamState(status); request.has_persona_state = true; + WSSend(EMsg::ClientChangeStatus, request); +} + +///////////////////////////////////////////////////////////////////////////////////////// + void CSteamProto::SendUserInfoRequest(uint64_t id) { std::vector ids; @@ -101,6 +115,8 @@ void CSteamProto::SendUserInfoRequest(const std::vector &ids) WSSend(EMsg::ClientRequestFriendData, request); } +///////////////////////////////////////////////////////////////////////////////////////// + void CSteamProto::SendUserAddRequest(uint64_t id) { CMsgClientAddFriend request; @@ -122,6 +138,8 @@ void CSteamProto::SendUserIgnoreRequest(MCONTACT hContact, bool bIgnore) WSSendRaw(EMsg::ClientSetIgnoreFriend, payload); } +///////////////////////////////////////////////////////////////////////////////////////// + void CSteamProto::SendHeartBeat() { CMsgClientHeartBeat packet; -- cgit v1.2.3