summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-12-02 18:24:02 +0000
committerRobert Pösel <robyer@seznam.cz>2014-12-02 18:24:02 +0000
commitf114071bca3a336930a5c04ec1b1518214e31b4a (patch)
tree43410e1e07bf6f3e148a7f512ee61438f8f9425a
parentd3fc13db1e7588df70dea2bd891f140d71b93051 (diff)
Steam: Raise message length limit; fix encoding of sent messages; version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@11220 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/Steam/src/Steam/message.h7
-rw-r--r--protocols/Steam/src/steam_proto.cpp9
-rw-r--r--protocols/Steam/src/version.h2
3 files changed, 10 insertions, 8 deletions
diff --git a/protocols/Steam/src/Steam/message.h b/protocols/Steam/src/Steam/message.h
index b14dff4446..29a6afab12 100644
--- a/protocols/Steam/src/Steam/message.h
+++ b/protocols/Steam/src/Steam/message.h
@@ -110,15 +110,14 @@ namespace SteamWebApi
SendMessageRequest(const char *token, const char *umqId, const char *steamId, const char *text) :
HttpsPostRequest(STEAM_API_URL "/ISteamWebUserPresenceOAuth/Message/v0001")
{
- char data[1024];
- mir_snprintf(data, SIZEOF(data),
- "access_token=%s&umqid=%s&steamid_dst=%s&type=saytext&text=%s",
+ CMStringA data;
+ data.AppendFormat("access_token=%s&umqid=%s&steamid_dst=%s&type=saytext&text=%s",
token,
umqId,
steamId,
ptrA(mir_urlEncode(text)));
- SetData(data, strlen(data));
+ SetData(data, data.GetLength()); // FIXME: Is correct to give CMStringA or does it cause memory leak inside that method?
}
};
}
diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp
index 850cf7e5f0..e4668ebe38 100644
--- a/protocols/Steam/src/steam_proto.cpp
+++ b/protocols/Steam/src/steam_proto.cpp
@@ -196,7 +196,7 @@ DWORD_PTR __cdecl CSteamProto:: GetCaps(int type, MCONTACT hContact)
case PFLAGNUM_2:
return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_OUTTOLUNCH;
case PFLAGNUM_4:
- return PF4_AVATARS | PF4_NOCUSTOMAUTH | PF4_NOAUTHDENYREASON | PF4_FORCEAUTH | PF4_FORCEADDED;// | PF4_IMSENDOFFLINE | PF4_SUPPORTTYPING;
+ return PF4_AVATARS | PF4_NOCUSTOMAUTH | PF4_NOAUTHDENYREASON | PF4_FORCEAUTH | PF4_FORCEADDED | PF4_IMSENDUTF;// | PF4_IMSENDOFFLINE | PF4_SUPPORTTYPING;
case PFLAGNUM_5:
return PF2_SHORTAWAY | PF2_HEAVYDND | PF2_OUTTOLUNCH;
case PFLAG_UNIQUEIDTEXT:
@@ -204,7 +204,7 @@ DWORD_PTR __cdecl CSteamProto:: GetCaps(int type, MCONTACT hContact)
case PFLAG_UNIQUEIDSETTING:
return (DWORD_PTR)"SteamID";
case PFLAG_MAXLENOFMESSAGE:
- return 180;
+ return 200000; // this is guessed limit, in reality it is probably bigger
default:
return 0;
}
@@ -291,6 +291,9 @@ int __cdecl CSteamProto::SendMsg(MCONTACT hContact, int flags, const char *msg)
{
UINT hMessage = InterlockedIncrement(&hMessageProcess);
+ if (flags & PREF_UNICODE)
+ msg = mir_utf8encode(msg); // FIXME: Token from FacebookRM. Is it needed? Usually we get PREF_UTF8 flag instead. And does it cause memory leak?
+
SendMessageParam *param = (SendMessageParam*)mir_calloc(sizeof(SendMessageParam));
param->hContact = hContact;
param->hMessage = (HANDLE)hMessage;
@@ -301,7 +304,7 @@ int __cdecl CSteamProto::SendMsg(MCONTACT hContact, int flags, const char *msg)
ptrA steamId(getStringA(hContact, "SteamID"));
PushRequest(
- new SteamWebApi::SendMessageRequest(token, umqid, steamId, ptrA(mir_utf8encode(msg))),
+ new SteamWebApi::SendMessageRequest(token, umqid, steamId, msg),
&CSteamProto::OnMessageSent,
param);
diff --git a/protocols/Steam/src/version.h b/protocols/Steam/src/version.h
index d81bbde9e0..3fd4e763d4 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 0
-#define __BUILD_NUM 3
+#define __BUILD_NUM 4
#include <stdver.h>