summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-04-06 18:47:07 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-04-06 18:47:07 +0000
commit7056dd6d9d9fc9eefad716272e24682f55ace117 (patch)
treef0b2fce90f470802d3bbf9e459f9897a1cbecc48 /protocols
parent993f6a525a2236ed3a3b1491213150c4a893426c (diff)
SkypeWeb:
- added receiving actions (/me) - fixed <undef> nick in private chats git-svn-id: http://svn.miranda-ng.org/main/trunk@12638 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/SkypeWeb/src/requests/messages.h18
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp3
-rw-r--r--protocols/SkypeWeb/src/skype_profile.cpp2
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);