1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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, "%s||oauth:%s", steamId, token);
char cookie[MAX_PATH];
mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId);
char data[128];
mir_snprintf(data, _countof(data),
"sessionID=%s&steamid=%s",
sessionId,
who);
SetData(data, strlen(data));
AddHeader("Cookie", cookie);
AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
}
};
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);
char data[128];
mir_snprintf(data, _countof(data),
"sessionID=%s&action=ignore&steamid=%s",
sessionId,
who);
SetData(data, strlen(data));
AddHeader("Cookie", cookie);
AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
}
};
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);
char data[128];
mir_snprintf(data, _countof(data),
"sessionID=%s&steamid=%s",
sessionId,
who);
SetData(data, strlen(data));
AddHeader("Cookie", cookie);
AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
}
};
#endif //_STEAM_REQUEST_FRIEND_LIST_H_
|