summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/steam_messages.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2015-03-06 10:23:12 +0000
committerRobert Pösel <robyer@seznam.cz>2015-03-06 10:23:12 +0000
commit80697b0e53191d73dfb440b334a928cbf0bc9c2c (patch)
treec797b07c48aadbd30e6ab95b7285fb010474719c /protocols/Steam/src/steam_messages.cpp
parent224d0671bfbfccb2883313183a51f86fdf967745 (diff)
Steam: Rework SendMsg() method; Version bump
Now it raise error immediately when user tries to send message when protocol is offline git-svn-id: http://svn.miranda-ng.org/main/trunk@12350 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Steam/src/steam_messages.cpp')
-rw-r--r--protocols/Steam/src/steam_messages.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/protocols/Steam/src/steam_messages.cpp b/protocols/Steam/src/steam_messages.cpp
index 418d57d814..f2f2c51c8a 100644
--- a/protocols/Steam/src/steam_messages.cpp
+++ b/protocols/Steam/src/steam_messages.cpp
@@ -17,30 +17,26 @@ void CSteamProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg)
{
SendMessageParam *param = (SendMessageParam*)arg;
- int status = ACKRESULT_FAILED;
- ptrT error;
-
+ ptrT error(mir_tstrdup(TranslateT("Unknown error")));
ptrT steamId(getTStringA(param->hContact, "SteamID"));
if (response != NULL && response->resultCode == HTTP_STATUS_OK)
{
JSONROOT root(response->pData);
JSONNODE *node = json_get(root, "error");
- error = json_as_string(node);
+ if (node)
+ error = json_as_string(node);
}
+ int status = ACKRESULT_FAILED;
+
if (!mir_tstrcmpi(error, _T("OK")))
{
status = ACKRESULT_SUCCESS;
error = NULL;
}
else
- {
- if (!error)
- error = mir_tstrdup(IsOnline() ? TranslateT("Unknown error") : TranslateT("You cannot send messages when you are offline."));
-
debugLog(_T("CSteamProto::OnMessageSent: failed to send message for %s (%s)"), steamId, error);
- }
ProtoBroadcastAck(
param->hContact,