summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/steam_messages.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Steam/src/steam_messages.cpp')
-rw-r--r--protocols/Steam/src/steam_messages.cpp37
1 files changed, 18 insertions, 19 deletions
diff --git a/protocols/Steam/src/steam_messages.cpp b/protocols/Steam/src/steam_messages.cpp
index c8a1813b84..5ba4a4f139 100644
--- a/protocols/Steam/src/steam_messages.cpp
+++ b/protocols/Steam/src/steam_messages.cpp
@@ -16,21 +16,21 @@ void MessageParamFree(void *arg)
int CSteamProto::OnSendMessage(MCONTACT hContact, const char* message)
{
- UINT hMessage = InterlockedIncrement(&hMessageProcess);
-
- SendMessageParam *param = (SendMessageParam*)mir_calloc(sizeof(SendMessageParam));
- param->hContact = hContact;
- param->hMessage = (HANDLE)hMessage;
- param->message = mir_strdup(message);
-
- ptrA token(getStringA("TokenSecret"));
- ptrA umqid(getStringA("UMQID"));
- ptrA steamId(getStringA(hContact, "SteamID"));
- PushRequest(
- new SendMessageRequest(token, umqid, steamId, message),
- &CSteamProto::OnMessageSent,
- param, MessageParamFree);
-
+ UINT hMessage = InterlockedIncrement(&hMessageProcess);
+
+ SendMessageParam *param = (SendMessageParam*)mir_calloc(sizeof(SendMessageParam));
+ param->hContact = hContact;
+ param->hMessage = (HANDLE)hMessage;
+ param->message = mir_strdup(message);
+
+ ptrA token(getStringA("TokenSecret"));
+ ptrA umqid(getStringA("UMQID"));
+ ptrA steamId(getStringA(hContact, "SteamID"));
+ PushRequest(
+ new SendMessageRequest(token, umqid, steamId, message),
+ &CSteamProto::OnMessageSent,
+ param, MessageParamFree);
+
return hMessage;
}
@@ -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 && response->resultCode == HTTP_CODE_OK)
+ if (ResponseHttpOk(response))
{
JSONROOT root(response->pData);
JSONNode *node = json_get(root, "error");
@@ -54,8 +54,7 @@ void CSteamProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg)
ptrA errorA(mir_t2a(error));
debugLogA("CSteamProto::OnMessageSent: failed to send message for %s (%s)", steamId, errorA);
ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hMessage, (LPARAM)errorA);
- return;
}
-
- ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, param->hMessage, 0);
+ else
+ ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, param->hMessage, 0);
} \ No newline at end of file