summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/api/message.h
blob: 77adb4a2400a282dcd8c0bc510bda77ff88c0254 (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
#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, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Message/v0001")
	{
		CMStringA data;
		data.AppendFormat("access_token=%s&umqid=%s&steamid_dst=%s&type=saytext&text=%s",
			token,
			umqId,
			steamId,
			ptrA(mir_urlEncode(text)));

		SetData(data, data.GetLength());
		AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
	}
};

class SendTypingRequest : public HttpRequest
{
public:
	SendTypingRequest(const char *token, const char *umqId, const char *steamId) :
		HttpRequest(REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Message/v0001")
	{
		CMStringA data;
		data.AppendFormat("access_token=%s&umqid=%s&steamid_dst=%s&type=typing",
			token,
			umqId,
			steamId);

		SetData(data, data.GetLength());
		AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
	}
};

#endif //_STEAM_REQUEST_MESSAGE_H_