diff options
Diffstat (limited to 'protocols/Steam/src')
-rw-r--r-- | protocols/Steam/src/api/history.h | 24 | ||||
-rw-r--r-- | protocols/Steam/src/main.cpp | 31 | ||||
-rw-r--r-- | protocols/Steam/src/protobuf-c/encrypted_app_ticket.pb-c.cpp (renamed from protocols/Steam/src/protobuf-c/encrypted_app_ticket.pb-c.c) | 0 | ||||
-rw-r--r-- | protocols/Steam/src/protobuf-c/encrypted_app_ticket.pb-c.h | 10 | ||||
-rw-r--r-- | protocols/Steam/src/protobuf-c/steammessages_clientserver.pb-c.cpp (renamed from protocols/Steam/src/protobuf-c/steammessages_clientserver.pb-c.c) | 0 | ||||
-rw-r--r-- | protocols/Steam/src/protobuf-c/steammessages_clientserver.pb-c.h | 10 | ||||
-rw-r--r-- | protocols/Steam/src/stdafx.h | 1 | ||||
-rw-r--r-- | protocols/Steam/src/steam_contacts.cpp | 2 | ||||
-rw-r--r-- | protocols/Steam/src/steam_history.cpp | 13 | ||||
-rw-r--r-- | protocols/Steam/src/steam_proto.h | 5 | ||||
-rw-r--r-- | protocols/Steam/src/steam_server.cpp | 9 |
11 files changed, 37 insertions, 68 deletions
diff --git a/protocols/Steam/src/api/history.h b/protocols/Steam/src/api/history.h index 29086b6f46..de3e7367f9 100644 --- a/protocols/Steam/src/api/history.h +++ b/protocols/Steam/src/api/history.h @@ -1,30 +1,6 @@ #ifndef _STEAM_REQUEST_HISTORY_H_ #define _STEAM_REQUEST_HISTORY_H_ -struct GetConversationsRequest : public HttpRequest -{ - GetConversationsRequest(const char *token) : - HttpRequest(REQUEST_GET, "/IFriendMessagesService/GetActiveMessageSessions/v0001") - { - this << CHAR_PARAM("access_token", token); - } - - //{ - // "response": { - // "message_sessions": [ - // { - // "accountid_friend": XXXXXXXXX, - // "last_message" : 1514975719, - // "last_view" : 1514975719, - // "unread_message_count" : 0 - // } - // ] - // , - // "timestamp": 1515007542 - // } - //} -}; - struct GetHistoryMessagesRequest : public HttpRequest { GetHistoryMessagesRequest(const char *token, int64_t steamId, const char *who, time_t since) : diff --git a/protocols/Steam/src/main.cpp b/protocols/Steam/src/main.cpp index 0ee4bae20e..092f545208 100644 --- a/protocols/Steam/src/main.cpp +++ b/protocols/Steam/src/main.cpp @@ -47,7 +47,7 @@ void CMPlugin::InitSteamServices() messages[EMsg::ClientNewLoginKey] = &cmsg_client_new_login_key__descriptor;
messages[EMsg::ClientNewLoginKeyAccepted] = &cmsg_client_new_login_key_accepted__descriptor;
messages[EMsg::ClientRequestWebAPIAuthenticateUserNonceResponse] = &cmsg_client_request_web_apiauthenticate_user_nonce_response__descriptor;
- // messages[EMsg::ClientCMList] = &cmsg_Client__CMList;
+ messages[EMsg::ClientCMList] = &cmsg_client_cmlist__descriptor;
// messages[EMsg::ClientItemAnnouncements] = &cmsg_Client__ItemAnnouncements;
// messages[EMsg::ClientRequestItemAnnouncements] = &cmsg_Client_RequestItemAnnouncements;
// messages[EMsg::ClientCommentNotifications] = &cmsg_Client_CommentNotifications;
@@ -55,15 +55,13 @@ void CMPlugin::InitSteamServices() // messages[EMsg::ClientUserNotifications] = &cmsg_Client_UserNotifications;
// messages[EMsg::ClientFSOfflineMessageNotification] = &cmsg_Client__OfflineMessageNotification;
// messages[EMsg::ClientFSRequestOfflineMessageCount] = &cmsg_Client_RequestOfflineMessageCount;
- // messages[EMsg::ClientGamesPlayed] = &cmsg_Client__GamesPlayed;
- // messages[EMsg::ClientGamesPlayedWithDataBlob] = &cmsg_Client_GamesPlayed;
+ messages[EMsg::ClientGamesPlayed] = &cmsg_client_games_played__descriptor;
+ messages[EMsg::ClientGamesPlayedWithDataBlob] = &cmsg_client_games_played__descriptor;
messages[EMsg::ClientAccountInfo] = &cmsg_client_account_info__descriptor;
// messages[EMsg::ClientEmailAddrInfo] = &cmsg_Client__EmailAddrInfo;
- // messages[EMsg::ClientIsLimitedAccount] = &cmsg_Client__IsLimitedAccount;
- // messages[EMsg::ClientWalletInfoUpdate] = &cmsg_Client__WalletInfoUpdate;
+ messages[EMsg::ClientIsLimitedAccount] = &cmsg_client_is_limited_account__descriptor;
+ messages[EMsg::ClientWalletInfoUpdate] = &cmsg_client_wallet_info_update__descriptor;
// messages[EMsg::ClientLicenseList] = &cmsg_Client__LicenseList;
- // messages[EMsg::ClientServiceMethodLegacy] = &cmsg_Client_ServiceMethodLegacy;
- // messages[EMsg::ClientServiceMethodLegacyResponse] = &cmsg_Client_ServiceMethodLegacyResponse;
// messages[EMsg::ClientGMSServerQuery] = &cmsg_Client_GMSServerQuery;
// messages[EMsg::GMSClientServerQueryResponse] = &cmsg_GMSClientServerQueryResponse;
// messages[EMsg::ClientPICSChangesSinceResponse] = &cmsg_Client_PICSChangesSinceResponse;
@@ -78,11 +76,11 @@ void CMPlugin::InitSteamServices() // messages[EMsg::ClientFSGetFriendsSteamLevels] = &cmsg_Client_FSGetFriendsSteamLevels;
// messages[EMsg::ClientFSGetFriendsSteamLevelsResponse] = &cmsg_Client_FSGetFriendsSteamLevelsResponse;
messages[EMsg::ClientPersonaState] = &cmsg_client_persona_state__descriptor;
- // messages[EMsg::ClientClanState] = &cmsg_Client_ClanState;
+ messages[EMsg::ClientClanState] = &cmsg_client_clan_state__descriptor;
messages[EMsg::ClientFriendsList] = &cmsg_client_friends_list__descriptor;
messages[EMsg::ClientRequestFriendData] = &cmsg_client_request_friend_data__descriptor;
messages[EMsg::ClientFriendMsg] = &cmsg_client_friend_msg__descriptor;
- // messages[EMsg::ClientChatInvite] = &cmsg_Client_ChatInvite;
+ messages[EMsg::ClientChatInvite] = &cmsg_client_chat_invite__descriptor;
messages[EMsg::ClientFriendMsgIncoming] = &cmsg_client_friend_msg_incoming__descriptor;
messages[EMsg::ClientFriendMsgEchoToSender] = &cmsg_client_friend_msg_incoming__descriptor;
// messages[EMsg::ClientFSGetFriendMessageHistory] = &cmsg_Client_ChatGetFriendMessageHistory;
@@ -107,14 +105,13 @@ void CMPlugin::InitSteamServices() // messages[EMsg::ClientRequestFreeLicenseResponse] = &cmsg_Client_RequestFreeLicenseResponse;
// messages[EMsg::ClientGetNumberOfCurrentPlayersDP] = &cmsg_DPGetNumberOfCurrentPlayers;
// messages[EMsg::ClientGetNumberOfCurrentPlayersDPResponse] = &cmsg_DPGetNumberOfCurrentPlayersResponse;
- // messages[EMsg::ClientGetAppOwnershipTicket] = &cmsg_Client_GetAppOwnershipTicket;
- // messages[EMsg::ClientGetAppOwnershipTicketResponse] = &cmsg_Client_GetAppOwnershipTicketResponse;
- // messages[EMsg::ClientGameConnectTokens] = &cmsg_Client_GameConnectTokens;
- // messages[EMsg::ClientAuthList] = &cmsg_Client_AuthList;
- // messages[EMsg::ClientAuthListAck] = &cmsg_Client_AuthListAck;
- // messages[EMsg::ClientTicketAuthComplete] = &cmsg_Client_TicketAuthComplete;
- // messages[EMsg::ClientRequestEncryptedAppTicket] = &cmsg_Client_RequestEncryptedAppTicket;
- // messages[EMsg::ClientRequestEncryptedAppTicketResponse] = &cmsg_Client_RequestEncryptedAppTicketResponse;
+ messages[EMsg::ClientGetAppOwnershipTicketResponse] = &cmsg_client_get_app_ownership_ticket_response__descriptor;
+ messages[EMsg::ClientGameConnectTokens] = &cmsg_client_game_connect_tokens__descriptor;
+ messages[EMsg::ClientAuthList] = &cmsg_client_auth_list__descriptor;
+ messages[EMsg::ClientAuthListAck] = &cmsg_client_auth_list_ack__descriptor;
+ messages[EMsg::ClientTicketAuthComplete] = &cmsg_client_ticket_auth_complete__descriptor;
+ messages[EMsg::ClientRequestEncryptedAppTicket] = &cmsg_client_request_encrypted_app_ticket__descriptor;
+ messages[EMsg::ClientRequestEncryptedAppTicketResponse] = &cmsg_client_request_encrypted_app_ticket_response__descriptor;
// messages[EMsg::ClientCurrentUIMode] = &cmsg_Client_UIMode;
// messages[EMsg::ClientVanityURLChangedNotification] = &cmsg_Client_VanityURLChangedNotification;
// messages[EMsg::ClientAMGetPersonaNameHistory] = &cmsg_Client_AMGetPersonaNameHistory;
diff --git a/protocols/Steam/src/protobuf-c/encrypted_app_ticket.pb-c.c b/protocols/Steam/src/protobuf-c/encrypted_app_ticket.pb-c.cpp index 57ad3408a1..57ad3408a1 100644 --- a/protocols/Steam/src/protobuf-c/encrypted_app_ticket.pb-c.c +++ b/protocols/Steam/src/protobuf-c/encrypted_app_ticket.pb-c.cpp diff --git a/protocols/Steam/src/protobuf-c/encrypted_app_ticket.pb-c.h b/protocols/Steam/src/protobuf-c/encrypted_app_ticket.pb-c.h index e662fd9d91..5ec118d1f4 100644 --- a/protocols/Steam/src/protobuf-c/encrypted_app_ticket.pb-c.h +++ b/protocols/Steam/src/protobuf-c/encrypted_app_ticket.pb-c.h @@ -4,7 +4,7 @@ #ifndef PROTOBUF_C_encrypted_5fapp_5fticket_2eproto__INCLUDED #define PROTOBUF_C_encrypted_5fapp_5fticket_2eproto__INCLUDED -#include <protobuf-c/protobuf-c.h> +#include "protobuf-c.h" PROTOBUF_C__BEGIN_DECLS @@ -29,14 +29,6 @@ extern const ProtobufCMessageDescriptor encrypted_app_ticket__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 EncryptedAppTicket : public ProtobufCppMessage { EncryptedAppTicket() : diff --git a/protocols/Steam/src/protobuf-c/steammessages_clientserver.pb-c.c b/protocols/Steam/src/protobuf-c/steammessages_clientserver.pb-c.cpp index 394ef867cc..394ef867cc 100644 --- a/protocols/Steam/src/protobuf-c/steammessages_clientserver.pb-c.c +++ b/protocols/Steam/src/protobuf-c/steammessages_clientserver.pb-c.cpp diff --git a/protocols/Steam/src/protobuf-c/steammessages_clientserver.pb-c.h b/protocols/Steam/src/protobuf-c/steammessages_clientserver.pb-c.h index 710d04f2e4..e04827379a 100644 --- a/protocols/Steam/src/protobuf-c/steammessages_clientserver.pb-c.h +++ b/protocols/Steam/src/protobuf-c/steammessages_clientserver.pb-c.h @@ -4,7 +4,7 @@ #ifndef PROTOBUF_C_steammessages_5fclientserver_2eproto__INCLUDED #define PROTOBUF_C_steammessages_5fclientserver_2eproto__INCLUDED -#include <protobuf-c/protobuf-c.h> +#include "protobuf-c.h" PROTOBUF_C__BEGIN_DECLS @@ -133,14 +133,6 @@ extern const ProtobufCMessageDescriptor cmsg_client_clan_state__event__descripto 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 CMsgClientRegisterAuthTicketWithCM : public ProtobufCppMessage { CMsgClientRegisterAuthTicketWithCM() : diff --git a/protocols/Steam/src/stdafx.h b/protocols/Steam/src/stdafx.h index 8311086c3b..5cd6bd1fcf 100644 --- a/protocols/Steam/src/stdafx.h +++ b/protocols/Steam/src/stdafx.h @@ -41,6 +41,7 @@ #include "protobuf-c/steammessages_auth.steamclient.pb-c.h"
#include "protobuf-c/steammessages_chat.steamclient.pb-c.h"
+#include "protobuf-c/steammessages_clientserver.pb-c.h"
#include "protobuf-c/steammessages_clientserver_login.pb-c.h"
#include "protobuf-c/steammessages_friendmessages.steamclient.pb-c.h"
#include "proto.h"
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index 9fcf847d92..88ca5699b6 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -486,7 +486,7 @@ void CSteamProto::OnGotFriendList(const CMsgClientFriendsList &reply, const CMsg SendUserInfoRequest(ids, true); // Load last conversations - SendRequest(new GetConversationsRequest(m_szAccessToken), &CSteamProto::OnGotConversations); + SendFriendActiveSessions(); } void CSteamProto::OnGotBlockList(const JSONNode &root, void *) diff --git a/protocols/Steam/src/steam_history.cpp b/protocols/Steam/src/steam_history.cpp index c56105988e..3b4b3a85b2 100644 --- a/protocols/Steam/src/steam_history.cpp +++ b/protocols/Steam/src/steam_history.cpp @@ -1,15 +1,14 @@ #include "stdafx.h" -void CSteamProto::OnGotConversations(const JSONNode &root, void *) +void CSteamProto::OnGotConversations(const CFriendsMessagesGetActiveMessageSessionsResponse &reply, const CMsgProtoBufHeader &hdr) { - if (root.isnull()) + if (hdr.failed()) return; - const JSONNode &response = root["response"]; - for (auto &session : response["message_sessions"]) { - long long accountId = _wtoi64(session["accountid_friend"].as_mstring()); + for (int i=0; i < reply.n_message_sessions; i++) { + auto *session = reply.message_sessions[i]; - const char *who = AccountIdToSteamId(accountId); + const char *who = AccountIdToSteamId(session->accountid_friend); MCONTACT hContact = GetContact(who); if (!hContact) continue; @@ -19,7 +18,7 @@ void CSteamProto::OnGotConversations(const JSONNode &root, void *) if (storedMessageTS == 0) continue; - time_t lastMessageTS = _wtoi64(session["last_message"].as_mstring()); + time_t lastMessageTS = session->last_message; if (lastMessageTS > storedMessageTS) SendRequest(new GetHistoryMessagesRequest(m_szAccessToken, m_iSteamId, who, storedMessageTS), &CSteamProto::OnGotHistoryMessages, (void*)hContact); } diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h index 6547185ed2..9bf4a573b8 100644 --- a/protocols/Steam/src/steam_proto.h +++ b/protocols/Steam/src/steam_proto.h @@ -23,6 +23,7 @@ #define UpdateAuthSessionWithSteamGuardCode "Authentication.UpdateAuthSessionWithSteamGuardCode#1"
#define FriendSendMessage "FriendMessages.SendMessage#1"
+#define FriendGetActiveSessions "FriendMessages.GetActiveMessageSessions#1"
struct SendAuthParam
{
@@ -223,8 +224,10 @@ class CSteamProto : public PROTO<CSteamProto> void OnMessageSent(const CFriendMessagesSendMessageResponse &reply, const CMsgProtoBufHeader &hdr);
int __cdecl OnPreCreateMessage(WPARAM, LPARAM lParam);
+ void SendFriendActiveSessions();
+
// history
- void OnGotConversations(const JSONNode &root, void *arg);
+ void OnGotConversations(const CFriendsMessagesGetActiveMessageSessionsResponse &reply, const CMsgProtoBufHeader &hdr);
void OnGotHistoryMessages(const JSONNode &root, void *);
// menus
diff --git a/protocols/Steam/src/steam_server.cpp b/protocols/Steam/src/steam_server.cpp index d1045e6ca2..4528ccecfe 100644 --- a/protocols/Steam/src/steam_server.cpp +++ b/protocols/Steam/src/steam_server.cpp @@ -66,6 +66,15 @@ void CSteamProto::OnMessageSent(const CFriendMessagesSendMessageResponse &reply, ///////////////////////////////////////////////////////////////////////////////////////// +void CSteamProto::SendFriendActiveSessions() +{ + CFriendsMessagesGetActiveMessageSessionsRequest request; + request.has_only_sessions_with_messages = request.only_sessions_with_messages = true; + WSSendService(FriendGetActiveSessions, request); +} + +///////////////////////////////////////////////////////////////////////////////////////// + void CSteamProto::SendUserInfoRequest(const std::vector<uint64_t> &ids, bool bRetrieveState) { CMsgClientRequestFriendData request; |