diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-09-16 17:46:05 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-09-16 17:46:05 +0000 |
commit | ab46b98479555c7106087f7d62b6c89f320ca311 (patch) | |
tree | e245d3dce9dfabbeb47aaff36135089613abe026 /protocols/Steam/src/steam_messages.cpp | |
parent | af54e11be6c1c3c997baae19f9d81526d96cd2aa (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_messages.cpp')
-rw-r--r-- | protocols/Steam/src/steam_messages.cpp | 37 |
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 |