From e9a3b54db4aa8ffb6f97baabc2b676e3d9570bb1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 12 Dec 2024 21:56:51 +0300 Subject: more code cleaning --- protocols/Steam/src/api/app_info.h | 3 +-- protocols/Steam/src/api/avatar.h | 3 +-- protocols/Steam/src/api/captcha.h | 3 +-- protocols/Steam/src/api/friend.h | 7 +++-- protocols/Steam/src/api/friend_list.h | 31 +++++++++------------ protocols/Steam/src/api/history.h | 14 +++++----- protocols/Steam/src/api/message.h | 20 ++++---------- protocols/Steam/src/api/pending.h | 51 +++++++++++------------------------ protocols/Steam/src/api/rsa_key.h | 18 ------------- protocols/Steam/src/api/search.h | 12 +++------ 10 files changed, 48 insertions(+), 114 deletions(-) delete mode 100644 protocols/Steam/src/api/rsa_key.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 d2ef0df532..cf54e52adf 100644 --- a/protocols/Steam/src/api/app_info.h +++ b/protocols/Steam/src/api/app_info.h @@ -1,9 +1,8 @@ #ifndef _STEAM_REQUEST_APP_INFO_H_ #define _STEAM_REQUEST_APP_INFO_H_ -class GetAppInfoRequest : public HttpRequest +struct GetAppInfoRequest : public HttpRequest { -public: GetAppInfoRequest(const char *token, const char *appIds) : HttpRequest(REQUEST_GET, "/ISteamGameOAuth/GetAppInfo/v0001") { diff --git a/protocols/Steam/src/api/avatar.h b/protocols/Steam/src/api/avatar.h index 28e573d9d1..4140583ead 100644 --- a/protocols/Steam/src/api/avatar.h +++ b/protocols/Steam/src/api/avatar.h @@ -1,9 +1,8 @@ #ifndef _STEAM_REQUEST_AVATAR_H_ #define _STEAM_REQUEST_AVATAR_H_ -class GetAvatarRequest : public HttpRequest +struct GetAvatarRequest : public HttpRequest { -public: GetAvatarRequest(const char *url) : HttpRequest(REQUEST_GET, url) { diff --git a/protocols/Steam/src/api/captcha.h b/protocols/Steam/src/api/captcha.h index a4bacb59f7..a9c017a5a8 100644 --- a/protocols/Steam/src/api/captcha.h +++ b/protocols/Steam/src/api/captcha.h @@ -1,9 +1,8 @@ #ifndef _STEAM_REQUEST_CAPTCHA_H_ #define _STEAM_REQUEST_CAPTCHA_H_ -class GetCaptchaRequest : public HttpRequest +struct GetCaptchaRequest : public HttpRequest { -public: GetCaptchaRequest(const char *captchaId) : HttpRequest(REQUEST_GET, STEAM_WEB_URL "/public/captcha.php") { diff --git a/protocols/Steam/src/api/friend.h b/protocols/Steam/src/api/friend.h index a86c2c98e4..31d5b185a6 100644 --- a/protocols/Steam/src/api/friend.h +++ b/protocols/Steam/src/api/friend.h @@ -1,13 +1,12 @@ #ifndef _STEAM_REQUEST_FRIEND_H_ #define _STEAM_REQUEST_FRIEND_H_ -class GetUserSummariesRequest : public HttpRequest +struct GetUserSummariesRequest : public HttpRequest { -public: - GetUserSummariesRequest(CSteamProto *ppro, const char *steamIds) : + GetUserSummariesRequest(const char *pszAccessToken, const char *steamIds) : HttpRequest(REQUEST_GET, "/ISteamUserOAuth/GetUserSummaries/v0002") { - this << CHAR_PARAM("access_token", ppro->getMStringA("TokenSecret")) << CHAR_PARAM("steamids", steamIds); + this << CHAR_PARAM("access_token", pszAccessToken) << CHAR_PARAM("steamids", steamIds); } //{ diff --git a/protocols/Steam/src/api/friend_list.h b/protocols/Steam/src/api/friend_list.h index 857ec9ec0c..8c9d26a91a 100644 --- a/protocols/Steam/src/api/friend_list.h +++ b/protocols/Steam/src/api/friend_list.h @@ -1,9 +1,8 @@ #ifndef _STEAM_REQUEST_FRIEND_LIST_H_ #define _STEAM_REQUEST_FRIEND_LIST_H_ -class GetFriendListRequest : public HttpRequest +struct GetFriendListRequest : public HttpRequest { -public: GetFriendListRequest(const char *token, int64_t steamId, const char *relationship) : HttpRequest(REQUEST_GET, "/ISteamUserOAuth/GetFriendList/v0001") { @@ -11,14 +10,13 @@ public: } }; -class AddFriendRequest : public HttpRequest +struct AddFriendRequest : public HttpRequest { -public: - AddFriendRequest(const char *token, const char *sessionId, const char *steamId, const char *who) : + AddFriendRequest(const char *token, const char *sessionId, int64_t steamId, const char *who) : HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/AddFriendAjax") { char login[MAX_PATH]; - mir_snprintf(login, "%s||oauth:%s", steamId, token); + mir_snprintf(login, "%lld||oauth:%s", steamId, token); char cookie[MAX_PATH]; mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId); @@ -29,14 +27,13 @@ public: } }; -class BlockFriendRequest : public HttpRequest +struct BlockFriendRequest : public HttpRequest { -public: - BlockFriendRequest(const char *token, const char *sessionId, const char *steamId, const char *who) : + BlockFriendRequest(const char *token, const char *sessionId, int64_t steamId, const char *who) : HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/BlockUserAjax") { char login[MAX_PATH]; - mir_snprintf(login, "%s||oauth:%s", steamId, token); + mir_snprintf(login, "%lld||oauth:%s", steamId, token); char cookie[MAX_PATH]; mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId); @@ -47,14 +44,13 @@ public: } }; -class UnblockFriendRequest : public HttpRequest +struct UnblockFriendRequest : public HttpRequest { -public: - UnblockFriendRequest(const char *token, const char *sessionId, const char *steamId, const char *who) : + UnblockFriendRequest(const char *token, const char *sessionId, int64_t steamId, const char *who) : HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/BlockUserAjax") { char login[MAX_PATH]; - mir_snprintf(login, "%s||oauth:%s", steamId, token); + mir_snprintf(login, "%lld||oauth:%s", steamId, token); char cookie[MAX_PATH]; mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId); @@ -65,14 +61,13 @@ public: } }; -class RemoveFriendRequest : public HttpRequest +struct RemoveFriendRequest : public HttpRequest { -public: - RemoveFriendRequest(const char *token, const char *sessionId, const char *steamId, const char *who) : + RemoveFriendRequest(const char *token, const char *sessionId, int64_t steamId, const char *who) : HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/RemoveFriendAjax") { char login[MAX_PATH]; - mir_snprintf(login, "%s||oauth:%s", steamId, token); + mir_snprintf(login, "%lld||oauth:%s", steamId, token); char cookie[MAX_PATH]; mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId); diff --git a/protocols/Steam/src/api/history.h b/protocols/Steam/src/api/history.h index fbc09abed6..29086b6f46 100644 --- a/protocols/Steam/src/api/history.h +++ b/protocols/Steam/src/api/history.h @@ -1,13 +1,12 @@ #ifndef _STEAM_REQUEST_HISTORY_H_ #define _STEAM_REQUEST_HISTORY_H_ -class GetConversationsRequest : public HttpRequest +struct GetConversationsRequest : public HttpRequest { -public: - GetConversationsRequest(CSteamProto *ppro) : + GetConversationsRequest(const char *token) : HttpRequest(REQUEST_GET, "/IFriendMessagesService/GetActiveMessageSessions/v0001") { - this << CHAR_PARAM("access_token", ppro->getMStringA("TokenSecret")); + this << CHAR_PARAM("access_token", token); } //{ @@ -26,15 +25,14 @@ public: //} }; -class GetHistoryMessagesRequest : public HttpRequest +struct GetHistoryMessagesRequest : public HttpRequest { -public: - GetHistoryMessagesRequest(const char *token, const char *steamId, const char *who, time_t since) : + GetHistoryMessagesRequest(const char *token, int64_t steamId, const char *who, time_t since) : HttpRequest(REQUEST_GET, "/IFriendMessagesService/GetRecentMessages/v0001") { this << CHAR_PARAM("access_token", token) - << CHAR_PARAM("steamid1", steamId) + << INT64_PARAM("steamid1", steamId) << CHAR_PARAM("steamid2", who) // Steam somehow doesn't respect too precise start time parameter, so we better request older time and then do own filtering again << INT64_PARAM("rtime32_start_time", since - 1500); diff --git a/protocols/Steam/src/api/message.h b/protocols/Steam/src/api/message.h index 934bdc875e..5f41876a15 100644 --- a/protocols/Steam/src/api/message.h +++ b/protocols/Steam/src/api/message.h @@ -1,32 +1,22 @@ #ifndef _STEAM_REQUEST_MESSAGE_H_ #define _STEAM_REQUEST_MESSAGE_H_ -class SendMessageRequest : public HttpRequest +struct SendMessageRequest : public HttpRequest { -public: SendMessageRequest(const char *token, const char *umqId, const char *steamId, const char *text) : HttpRequest(REQUEST_POST, "/ISteamWebUserPresenceOAuth/Message/v0001") { - this - << CHAR_PARAM("access_token", token) - << CHAR_PARAM("umqid", umqId) - << CHAR_PARAM("steamid_dst", steamId) - << CHAR_PARAM("type", "saytext") - << CHAR_PARAM("text", text); + this << CHAR_PARAM("access_token", token) << CHAR_PARAM("umqid", umqId) << CHAR_PARAM("steamid_dst", steamId) + << CHAR_PARAM("type", "saytext") << CHAR_PARAM("text", text); } }; -class SendTypingRequest : public HttpRequest +struct SendTypingRequest : public HttpRequest { -public: SendTypingRequest(const char *token, const char *umqId, const char *steamId) : HttpRequest(REQUEST_POST, "/ISteamWebUserPresenceOAuth/Message/v0001") { - this - << CHAR_PARAM("access_token", token) - << CHAR_PARAM("umqid", umqId) - << CHAR_PARAM("steamid_dst", steamId) - << CHAR_PARAM("type", "typing"); + this << CHAR_PARAM("access_token", token) << CHAR_PARAM("umqid", umqId) << CHAR_PARAM("steamid_dst", steamId) << CHAR_PARAM("type", "typing"); } }; diff --git a/protocols/Steam/src/api/pending.h b/protocols/Steam/src/api/pending.h index b8e8e6e15f..bcac0170cc 100644 --- a/protocols/Steam/src/api/pending.h +++ b/protocols/Steam/src/api/pending.h @@ -1,13 +1,12 @@ #ifndef _STEAM_REQUEST_PENDING_H_ #define _STEAM_REQUEST_PENDING_H_ -class ApprovePendingRequest : public HttpRequest +struct ApprovePendingRequest : public HttpRequest { -public: - ApprovePendingRequest(const char *token, const char *sessionId, const char *steamId, const char *who) : + ApprovePendingRequest(const char *token, const char *sessionId, int64_t steamId, const char *who) : HttpRequest(REQUEST_POST, "") { - m_szUrl.Format(STEAM_WEB_URL "/profiles/%s/home_process", steamId); + m_szUrl.Format(STEAM_WEB_URL "/profiles/%lld/home_process", steamId); char cookie[MAX_PATH]; mir_snprintf(cookie, "steamLogin=%s||oauth:%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", @@ -15,24 +14,17 @@ public: AddHeader("Cookie", cookie); - this - << CHAR_PARAM("sessionID", sessionId) - << CHAR_PARAM("id", who) - << CHAR_PARAM("perform", "accept") - << CHAR_PARAM("action", "approvePending") - << CHAR_PARAM("itype", "friend") - << INT_PARAM("json", 1) - << INT_PARAM("xml", 0); + this << CHAR_PARAM("sessionID", sessionId) << CHAR_PARAM("id", who) << CHAR_PARAM("perform", "accept") + << CHAR_PARAM("action", "approvePending") << CHAR_PARAM("itype", "friend") << INT_PARAM("json", 1) << INT_PARAM("xml", 0); } }; -class IgnorePendingRequest : public HttpRequest +struct IgnorePendingRequest : public HttpRequest { -public: - IgnorePendingRequest(const char *token, const char *sessionId, const char *steamId, const char *who) : + IgnorePendingRequest(const char *token, const char *sessionId, int64_t steamId, const char *who) : HttpRequest(REQUEST_POST, "") { - m_szUrl.Format(STEAM_WEB_URL "/profiles/%s/home_process", steamId); + m_szUrl.Format(STEAM_WEB_URL "/profiles/%lld/home_process", steamId); char cookie[MAX_PATH]; mir_snprintf(cookie, "steamLogin=%s||oauth:%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", @@ -40,24 +32,17 @@ public: AddHeader("Cookie", cookie); - this - << CHAR_PARAM("sessionID", sessionId) - << CHAR_PARAM("id", who) - << CHAR_PARAM("perform", "ignore") - << CHAR_PARAM("action", "approvePending") - << CHAR_PARAM("itype", "friend") - << INT_PARAM("json", 1) - << INT_PARAM("xml", 0); + this << CHAR_PARAM("sessionID", sessionId) << CHAR_PARAM("id", who) << CHAR_PARAM("perform", "ignore") + << CHAR_PARAM("action", "approvePending") << CHAR_PARAM("itype", "friend") << INT_PARAM("json", 1) << INT_PARAM("xml", 0); } }; -class BlockPendingRequest : public HttpRequest +struct BlockPendingRequest : public HttpRequest { -public: - BlockPendingRequest(const char *token, const char *sessionId, const char *steamId, const char *who) : + BlockPendingRequest(const char *token, const char *sessionId, int64_t steamId, const char *who) : HttpRequest(REQUEST_POST, "") { - m_szUrl.Format(STEAM_WEB_URL "/profiles/%s/home_process", steamId); + m_szUrl.Format(STEAM_WEB_URL "/profiles/%lld/home_process", steamId); char cookie[MAX_PATH]; mir_snprintf(cookie, "steamLogin=%s||oauth:%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", @@ -65,14 +50,8 @@ public: AddHeader("Cookie", cookie); - this - << CHAR_PARAM("sessionID", sessionId) - << CHAR_PARAM("id", who) - << CHAR_PARAM("perform", "block") - << CHAR_PARAM("action", "approvePending") - << CHAR_PARAM("itype", "friend") - << INT_PARAM("json", 1) - << INT_PARAM("xml", 0); + this << CHAR_PARAM("sessionID", sessionId) << CHAR_PARAM("id", who) << CHAR_PARAM("perform", "block") + << CHAR_PARAM("action", "approvePending") << CHAR_PARAM("itype", "friend") << INT_PARAM("json", 1) << INT_PARAM("xml", 0); } }; diff --git a/protocols/Steam/src/api/rsa_key.h b/protocols/Steam/src/api/rsa_key.h deleted file mode 100644 index 48c76e3e6d..0000000000 --- a/protocols/Steam/src/api/rsa_key.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _STEAM_REQUEST_RSA_KEY_H_ -#define _STEAM_REQUEST_RSA_KEY_H_ - -class GetRsaKeyRequest : public HttpRequest -{ -public: - GetRsaKeyRequest(const char *username) : - HttpRequest(REQUEST_POST, STEAM_WEB_URL "/mobilelogin/getrsakey/") - { - flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP; - - this - << CHAR_PARAM("username", username) - << INT64_PARAM("donotcache", now()); - } -}; - -#endif //_STEAM_REQUEST_RSA_KEY_H_ diff --git a/protocols/Steam/src/api/search.h b/protocols/Steam/src/api/search.h index d72d140dc5..64ff7e828f 100644 --- a/protocols/Steam/src/api/search.h +++ b/protocols/Steam/src/api/search.h @@ -1,19 +1,13 @@ #ifndef _STEAM_REQUEST_SEARCH_H_ #define _STEAM_REQUEST_SEARCH_H_ -class SearchRequest : public HttpRequest +struct SearchRequest : public HttpRequest { -public: SearchRequest(const char *token, const char *text, int offset = 0, int count = 30) : HttpRequest(REQUEST_GET, "/ISteamUserOAuth/Search/v0001") { - this - << CHAR_PARAM("access_token", token) - << CHAR_PARAM("keywords", text) - << INT_PARAM("offset", offset) - << INT_PARAM("count", count) - << CHAR_PARAM("targets", "users") - << CHAR_PARAM("fields", "all"); + this << CHAR_PARAM("access_token", token) << CHAR_PARAM("keywords", text) << INT_PARAM("offset", offset) + << INT_PARAM("count", count) << CHAR_PARAM("targets", "users") << CHAR_PARAM("fields", "all"); } //{ -- cgit v1.2.3