diff options
Diffstat (limited to 'protocols/Steam/src/api')
-rw-r--r-- | protocols/Steam/src/api/app_info.h | 26 | ||||
-rw-r--r-- | protocols/Steam/src/api/avatar.h | 14 | ||||
-rw-r--r-- | protocols/Steam/src/api/captcha.h | 3 | ||||
-rw-r--r-- | protocols/Steam/src/api/enums.h | 121 | ||||
-rw-r--r-- | protocols/Steam/src/api/friend.h | 7 | ||||
-rw-r--r-- | protocols/Steam/src/api/friend_list.h | 86 | ||||
-rw-r--r-- | protocols/Steam/src/api/history.h | 44 | ||||
-rw-r--r-- | protocols/Steam/src/api/message.h | 33 | ||||
-rw-r--r-- | protocols/Steam/src/api/pending.h | 51 | ||||
-rw-r--r-- | protocols/Steam/src/api/rsa_key.h | 18 | ||||
-rw-r--r-- | protocols/Steam/src/api/search.h | 12 |
11 files changed, 70 insertions, 345 deletions
diff --git a/protocols/Steam/src/api/app_info.h b/protocols/Steam/src/api/app_info.h deleted file mode 100644 index d2ef0df532..0000000000 --- a/protocols/Steam/src/api/app_info.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _STEAM_REQUEST_APP_INFO_H_ -#define _STEAM_REQUEST_APP_INFO_H_ - -class GetAppInfoRequest : public HttpRequest -{ -public: - GetAppInfoRequest(const char *token, const char *appIds) : - HttpRequest(REQUEST_GET, "/ISteamGameOAuth/GetAppInfo/v0001") - { - this << CHAR_PARAM("access_token", token) << CHAR_PARAM("appIds", appIds); - } - - //{ - // "apps": [ - // { - // "appid": 271590, - // "name" : "Grand Theft Auto V", - // "iconurl" : "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/apps/271590/1e72f87eb927fa1485e68aefaff23c7fd7178251.jpg", - // "logourl" : "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/apps/271590/e447e82f8b0c67f9e001498503c62f2a187bc609.jpg", - // "logosmallurl" : "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/apps/271590/e447e82f8b0c67f9e001498503c62f2a187bc609_thumb.jpg" - // } - // ] - //} -}; - -#endif //_STEAM_REQUEST_APP_INFO_H_ diff --git a/protocols/Steam/src/api/avatar.h b/protocols/Steam/src/api/avatar.h deleted file mode 100644 index 28e573d9d1..0000000000 --- a/protocols/Steam/src/api/avatar.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _STEAM_REQUEST_AVATAR_H_
-#define _STEAM_REQUEST_AVATAR_H_
-
-class GetAvatarRequest : public HttpRequest
-{
-public:
- GetAvatarRequest(const char *url) :
- HttpRequest(REQUEST_GET, url)
- {
- flags = NLHRF_HTTP11 | NLHRF_NODUMP;
- }
-};
-
-#endif //_STEAM_REQUEST_AVATAR_H_
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/enums.h b/protocols/Steam/src/api/enums.h index 2cf767e37f..66626da535 100644 --- a/protocols/Steam/src/api/enums.h +++ b/protocols/Steam/src/api/enums.h @@ -1,88 +1,63 @@ #ifndef _STEAM_ENUMS_H_
#define _STEAM_ENUMS_H_
-enum VisibilityState
+namespace FriendRelationship
{
- Private = 1,
- FriendsOnly = 2,
- FriendsOfFriends = 3,
- UsersOnly = 4,
- Public = 5,
-};
-
-enum PersonaState
-{
- Offline = 0,
- Online = 1,
- Busy = 2,
- Away = 3,
- Snooze = 4,
- LookingToTrade = 5,
- LookingToPlay = 6,
- Invisible = 7,
-};
-
-enum class PersonaStateFlag : int
-{
- None = 0,
- HasRichPresence = 1,
- InJoinableGame = 2,
- ClientTypeWeb = 256,
- ClientTypeMobile = 512,
- ClientTypeBigPicture = 1024,
- ClientTypeVR = 2048,
-};
-
-inline PersonaStateFlag operator &(PersonaStateFlag lhs, PersonaStateFlag rhs)
-{
- return static_cast<PersonaStateFlag> (
- static_cast<std::underlying_type<PersonaStateFlag>::type>(lhs) &
- static_cast<std::underlying_type<PersonaStateFlag>::type>(rhs));
+ enum {
+ None = 0,
+ Blocked = 1,
+ RequestRecipient = 2,
+ Friend = 3,
+ RequestInitiator = 4,
+ Ignored = 5,
+ IgnoredFriend = 6,
+ };
}
-enum class PersonaStatusFlag : int
+namespace PersonaState
{
- Status = 1,
- PlayerName = 2,
- QueryPort = 4,
- SourceID = 8,
- Presence = 16,
- Metadata = 32,
- LastSeen = 64,
- ClanInfo = 128,
- GameExtraInfo = 256,
- GameDataBlob = 512,
- ClanTag = 1024,
- Facebook = 2048,
- Unknown = 4096,
-};
+ enum {
+ Offline = 0,
+ Online = 1,
+ Busy = 2,
+ Away = 3,
+ Snooze = 4,
+ LookingToTrade = 5,
+ LookingToPlay = 6,
+ Invisible = 7,
+ };
+}
-inline PersonaStatusFlag operator &(PersonaStatusFlag lhs, PersonaStatusFlag rhs)
+namespace PersonaStateFlag
{
- return static_cast<PersonaStatusFlag> (
- static_cast<std::underlying_type<PersonaStatusFlag>::type>(lhs) &
- static_cast<std::underlying_type<PersonaStatusFlag>::type>(rhs));
+ enum {
+ None = 0,
+ HasRichPresence = 1,
+ InJoinableGame = 2,
+ ClientTypeWeb = 256,
+ ClientTypeMobile = 512,
+ ClientTypeBigPicture = 1024,
+ ClientTypeVR = 2048,
+ };
}
-enum class PersonaRelationshipAction : int
+namespace PersonaStatusFlag
{
- // friend removed from contact list
- Remove = 0,
- // friend added you to ignore list
- Ignore = 1,
- // friend requested auth
- AuthRequest = 2,
- // friend added you to contact list
- AddToList = 3,
- // friend got (or approved?) your auth request
- AuthRequested = 4,
-};
-
-template<typename T>
-bool contains_flag(T x, T y) {
- return (static_cast<typename std::underlying_type<T>::type>(x)
- & static_cast<typename std::underlying_type<T>::type>(y))
- == static_cast<typename std::underlying_type<T>::type>(y);
+ enum {
+ Status = 1,
+ PlayerName = 2,
+ QueryPort = 4,
+ SourceID = 8,
+ Presence = 16,
+ Metadata = 32,
+ LastSeen = 64,
+ ClanInfo = 128,
+ GameExtraInfo = 256,
+ GameDataBlob = 512,
+ ClanTag = 1024,
+ Facebook = 2048,
+ Unknown = 4096,
+ };
}
#endif //_STEAM_ENUMS_H_
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 deleted file mode 100644 index 84d8536bcb..0000000000 --- a/protocols/Steam/src/api/friend_list.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef _STEAM_REQUEST_FRIEND_LIST_H_
-#define _STEAM_REQUEST_FRIEND_LIST_H_
-
-class GetFriendListRequest : public HttpRequest
-{
-public:
- GetFriendListRequest(const char *token, const char *steamId, const char *relationship) :
- HttpRequest(REQUEST_GET, "/ISteamUserOAuth/GetFriendList/v0001")
- {
- this << CHAR_PARAM("access_token", token) << CHAR_PARAM("steamid", steamId) << CHAR_PARAM("relationship", relationship);
- }
-};
-
-class AddFriendRequest : public HttpRequest
-{
-public:
- AddFriendRequest(const char *token, const char *sessionId, const char *steamId, const char *who) :
- HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/AddFriendAjax")
- {
- char login[MAX_PATH];
- mir_snprintf(login, "%s||oauth:%s", steamId, token);
-
- char cookie[MAX_PATH];
- mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId);
-
- AddHeader("Cookie", cookie);
-
- this << CHAR_PARAM("sessionID", sessionId) << CHAR_PARAM("steamid", who);
- }
-};
-
-class BlockFriendRequest : public HttpRequest
-{
-public:
- BlockFriendRequest(const char *token, const char *sessionId, const char *steamId, const char *who) :
- HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/BlockUserAjax")
- {
- char login[MAX_PATH];
- mir_snprintf(login, "%s||oauth:%s", steamId, token);
-
- char cookie[MAX_PATH];
- mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId);
-
- AddHeader("Cookie", cookie);
-
- this << CHAR_PARAM("sessionID", sessionId) << CHAR_PARAM("steamid", who) << CHAR_PARAM("action", "ignore");
- }
-};
-
-class UnblockFriendRequest : public HttpRequest
-{
-public:
- UnblockFriendRequest(const char *token, const char *sessionId, const char *steamId, const char *who) :
- HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/BlockUserAjax")
- {
- char login[MAX_PATH];
- mir_snprintf(login, "%s||oauth:%s", steamId, token);
-
- char cookie[MAX_PATH];
- mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId);
-
- AddHeader("Cookie", cookie);
-
- this << CHAR_PARAM("sessionID", sessionId) << CHAR_PARAM("steamid", who) << CHAR_PARAM("action", "unignore") << INT_PARAM("block", 0);
- }
-};
-
-class RemoveFriendRequest : public HttpRequest
-{
-public:
- RemoveFriendRequest(const char *token, const char *sessionId, const char *steamId, const char *who) :
- HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/RemoveFriendAjax")
- {
- char login[MAX_PATH];
- mir_snprintf(login, "%s||oauth:%s", steamId, token);
-
- char cookie[MAX_PATH];
- mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId);
-
- AddHeader("Cookie", cookie);
-
- this << CHAR_PARAM("sessionID", sessionId) << CHAR_PARAM("steamid", who);
- }
-};
-
-#endif //_STEAM_REQUEST_FRIEND_LIST_H_
diff --git a/protocols/Steam/src/api/history.h b/protocols/Steam/src/api/history.h deleted file mode 100644 index fbc09abed6..0000000000 --- a/protocols/Steam/src/api/history.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef _STEAM_REQUEST_HISTORY_H_ -#define _STEAM_REQUEST_HISTORY_H_ - -class GetConversationsRequest : public HttpRequest -{ -public: - GetConversationsRequest(CSteamProto *ppro) : - HttpRequest(REQUEST_GET, "/IFriendMessagesService/GetActiveMessageSessions/v0001") - { - this << CHAR_PARAM("access_token", ppro->getMStringA("TokenSecret")); - } - - //{ - // "response": { - // "message_sessions": [ - // { - // "accountid_friend": XXXXXXXXX, - // "last_message" : 1514975719, - // "last_view" : 1514975719, - // "unread_message_count" : 0 - // } - // ] - // , - // "timestamp": 1515007542 - // } - //} -}; - -class GetHistoryMessagesRequest : public HttpRequest -{ -public: - GetHistoryMessagesRequest(const char *token, const char *steamId, const char *who, time_t since) : - HttpRequest(REQUEST_GET, "/IFriendMessagesService/GetRecentMessages/v0001") - { - this - << CHAR_PARAM("access_token", token) - << CHAR_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); - } -}; - -#endif //_STEAM_REQUEST_HISTORY_H_ diff --git a/protocols/Steam/src/api/message.h b/protocols/Steam/src/api/message.h deleted file mode 100644 index 934bdc875e..0000000000 --- a/protocols/Steam/src/api/message.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _STEAM_REQUEST_MESSAGE_H_
-#define _STEAM_REQUEST_MESSAGE_H_
-
-class 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);
- }
-};
-
-class 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");
- }
-};
-
-#endif //_STEAM_REQUEST_MESSAGE_H_
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");
}
//{
|