diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/SkypeWeb/src/requests/messages.h | 18 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 3 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_profile.cpp | 2 |
3 files changed, 22 insertions, 1 deletions
diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h index 81a0d12b92..c7aa5347c8 100644 --- a/protocols/SkypeWeb/src/requests/messages.h +++ b/protocols/SkypeWeb/src/requests/messages.h @@ -19,6 +19,24 @@ public: }
};
+class SendActionRequest : public HttpRequest
+{
+public:
+ SendActionRequest(const char *regToken, const char *username, time_t timestamp, const char *message, const char *server = "client-s.gateway.messenger.live.com") :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", server, username)
+ {
+ Headers
+ << CHAR_VALUE("Accept", "application/json, text/javascript")
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
+ << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8");
+
+ CMStringA data;
+ data.AppendFormat("{\"clientmessageid\":\"%lld\",\"content\":\"%s %s\",\"messagetype\":\"RichText\",\"contenttype\":\"text\",\"skypeemoteoffset\":\"%d\"}", timestamp, username, message, (int)(mir_strlen(username) + 1));
+
+ Body << VALUE(data);
+ }
+};
+
class SendTypingRequest : public HttpRequest
{
public:
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 1bcfb26049..53ca7542ba 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -115,7 +115,8 @@ int CSkypeProto::OnSendMessage(MCONTACT hContact, int flags, const char *szMessa ptrA username(getStringA(hContact, "Skypename"));
if (strncmp(message, "/me ", 4) == 0)
{
- // TODO: make /me action send support
+ PushRequest(new SendActionRequest(token, username, timestamp, &message[4], server), &CSkypeProto::OnMessageSent, param);
+ return timestamp;
}
PushRequest(new SendMessageRequest(token, username, timestamp, message, server), &CSkypeProto::OnMessageSent, param);
return timestamp;
diff --git a/protocols/SkypeWeb/src/skype_profile.cpp b/protocols/SkypeWeb/src/skype_profile.cpp index 3ddb5b56c9..25d15dba5d 100644 --- a/protocols/SkypeWeb/src/skype_profile.cpp +++ b/protocols/SkypeWeb/src/skype_profile.cpp @@ -249,6 +249,8 @@ void CSkypeProto::UpdateProfileLastName(JSONNODE *root, MCONTACT hContact) void CSkypeProto::UpdateProfileDisplayName(JSONNODE *root, MCONTACT hContact)
{
JSONNODE *node = json_get(root, "displayname");
+ if (node == NULL)
+ node = json_get(root, "username");
CMString displayname = ptrT(json_as_string(node));
if (!displayname.IsEmpty() && displayname != "null")
setTString(hContact, "Nick", displayname);
|