summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/Steam/src/steam_account.cpp17
-rw-r--r--protocols/Steam/src/steam_contacts.cpp36
-rw-r--r--protocols/Steam/src/steam_messages.cpp2
-rw-r--r--protocols/Steam/src/steam_pooling.cpp8
-rw-r--r--protocols/Steam/src/version.h2
5 files changed, 48 insertions, 17 deletions
diff --git a/protocols/Steam/src/steam_account.cpp b/protocols/Steam/src/steam_account.cpp
index 7bf2645fe9..d565293ccb 100644
--- a/protocols/Steam/src/steam_account.cpp
+++ b/protocols/Steam/src/steam_account.cpp
@@ -41,6 +41,8 @@ void CSteamProto::OnGotRsaKey(const NETLIBHTTPREQUEST *response, void *arg)
ptrA base64RsaEncryptedPassword;
ptrA password(getStringA("Password"));
+ json_delete(root);
+
DWORD error = 0;
DWORD encryptedSize = 0;
DWORD passwordSize = (DWORD)strlen(password);
@@ -88,6 +90,7 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg)
{
ShowNotification(TranslateTS(message));
SetStatus(ID_STATUS_OFFLINE);
+ json_delete(root);
return;
}
@@ -108,8 +111,10 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg)
MAKEINTRESOURCE(IDD_GUARD),
NULL,
CSteamProto::GuardProc,
- (LPARAM)&guard) != 1)
+ (LPARAM)&guard) != 1) {
+ json_delete(root);
return;
+ }
ptrA username(mir_urlEncode(ptrA(mir_utf8encodeW(getWStringA("Username")))));
ptrA base64RsaEncryptedPassword(getStringA("EncryptedPassword"));
@@ -153,6 +158,7 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg)
if (res != 1)
{
SetStatus(ID_STATUS_OFFLINE);
+ json_delete(root);
return;
}
@@ -165,6 +171,7 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg)
&CSteamProto::OnAuthorization);
}
+ json_delete(root);
return;
}
@@ -172,9 +179,12 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg)
if (!json_as_bool(node))
{
SetStatus(ID_STATUS_OFFLINE);
+ json_delete(root);
return;
}
+ json_delete(root);
+
node = json_get(root, "oauth");
root = json_parse(ptrA(mir_u2a(json_as_string(node))));
@@ -192,6 +202,8 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg)
delSetting("Timestamp");
delSetting("EncryptedPassword");
+ json_delete(root);
+
PushRequest(
new SteamWebApi::GetSessionRequest(token, steamId, cookie),
&CSteamProto::OnGotSession);
@@ -241,6 +253,7 @@ void CSteamProto::OnLoggedOn(const NETLIBHTTPREQUEST *response, void *arg)
// set status to offline
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_CONNECTING, ID_STATUS_OFFLINE);
+ json_delete(root);
return;
}
@@ -250,6 +263,8 @@ void CSteamProto::OnLoggedOn(const NETLIBHTTPREQUEST *response, void *arg)
node = json_get(root, "message");
setDword("MessageID", json_as_int(node));
+ json_delete(root);
+
// load contact list
ptrA token(getStringA("TokenSecret"));
ptrA steamId(getStringA("SteamID"));
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp
index 630241dcd7..294ba8ba5c 100644
--- a/protocols/Steam/src/steam_contacts.cpp
+++ b/protocols/Steam/src/steam_contacts.cpp
@@ -236,6 +236,8 @@ void CSteamProto::OnGotFriendList(const NETLIBHTTPREQUEST *response, void *arg)
}
}
+ json_delete(root);
+
if (!steamIds.empty())
{
steamIds.pop_back();
@@ -260,12 +262,12 @@ void CSteamProto::OnGotBlockList(const NETLIBHTTPREQUEST *response, void *arg)
//std::string steamIds;
node = json_get(root, "friends");
- root = json_as_array(node);
- if (root != NULL)
+ JSONNODE *nroot = json_as_array(node);
+ if (nroot != NULL)
{
- for (size_t i = 0; i < json_size(root); i++)
+ for (size_t i = 0; i < json_size(nroot); i++)
{
- child = json_at(root, i);
+ child = json_at(nroot, i);
if (child == NULL)
break;
@@ -289,6 +291,8 @@ void CSteamProto::OnGotBlockList(const NETLIBHTTPREQUEST *response, void *arg)
else continue;
}
}
+
+ json_delete(root);
}
void CSteamProto::OnGotUserSummaries(const NETLIBHTTPREQUEST *response, void *arg)
@@ -299,12 +303,12 @@ void CSteamProto::OnGotUserSummaries(const NETLIBHTTPREQUEST *response, void *ar
JSONNODE *root = json_parse(response->pData), *node, *item;
node = json_get(root, "players");
- root = json_as_array(node);
- if (root != NULL)
+ JSONNODE *nroot = json_as_array(node);
+ if (nroot != NULL)
{
- for (size_t i = 0; i < json_size(root); i++)
+ for (size_t i = 0; i < json_size(nroot); i++)
{
- item = json_at(root, i);
+ item = json_at(nroot, i);
if (item == NULL)
break;
@@ -318,6 +322,8 @@ void CSteamProto::OnGotUserSummaries(const NETLIBHTTPREQUEST *response, void *ar
UpdateContact(hContact, item);
}
}
+
+ json_delete(root);
}
void CSteamProto::OnGotAvatar(const NETLIBHTTPREQUEST *response, void *arg)
@@ -394,17 +400,17 @@ void CSteamProto::OnAuthRequested(const NETLIBHTTPREQUEST *response, void *arg)
JSONNODE *root = json_parse(response->pData), *node;
node = json_get(root, "players");
- root = json_at(json_as_array(node), 0);
- if (root != NULL)
+ JSONNODE *nroot = json_at(json_as_array(node), 0);
+ if (nroot != NULL)
{
- node = json_get(root, "steamid");
+ node = json_get(nroot, "steamid");
ptrA steamId(mir_u2a(json_as_string(node)));
MCONTACT hContact = FindContact(steamId);
if (!hContact)
hContact = AddContact(steamId);
- UpdateContact(hContact, root);
+ UpdateContact(hContact, nroot);
char *nickName = getStringA(hContact, "Nick");
char *firstName = getStringA(hContact, "FirstName");
@@ -439,6 +445,8 @@ void CSteamProto::OnAuthRequested(const NETLIBHTTPREQUEST *response, void *arg)
AddDBEvent(hContact, EVENTTYPE_AUTHREQUEST, time(NULL), DBEF_UTF, cbBlob, pBlob);
}
+
+ json_delete(root);
}
void CSteamProto::OnPendingApproved(const NETLIBHTTPREQUEST *response, void *arg)
@@ -456,6 +464,8 @@ void CSteamProto::OnPendingApproved(const NETLIBHTTPREQUEST *response, void *arg
node = json_get(root, "error_text");
debugLogA("CSteamProto::OnPendingApproved: failed to approve pending from %s (%s)", ptrA((char*)arg), ptrA(mir_utf8encodeW(json_as_string(node))));
}
+
+ json_delete(root);
}
void CSteamProto::OnPendingIgnoreded(const NETLIBHTTPREQUEST *response, void *arg)
@@ -473,6 +483,8 @@ void CSteamProto::OnPendingIgnoreded(const NETLIBHTTPREQUEST *response, void *ar
node = json_get(root, "error_text");
debugLogA("CSteamProto::OnPendingApproved: failed to ignore pending from %s (%s)", ptrA((char*)arg), ptrA(mir_utf8encodeW(json_as_string(node))));
}
+
+ json_delete(root);
}
void CSteamProto::OnSearchByIdEnded(const NETLIBHTTPREQUEST *response, void *arg)
diff --git a/protocols/Steam/src/steam_messages.cpp b/protocols/Steam/src/steam_messages.cpp
index 5ae78e726c..9cd76f3b0f 100644
--- a/protocols/Steam/src/steam_messages.cpp
+++ b/protocols/Steam/src/steam_messages.cpp
@@ -31,6 +31,8 @@ void CSteamProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg)
result = true;
else
debugLogA("CSteamProto::OnMessageSent: failed to send message for %s (%s)", steamId, error);
+
+ json_delete(root);
}
else
debugLogA("CSteamProto::OnMessageSent: failed to send message for %s", steamId);
diff --git a/protocols/Steam/src/steam_pooling.cpp b/protocols/Steam/src/steam_pooling.cpp
index 93ef78e726..15d39f8cbe 100644
--- a/protocols/Steam/src/steam_pooling.cpp
+++ b/protocols/Steam/src/steam_pooling.cpp
@@ -198,15 +198,16 @@ void CSteamProto::PollingThread(void*)
messageId = json_as_int(node);
node = json_get(root, "messages");
- root = json_as_array(node);
+ JSONNODE *nroot = json_as_array(node);
- if (root != NULL)
- ParsePollData(root);
+ if (nroot != NULL)
+ ParsePollData(nroot);
m_pollingConnection = response->nlc;
}
else if (!lstrcmpi(error, L"Timeout"))
{
+ json_delete(root);
continue;
}
else if (!lstrcmpi(error, L"Not Logged On"))
@@ -233,6 +234,7 @@ void CSteamProto::PollingThread(void*)
breaked = true;
}
+ json_delete(root);
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response);
}
diff --git a/protocols/Steam/src/version.h b/protocols/Steam/src/version.h
index a80211efcb..065a552217 100644
--- a/protocols/Steam/src/version.h
+++ b/protocols/Steam/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 11
#define __RELEASE_NUM 0
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#include <stdver.h>