summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/api/pending.h
blob: 9aeed4e1821ac543604c0ad4cd2b7124130f1ca0 (plain)
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
#ifndef _STEAM_REQUEST_PENDING_H_
#define _STEAM_REQUEST_PENDING_H_

class ApprovePendingRequest : public HttpRequest
{
public:
	ApprovePendingRequest(const char *token, const char *sessionId, const char *steamId, const char *who) :
		HttpRequest(HttpPost, FORMAT, STEAM_WEB_URL "/profiles/%s/home_process", steamId)
	{
		char cookie[MAX_PATH];
		mir_snprintf(cookie, "steamLogin=%s||oauth:%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios",
			steamId, token, sessionId);

		Headers << CHAR_PARAM("Cookie", cookie);

		Content = new FormUrlEncodedContent(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
{
public:
	IgnorePendingRequest(const char *token, const char *sessionId, const char *steamId, const char *who) :
		HttpRequest(HttpPost, FORMAT, STEAM_WEB_URL "/profiles/%s/home_process", steamId)
	{
		char cookie[MAX_PATH];
		mir_snprintf(cookie, "steamLogin=%s||oauth:%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios",
			steamId, token, sessionId);

		Headers << CHAR_PARAM("Cookie", cookie);

		Content = new FormUrlEncodedContent(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
{
public:
	BlockPendingRequest(const char *token, const char *sessionId, const char *steamId, const char *who) :
		HttpRequest(HttpPost, FORMAT, STEAM_WEB_URL "/profiles/%s/home_process", steamId)
	{
		char cookie[MAX_PATH];
		mir_snprintf(cookie, "steamLogin=%s||oauth:%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios",
			steamId, token, sessionId);

		Headers << CHAR_PARAM("Cookie", cookie);

		Content = new FormUrlEncodedContent(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);
	}
};

#endif //_STEAM_REQUEST_PENDING_H_