summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/steam_contacts.cpp
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-09-16 17:46:05 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-09-16 17:46:05 +0000
commitab46b98479555c7106087f7d62b6c89f320ca311 (patch)
treee245d3dce9dfabbeb47aaff36135089613abe026 /protocols/Steam/src/steam_contacts.cpp
parentaf54e11be6c1c3c997baae19f9d81526d96cd2aa (diff)
Steam:
- attempt to fix numerous crashes git-svn-id: http://svn.miranda-ng.org/main/trunk@15365 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Steam/src/steam_contacts.cpp')
-rw-r--r--protocols/Steam/src/steam_contacts.cpp35
1 files changed, 19 insertions, 16 deletions
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp
index 03acc8a65f..4d1a2bc498 100644
--- a/protocols/Steam/src/steam_contacts.cpp
+++ b/protocols/Steam/src/steam_contacts.cpp
@@ -96,10 +96,8 @@ MCONTACT CSteamProto::FindContact(const char *steamId)
void CSteamProto::UpdateContact(MCONTACT hContact, JSONNode *data)
{
- JSONNode *node = NULL;
-
// set common data
- node = json_get(data, "personaname");
+ JSONNode *node = json_get(data, "personaname");
setTString(hContact, "Nick", ptrT(json_as_string(node)));
node = json_get(data, "profileurl");
@@ -189,19 +187,24 @@ void CSteamProto::UpdateContact(MCONTACT hContact, JSONNode *data)
WORD status = getWord(hContact, "Status", ID_STATUS_OFFLINE);
if (status == ID_STATUS_ONLINE || status == ID_STATUS_OUTTOLUNCH || status == ID_STATUS_FREECHAT)
setTString(hContact, "MirVer", _T("Steam"));
- } else if (stateflags & 2) {
+ }
+ else if (stateflags & 2) {
// game
setTString(hContact, "MirVer", _T("Steam (in game)"));
- } else if (stateflags & 256) {
+ }
+ else if (stateflags & 256) {
// on website
setTString(hContact, "MirVer", _T("Steam (website)"));
- } else if (stateflags & 512) {
+ }
+ else if (stateflags & 512) {
// on mobile
setTString(hContact, "MirVer", _T("Steam (mobile)"));
- } else if (stateflags & 1024) {
+ }
+ else if (stateflags & 1024) {
// big picture mode
setTString(hContact, "MirVer", _T("Steam (Big Picture)"));
- } else {
+ }
+ else {
// none/unknown (e.g. when contact is offline)
delSetting(hContact, "MirVer");
}
@@ -357,7 +360,7 @@ void CSteamProto::ProcessContact(std::map<std::string, JSONNode*>::iterator *it,
void CSteamProto::OnGotFriendList(const NETLIBHTTPREQUEST *response)
{
- if (!response)
+ if (!CheckResponse(response))
return;
JSONROOT root(response->pData);
@@ -442,7 +445,7 @@ void CSteamProto::OnGotFriendList(const NETLIBHTTPREQUEST *response)
void CSteamProto::OnGotBlockList(const NETLIBHTTPREQUEST *response)
{
- if (!response)
+ if (!CheckResponse(response))
return;
JSONROOT root(response->pData);
@@ -486,7 +489,7 @@ void CSteamProto::OnGotBlockList(const NETLIBHTTPREQUEST *response)
void CSteamProto::OnGotUserSummaries(const NETLIBHTTPREQUEST *response)
{
- if (!response)
+ if (!CheckResponse(response))
return;
JSONROOT root(response->pData);
@@ -525,7 +528,7 @@ void CSteamProto::OnGotAvatar(const NETLIBHTTPREQUEST *response, void *arg)
ai.hContact = (UINT_PTR)arg;
GetDbAvatarInfo(ai);
- if (!response || response->resultCode != HTTP_CODE_OK)
+ if (!ResponseHttpOk(response))
{
ptrA steamId(getStringA(ai.hContact, "SteamID"));
debugLogA("CSteamProto::OnGotAvatar: failed to get avatar %s", steamId);
@@ -592,7 +595,7 @@ void CSteamProto::OnFriendRemoved(const NETLIBHTTPREQUEST *response, void *arg)
void CSteamProto::OnAuthRequested(const NETLIBHTTPREQUEST *response, void *arg)
{
- if (!response || response->resultCode != HTTP_CODE_OK)
+ if (!ResponseHttpOk(response))
{
debugLogA("CSteamProto::OnAuthRequested: failed to request info for %s", (char*)arg);
return;
@@ -656,7 +659,7 @@ void CSteamProto::OnAuthRequested(const NETLIBHTTPREQUEST *response, void *arg)
void CSteamProto::OnPendingApproved(const NETLIBHTTPREQUEST *response, void *arg)
{
- if (!response || response->resultCode != HTTP_CODE_OK)
+ if (!ResponseHttpOk(response))
{
debugLogA("CSteamProto::OnPendingApproved: failed to approve pending from %s", (char*)arg);
return;
@@ -676,7 +679,7 @@ void CSteamProto::OnPendingApproved(const NETLIBHTTPREQUEST *response, void *arg
void CSteamProto::OnPendingIgnoreded(const NETLIBHTTPREQUEST *response, void *arg)
{
- if (!response || response->resultCode != HTTP_CODE_OK)
+ if (!ResponseHttpOk(response))
{
debugLogA("CSteamProto::OnPendingApproved: failed to ignore pending from %s", (char*)arg);
return;
@@ -696,7 +699,7 @@ void CSteamProto::OnPendingIgnoreded(const NETLIBHTTPREQUEST *response, void *ar
void CSteamProto::OnSearchByIdEnded(const NETLIBHTTPREQUEST *response, void *arg)
{
- if (!response || response->resultCode != HTTP_CODE_OK)
+ if (!ResponseHttpOk(response))
{
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE)STEAM_SEARCH_BYID, 0);
debugLogA("CSteamProto::OnSearchByIdEnded: failed to get summaries for %s", (char*)arg);