summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2015-03-05 14:36:22 +0000
committerRobert Pösel <robyer@seznam.cz>2015-03-05 14:36:22 +0000
commitd5b576ca4aafb5af42446c2a782c8a6071903489 (patch)
tree7991bf2f0c29ce23c11fa4306a3f6c0afd1c76bb
parent68c31fd58da09d3f4f0b4c7b78a53f83cc5f9ffb (diff)
Steam: Improve method for sending messages; version bump
Now it uses better error messages (server's one if they're available). Remaining problem is that it doesn't raise error immediately when protocol is offline and user tries to send message - that's problem of how are implemented requests here and it needs more changes... git-svn-id: http://svn.miranda-ng.org/main/trunk@12326 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/Steam/src/steam_messages.cpp29
-rw-r--r--protocols/Steam/src/version.h2
2 files changed, 19 insertions, 12 deletions
diff --git a/protocols/Steam/src/steam_messages.cpp b/protocols/Steam/src/steam_messages.cpp
index f330e5a3ab..ba6a98649e 100644
--- a/protocols/Steam/src/steam_messages.cpp
+++ b/protocols/Steam/src/steam_messages.cpp
@@ -17,30 +17,37 @@ void CSteamProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg)
{
SendMessageParam *param = (SendMessageParam*)arg;
- bool result = false;
+ int status = ACKRESULT_FAILED;
+ ptrT error;
- ptrA steamId(getStringA(param->hContact, "SteamID"));
+ ptrT steamId(getTStringA(param->hContact, "SteamID"));
if (response != NULL && response->resultCode == HTTP_STATUS_OK)
{
JSONROOT root(response->pData);
JSONNODE *node = json_get(root, "error");
- ptrA error(mir_utf8encodeW(ptrT(json_as_string(node))));
- if (lstrcmpiA(error, "OK") == 0)
- result = true;
- else
- debugLogA("CSteamProto::OnMessageSent: failed to send message for %s (%s)", steamId, error);
+ error = json_as_string(node);
}
- else
- debugLogA("CSteamProto::OnMessageSent: failed to send message for %s", steamId);
- int status = result ? ACKRESULT_SUCCESS : 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,
ACKTYPE_MESSAGE,
status,
- param->hMessage, 0);
+ param->hMessage,
+ error);
mir_free(param);
} \ No newline at end of file
diff --git a/protocols/Steam/src/version.h b/protocols/Steam/src/version.h
index e493763ec5..802fa4e515 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 2
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#include <stdver.h>