summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/api/friend_list.h
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-05-26 19:15:20 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-05-26 19:15:20 +0000
commitab75f8e4a3968c956425844415237a4fa6fcee63 (patch)
treedf2c209dd0197dc3085546606b0581d63f9114ad /protocols/Steam/src/api/friend_list.h
parent4e9e885747b2037c81ce809f7f6505f8bc8b0e2f (diff)
Steam: merge new api
git-svn-id: http://svn.miranda-ng.org/main/trunk@13850 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Steam/src/api/friend_list.h')
-rw-r--r--protocols/Steam/src/api/friend_list.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/protocols/Steam/src/api/friend_list.h b/protocols/Steam/src/api/friend_list.h
new file mode 100644
index 0000000000..4c1d6f8ef2
--- /dev/null
+++ b/protocols/Steam/src/api/friend_list.h
@@ -0,0 +1,88 @@
+#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 = "friend,ignoredfriend,requestrecipient") :
+ HttpRequest(REQUEST_GET, STEAM_API_URL "/ISteamUserOAuth/GetFriendList/v0001")
+ {
+ AddParameter("access_token", token);
+ AddParameter("steamid", steamId);
+ AddParameter("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, SIZEOF(login), "%s||oauth:%s", steamId, token);
+
+ char cookie[MAX_PATH];
+ mir_snprintf(cookie, SIZEOF(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
+
+ char data[128];
+ mir_snprintf(data, SIZEOF(data),
+ "sessionID=%s&steamid=%s",
+ sessionId,
+ who);
+
+ SetData(data, strlen(data));
+ AddHeader("Cookie", cookie);
+ AddHeader("Content-Type", "application/x-www-form-urlencoded");
+ }
+};
+
+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, SIZEOF(login), "%s||oauth:%s", steamId, token);
+
+ char cookie[MAX_PATH];
+ mir_snprintf(cookie, SIZEOF(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
+
+ char data[128];
+ mir_snprintf(data, SIZEOF(data),
+ "sessionID=%s&action=ignore&steamid=%s",
+ sessionId,
+ who);
+
+ SetData(data, strlen(data));
+ AddHeader("Cookie", cookie);
+ AddHeader("Content-Type", "application/x-www-form-urlencoded");
+ }
+};
+
+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, SIZEOF(login), "%s||oauth:%s", steamId, token);
+
+ char cookie[MAX_PATH];
+ mir_snprintf(cookie, SIZEOF(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
+
+ char data[128];
+ mir_snprintf(data, SIZEOF(data),
+ "sessionID=%s&steamid=%s",
+ sessionId,
+ who);
+
+ SetData(data, strlen(data));
+ AddHeader("Cookie", cookie);
+ AddHeader("Content-Type", "application/x-www-form-urlencoded");
+ }
+};
+
+#endif //_STEAM_REQUEST_FRIEND_LIST_H_