summaryrefslogtreecommitdiff
path: root/protocols/Steam/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Steam/src')
-rw-r--r--protocols/Steam/src/api/authorization.h1
-rw-r--r--protocols/Steam/src/http_request.h9
-rw-r--r--protocols/Steam/src/steam_contacts.cpp22
-rw-r--r--protocols/Steam/src/steam_login.cpp8
-rw-r--r--protocols/Steam/src/steam_messages.cpp2
-rw-r--r--protocols/Steam/src/steam_pooling.cpp2
6 files changed, 27 insertions, 17 deletions
diff --git a/protocols/Steam/src/api/authorization.h b/protocols/Steam/src/api/authorization.h
index 1b9e389685..af0cdd4bf6 100644
--- a/protocols/Steam/src/api/authorization.h
+++ b/protocols/Steam/src/api/authorization.h
@@ -11,6 +11,7 @@ public:
AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
AddHeader("Referer", STEAM_WEB_URL "/mobilelogin/dologin?oauth_client_id=3638BFB1&oauth_scope=read_profile%20write_profile%20read_client%20write_client");
+ AddHeader("Cookie", "mobileClientVersion=1291812;forceMobile=1;mobileClient=ios");
CMStringA data;
data.AppendFormat("password=%s&username=%s&twofactorcode=%s&emailauth=%s&loginfriendlyname=%s&oauth_client_id=3638BFB1&captchagid=%s&captcha_text=%s&emailsteamid=%s&rsatimestamp=%s&rememberlogin=false&donotcache=%lld",
diff --git a/protocols/Steam/src/http_request.h b/protocols/Steam/src/http_request.h
index 89e76e8ac2..126aa857f0 100644
--- a/protocols/Steam/src/http_request.h
+++ b/protocols/Steam/src/http_request.h
@@ -3,12 +3,16 @@
class HttpResponse : public NETLIBHTTPREQUEST, public MZeroedObject
{
+private:
+ bool isEmptyResponse;
+
public:
const NETLIBHTTPREQUEST* request;
HttpResponse(const NETLIBHTTPREQUEST* response, const NETLIBHTTPREQUEST* request = NULL)
{
request = request;
+ isEmptyResponse = (response == NULL);
if (response)
{
cbSize = response->cbSize;
@@ -32,6 +36,11 @@ public:
}
}
+ bool const operator !() const
+ {
+ return isEmptyResponse;
+ }
+
~HttpResponse()
{
for (int i = 0; i < headersCount; i++)
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp
index 3766a81611..85c2dc2fd6 100644
--- a/protocols/Steam/src/steam_contacts.cpp
+++ b/protocols/Steam/src/steam_contacts.cpp
@@ -357,7 +357,7 @@ void CSteamProto::ProcessContact(std::map<std::string, JSONNode*>::iterator *it,
void CSteamProto::OnGotFriendList(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL)
+ if (!response)
return;
JSONROOT root(response->pData);
@@ -442,7 +442,7 @@ void CSteamProto::OnGotFriendList(const NETLIBHTTPREQUEST *response)
void CSteamProto::OnGotBlockList(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL)
+ if (!response)
return;
JSONROOT root(response->pData);
@@ -486,7 +486,7 @@ void CSteamProto::OnGotBlockList(const NETLIBHTTPREQUEST *response)
void CSteamProto::OnGotUserSummaries(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL)
+ if (!response)
return;
JSONROOT root(response->pData);
@@ -525,7 +525,7 @@ void CSteamProto::OnGotAvatar(const NETLIBHTTPREQUEST *response, void *arg)
ai.hContact = (UINT_PTR)arg;
GetDbAvatarInfo(ai);
- if (response == NULL || response->resultCode != HTTP_CODE_OK)
+ if (!response || response->resultCode != HTTP_CODE_OK)
{
ptrA steamId(getStringA(ai.hContact, "SteamID"));
debugLogA("CSteamProto::OnGotAvatar: failed to get avatar %s", steamId);
@@ -552,7 +552,7 @@ void CSteamProto::OnFriendAdded(const NETLIBHTTPREQUEST *response, void *arg)
{
SendAuthParam *param = (SendAuthParam*)arg;
- if (response == NULL || response->resultCode != HTTP_CODE_OK || lstrcmpiA(response->pData, "true"))
+ if (!response || response->resultCode != HTTP_CODE_OK || lstrcmpiA(response->pData, "true"))
{
ptrA steamId(getStringA(param->hContact, "SteamID"));
debugLogA("CSteamProto::OnFriendAdded: failed to add friend %s", steamId);
@@ -571,7 +571,7 @@ void CSteamProto::OnFriendAdded(const NETLIBHTTPREQUEST *response, void *arg)
void CSteamProto::OnFriendBlocked(const NETLIBHTTPREQUEST *response, void *arg)
{
- if (response == NULL || response->resultCode != HTTP_CODE_OK || lstrcmpiA(response->pData, "true"))
+ if (!response || response->resultCode != HTTP_CODE_OK || lstrcmpiA(response->pData, "true"))
{
debugLogA("CSteamProto::OnFriendIgnored: failed to ignore friend %s", (char*)arg);
return;
@@ -580,7 +580,7 @@ void CSteamProto::OnFriendBlocked(const NETLIBHTTPREQUEST *response, void *arg)
void CSteamProto::OnFriendRemoved(const NETLIBHTTPREQUEST *response, void *arg)
{
- if (response == NULL || response->resultCode != HTTP_CODE_OK || lstrcmpiA(response->pData, "true"))
+ if (!response || response->resultCode != HTTP_CODE_OK || lstrcmpiA(response->pData, "true"))
{
MCONTACT hContact = (UINT_PTR)arg;
ptrA who(getStringA(hContact, "SteamID"));
@@ -592,7 +592,7 @@ void CSteamProto::OnFriendRemoved(const NETLIBHTTPREQUEST *response, void *arg)
void CSteamProto::OnAuthRequested(const NETLIBHTTPREQUEST *response, void *arg)
{
- if (response == NULL || response->resultCode != HTTP_CODE_OK)
+ if (!response || response->resultCode != HTTP_CODE_OK)
{
debugLogA("CSteamProto::OnAuthRequested: failed to request info for %s", (char*)arg);
return;
@@ -656,7 +656,7 @@ void CSteamProto::OnAuthRequested(const NETLIBHTTPREQUEST *response, void *arg)
void CSteamProto::OnPendingApproved(const NETLIBHTTPREQUEST *response, void *arg)
{
- if (response == NULL || response->resultCode != HTTP_CODE_OK)
+ if (!response || response->resultCode != HTTP_CODE_OK)
{
debugLogA("CSteamProto::OnPendingApproved: failed to approve pending from %s", (char*)arg);
return;
@@ -676,7 +676,7 @@ void CSteamProto::OnPendingApproved(const NETLIBHTTPREQUEST *response, void *arg
void CSteamProto::OnPendingIgnoreded(const NETLIBHTTPREQUEST *response, void *arg)
{
- if (response == NULL || response->resultCode != HTTP_CODE_OK)
+ if (!response || response->resultCode != HTTP_CODE_OK)
{
debugLogA("CSteamProto::OnPendingApproved: failed to ignore pending from %s", (char*)arg);
return;
@@ -696,7 +696,7 @@ void CSteamProto::OnPendingIgnoreded(const NETLIBHTTPREQUEST *response, void *ar
void CSteamProto::OnSearchByIdEnded(const NETLIBHTTPREQUEST *response, void *arg)
{
- if (response == NULL || response->resultCode != HTTP_CODE_OK)
+ if (!response || response->resultCode != HTTP_CODE_OK)
{
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE)STEAM_SEARCH_BYID, 0);
debugLogA("CSteamProto::OnSearchByIdEnded: failed to get summaries for %s", (char*)arg);
diff --git a/protocols/Steam/src/steam_login.cpp b/protocols/Steam/src/steam_login.cpp
index cddd0204e3..3b209d97de 100644
--- a/protocols/Steam/src/steam_login.cpp
+++ b/protocols/Steam/src/steam_login.cpp
@@ -16,7 +16,7 @@ bool CSteamProto::IsMe(const char *steamId)
void CSteamProto::OnGotRsaKey(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL)
+ if (!response)
return;
// load rsa key parts
@@ -75,7 +75,7 @@ void CSteamProto::OnGotRsaKey(const NETLIBHTTPREQUEST *response)
void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL)
+ if (!response)
{
SetStatus(ID_STATUS_OFFLINE);
return;
@@ -229,7 +229,7 @@ void CSteamProto::OnAuthorizationSuccess(const JSONNode &node)
void CSteamProto::OnGotSession(const NETLIBHTTPREQUEST *response)
{
- if(response == NULL)
+ if(!response)
return;
for (int i = 0; i < response->headersCount; i++)
@@ -260,7 +260,7 @@ void CSteamProto::HandleTokenExpired()
void CSteamProto::OnLoggedOn(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL)
+ if (!response)
{
// Probably timeout or no connection, we can do nothing here
SetStatus(ID_STATUS_OFFLINE);
diff --git a/protocols/Steam/src/steam_messages.cpp b/protocols/Steam/src/steam_messages.cpp
index fc49c7b0e8..c8a1813b84 100644
--- a/protocols/Steam/src/steam_messages.cpp
+++ b/protocols/Steam/src/steam_messages.cpp
@@ -41,7 +41,7 @@ void CSteamProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg)
ptrT error(mir_tstrdup(TranslateT("Unknown error")));
ptrT steamId(getTStringA(param->hContact, "SteamID"));
- if (response != NULL && response->resultCode == HTTP_CODE_OK)
+ if (response && response->resultCode == HTTP_CODE_OK)
{
JSONROOT root(response->pData);
JSONNode *node = json_get(root, "error");
diff --git a/protocols/Steam/src/steam_pooling.cpp b/protocols/Steam/src/steam_pooling.cpp
index 0c1f50e9fd..2dee4115d8 100644
--- a/protocols/Steam/src/steam_pooling.cpp
+++ b/protocols/Steam/src/steam_pooling.cpp
@@ -180,7 +180,7 @@ void CSteamProto::PollingThread(void*)
HttpResponse *response = request->Send(m_hNetlibUser);
delete request;
- if (response == NULL || response->resultCode != HTTP_CODE_OK)
+ if (!response || response->resultCode != HTTP_CODE_OK)
{
if (response != NULL)
delete response;