summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/api/pending.h
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2017-12-28 21:21:10 +0300
committeraunsane <aunsane@gmail.com>2017-12-28 21:21:28 +0300
commit0156ed41dceeef48f070adf67f14d4ba4c4f6d61 (patch)
treed0e1dca4c2c9c3c056ae9cb69dde10ea59316481 /protocols/Steam/src/api/pending.h
parentf0075f2b956969f29acd3bc9289c8a5f78faddad (diff)
Steam: refactoring
- reworking http requests - added ability to get game name by appid - another attempt to fix #633 - minor refactoring
Diffstat (limited to 'protocols/Steam/src/api/pending.h')
-rw-r--r--protocols/Steam/src/api/pending.h48
1 files changed, 30 insertions, 18 deletions
diff --git a/protocols/Steam/src/api/pending.h b/protocols/Steam/src/api/pending.h
index 7c1964b6c5..a808fd172c 100644
--- a/protocols/Steam/src/api/pending.h
+++ b/protocols/Steam/src/api/pending.h
@@ -5,7 +5,7 @@ class ApprovePendingRequest : public HttpRequest
{
public:
ApprovePendingRequest(const char *token, const char *sessionId, const char *steamId, const char *who) :
- HttpRequest(REQUEST_POST, FORMAT, STEAM_WEB_URL "/profiles/%s/home_process", steamId)
+ HttpRequest(HttpPost, FORMAT, STEAM_WEB_URL "/profiles/%s/home_process", steamId)
{
char login[MAX_PATH];
mir_snprintf(login, "%s||oauth:%s", steamId, token);
@@ -13,12 +13,16 @@ public:
char cookie[MAX_PATH];
mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId);
- char data[MAX_PATH];
- mir_snprintf(data, "sessionID=%s&id=%s&perform=accept&action=approvePending&itype=friend&json=1&xml=0", sessionId, who);
+ Headers << CHAR_PARAM("Cookie", cookie);
- SetData(data, strlen(data));
- AddHeader("Cookie", cookie);
- AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
+ 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);
}
};
@@ -26,7 +30,7 @@ class IgnorePendingRequest : public HttpRequest
{
public:
IgnorePendingRequest(const char *token, const char *sessionId, const char *steamId, const char *who) :
- HttpRequest(REQUEST_POST, FORMAT, STEAM_WEB_URL "/profiles/%s/home_process", steamId)
+ HttpRequest(HttpPost, FORMAT, STEAM_WEB_URL "/profiles/%s/home_process", steamId)
{
char login[MAX_PATH];
mir_snprintf(login, "%s||oauth:%s", steamId, token);
@@ -34,12 +38,16 @@ public:
char cookie[MAX_PATH];
mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId);
- char data[MAX_PATH];
- mir_snprintf(data, "sessionID=%s&id=%s&perform=ignore&action=approvePending&itype=friend&json=1&xml=0", sessionId, who);
+ Headers << CHAR_PARAM("Cookie", cookie);
- SetData(data, strlen(data));
- AddHeader("Cookie", cookie);
- AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
+ 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);
}
};
@@ -47,7 +55,7 @@ class BlockPendingRequest : public HttpRequest
{
public:
BlockPendingRequest(const char *token, const char *sessionId, const char *steamId, const char *who) :
- HttpRequest(REQUEST_POST, FORMAT, STEAM_WEB_URL "/profiles/%s/home_process", steamId)
+ HttpRequest(HttpPost, FORMAT, STEAM_WEB_URL "/profiles/%s/home_process", steamId)
{
char login[MAX_PATH];
mir_snprintf(login, "%s||oauth:%s", steamId, token);
@@ -55,12 +63,16 @@ public:
char cookie[MAX_PATH];
mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId);
- char data[MAX_PATH];
- mir_snprintf(data, "sessionID=%s&id=%s&perform=block&action=approvePending&itype=friend&json=1&xml=0", sessionId, who);
+ Headers << CHAR_PARAM("Cookie", cookie);
- SetData(data, strlen(data));
- AddHeader("Cookie", cookie);
- AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
+ 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);
}
};