From 4a07d904cb59d4d9d494df34096d0ecac6d0cf76 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 14 Jun 2023 17:04:02 +0300 Subject: Steam: first working SendRequest() --- protocols/Steam/src/api/app_info.h | 2 +- protocols/Steam/src/api/friend.h | 2 +- protocols/Steam/src/api/friend_list.h | 2 +- protocols/Steam/src/api/history.h | 4 +- protocols/Steam/src/api/login.h | 4 +- protocols/Steam/src/api/message.h | 4 +- protocols/Steam/src/api/poll.h | 79 ----------------------------------- protocols/Steam/src/api/search.h | 2 +- protocols/Steam/src/api/session.h | 13 ++++-- 9 files changed, 19 insertions(+), 93 deletions(-) delete mode 100644 protocols/Steam/src/api/poll.h (limited to 'protocols/Steam/src/api') diff --git a/protocols/Steam/src/api/app_info.h b/protocols/Steam/src/api/app_info.h index b4c2618249..d2ef0df532 100644 --- a/protocols/Steam/src/api/app_info.h +++ b/protocols/Steam/src/api/app_info.h @@ -5,7 +5,7 @@ class GetAppInfoRequest : public HttpRequest { public: GetAppInfoRequest(const char *token, const char *appIds) : - HttpRequest(REQUEST_GET, STEAM_API_URL "/ISteamGameOAuth/GetAppInfo/v0001") + HttpRequest(REQUEST_GET, "/ISteamGameOAuth/GetAppInfo/v0001") { this << CHAR_PARAM("access_token", token) << CHAR_PARAM("appIds", appIds); } diff --git a/protocols/Steam/src/api/friend.h b/protocols/Steam/src/api/friend.h index e6740e7151..a86c2c98e4 100644 --- a/protocols/Steam/src/api/friend.h +++ b/protocols/Steam/src/api/friend.h @@ -5,7 +5,7 @@ class GetUserSummariesRequest : public HttpRequest { public: GetUserSummariesRequest(CSteamProto *ppro, const char *steamIds) : - HttpRequest(REQUEST_GET, STEAM_API_URL "/ISteamUserOAuth/GetUserSummaries/v0002") + HttpRequest(REQUEST_GET, "/ISteamUserOAuth/GetUserSummaries/v0002") { this << CHAR_PARAM("access_token", ppro->getMStringA("TokenSecret")) << CHAR_PARAM("steamids", steamIds); } diff --git a/protocols/Steam/src/api/friend_list.h b/protocols/Steam/src/api/friend_list.h index 359423d359..84d8536bcb 100644 --- a/protocols/Steam/src/api/friend_list.h +++ b/protocols/Steam/src/api/friend_list.h @@ -5,7 +5,7 @@ class GetFriendListRequest : public HttpRequest { public: GetFriendListRequest(const char *token, const char *steamId, const char *relationship) : - HttpRequest(REQUEST_GET, STEAM_API_URL "/ISteamUserOAuth/GetFriendList/v0001") + HttpRequest(REQUEST_GET, "/ISteamUserOAuth/GetFriendList/v0001") { this << CHAR_PARAM("access_token", token) << CHAR_PARAM("steamid", steamId) << CHAR_PARAM("relationship", relationship); } diff --git a/protocols/Steam/src/api/history.h b/protocols/Steam/src/api/history.h index 290f2310df..fbc09abed6 100644 --- a/protocols/Steam/src/api/history.h +++ b/protocols/Steam/src/api/history.h @@ -5,7 +5,7 @@ class GetConversationsRequest : public HttpRequest { public: GetConversationsRequest(CSteamProto *ppro) : - HttpRequest(REQUEST_GET, STEAM_API_URL "/IFriendMessagesService/GetActiveMessageSessions/v0001") + HttpRequest(REQUEST_GET, "/IFriendMessagesService/GetActiveMessageSessions/v0001") { this << CHAR_PARAM("access_token", ppro->getMStringA("TokenSecret")); } @@ -30,7 +30,7 @@ class GetHistoryMessagesRequest : public HttpRequest { public: GetHistoryMessagesRequest(const char *token, const char *steamId, const char *who, time_t since) : - HttpRequest(REQUEST_GET, STEAM_API_URL "/IFriendMessagesService/GetRecentMessages/v0001") + HttpRequest(REQUEST_GET, "/IFriendMessagesService/GetRecentMessages/v0001") { this << CHAR_PARAM("access_token", token) diff --git a/protocols/Steam/src/api/login.h b/protocols/Steam/src/api/login.h index d9511c4752..ece955840d 100644 --- a/protocols/Steam/src/api/login.h +++ b/protocols/Steam/src/api/login.h @@ -5,7 +5,7 @@ class LogonRequest : public HttpRequest { public: LogonRequest(const char *token) : - HttpRequest(REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Logon/v0001") + HttpRequest(REQUEST_POST, "/ISteamWebUserPresenceOAuth/Logon/v0001") { char data[256]; mir_snprintf(data, "access_token=%s&ui_mode=web", token); @@ -31,7 +31,7 @@ class LogoffRequest : public HttpRequest { public: LogoffRequest(const char *token, const char *umqId) : - HttpRequest(REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Logoff/v0001") + HttpRequest(REQUEST_POST, "/ISteamWebUserPresenceOAuth/Logoff/v0001") { this << CHAR_PARAM("access_token", token) diff --git a/protocols/Steam/src/api/message.h b/protocols/Steam/src/api/message.h index e07e70d959..934bdc875e 100644 --- a/protocols/Steam/src/api/message.h +++ b/protocols/Steam/src/api/message.h @@ -5,7 +5,7 @@ class SendMessageRequest : public HttpRequest { public: SendMessageRequest(const char *token, const char *umqId, const char *steamId, const char *text) : - HttpRequest(REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Message/v0001") + HttpRequest(REQUEST_POST, "/ISteamWebUserPresenceOAuth/Message/v0001") { this << CHAR_PARAM("access_token", token) @@ -20,7 +20,7 @@ class SendTypingRequest : public HttpRequest { public: SendTypingRequest(const char *token, const char *umqId, const char *steamId) : - HttpRequest(REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Message/v0001") + HttpRequest(REQUEST_POST, "/ISteamWebUserPresenceOAuth/Message/v0001") { this << CHAR_PARAM("access_token", token) diff --git a/protocols/Steam/src/api/poll.h b/protocols/Steam/src/api/poll.h deleted file mode 100644 index 9de2ed32d3..0000000000 --- a/protocols/Steam/src/api/poll.h +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef _STEAM_REQUEST_POLL_H_ -#define _STEAM_REQUEST_POLL_H_ - -class PollRequest : public HttpRequest -{ -public: - PollRequest(CSteamProto *ppro) : - HttpRequest(REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Poll/v0001") - { - timeout = (STEAM_API_TIMEOUT + 5) * 1000; - // flags |= NLHRF_PERSISTENT; - - AddHeader("Connection", "keep-alive"); - - this - << CHAR_PARAM("access_token", ppro->getMStringA("TokenSecret")) - << CHAR_PARAM("umqid", ppro->getMStringA("UMQID")) - << INT64_PARAM("message", ppro->getDword("MessageID")) - << INT_PARAM("secidletime", ppro->IdleSeconds()); - } - - //{ - // "pollid": 0, - // "sectimeout" : 30, - // "error" : "Timeout" - //} - - //{ - // "pollid": 0, - // "messages": [ - // { - // "type": "typing", - // "timestamp": 17276041, - // "utc_timestamp": 1514974857, - // "steamid_from": "XXXXXXXXXXXXXXXXX", - // "text": "" - // }, - // { - // "type": "saytext", - // "timestamp" : 17380133, - // "utc_timestamp" : 1514974961, - // "steamid_from" : "XXXXXXXXXXXXXXXXX", - // "text" : "message" - // }, - // { - // "type": "personarelationship", - // "timestamp" : 7732750, - // "utc_timestamp" : 1515187192, - // "steamid_from" : "XXXXXXXXXXXXXXXXX", - // "status_flags" : 1, - // "persona_state" : 2 - // }, - // { - // "type": "personastate", - // "timestamp" : 366860, - // "utc_timestamp" : 1515007523, - // "steamid_from" : "XXXXXXXXXXXXXXXXX", - // "status_flags" : 9055, - // "persona_state" : 1, - // "persona_name" : "nickname" - // }, - // { - // "type": "notificationcountupdate", - // "timestamp" : 11605105, - // "utc_timestamp" : 1515191064 - // } - // ] - // , - // "messagelast": 4, - // "timestamp": 17276041, - // "utc_timestamp": 1514974857, - // "messagebase": 3, - // "sectimeout": 14, - // "error": "OK" - //} - -}; - -#endif //_STEAM_REQUEST_POLL_H_ diff --git a/protocols/Steam/src/api/search.h b/protocols/Steam/src/api/search.h index fd3c8a66f0..d72d140dc5 100644 --- a/protocols/Steam/src/api/search.h +++ b/protocols/Steam/src/api/search.h @@ -5,7 +5,7 @@ class SearchRequest : public HttpRequest { public: SearchRequest(const char *token, const char *text, int offset = 0, int count = 30) : - HttpRequest(REQUEST_GET, STEAM_API_URL "/ISteamUserOAuth/Search/v0001") + HttpRequest(REQUEST_GET, "/ISteamUserOAuth/Search/v0001") { this << CHAR_PARAM("access_token", token) diff --git a/protocols/Steam/src/api/session.h b/protocols/Steam/src/api/session.h index 00705c1b67..8c7351db6f 100644 --- a/protocols/Steam/src/api/session.h +++ b/protocols/Steam/src/api/session.h @@ -1,9 +1,15 @@ #ifndef _STEAM_REQUEST_SESSION_H_ #define _STEAM_REQUEST_SESSION_H_ -class GetSessionRequest : public HttpRequest +struct GetHostsRequest : public HttpRequest +{ + GetHostsRequest() : + HttpRequest(REQUEST_GET, "/ISteamDirectory/GetCMList/v0001?cellid=0") + {} +}; + +struct GetSessionRequest : public HttpRequest { -public: GetSessionRequest(const char *token, const char *steamId, const char *cookie) : HttpRequest(REQUEST_POST, STEAM_WEB_URL "/mobileloginsucceeded") { @@ -23,9 +29,8 @@ public: } }; -class GetSessionRequest2 : public HttpRequest +struct GetSessionRequest2 : public HttpRequest { -public: GetSessionRequest2(const char *token, const char *steamId) : HttpRequest(REQUEST_GET, STEAM_WEB_URL "/mobilesettings/GetManifest/v0001") { -- cgit v1.2.3