summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-04-20 12:23:15 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-04-20 12:23:15 +0000
commit856b4c2c2d7832d99d7fa85304f943b3e5d268b8 (patch)
tree2d2b3625984e5f74b863e263d12fa6bf20475d7c /protocols
parent87c93893737a93eab058071475095de15f49bb58 (diff)
SkypeWeb: Cyrillic messages fix2
git-svn-id: http://svn.miranda-ng.org/main/trunk@12969 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/SkypeWeb/src/requests/chatrooms.h24
-rw-r--r--protocols/SkypeWeb/src/requests/messages.h4
-rw-r--r--protocols/SkypeWeb/src/skype_chatrooms.cpp2
3 files changed, 27 insertions, 3 deletions
diff --git a/protocols/SkypeWeb/src/requests/chatrooms.h b/protocols/SkypeWeb/src/requests/chatrooms.h
index 2a41798c50..d23e86832c 100644
--- a/protocols/SkypeWeb/src/requests/chatrooms.h
+++ b/protocols/SkypeWeb/src/requests/chatrooms.h
@@ -18,6 +18,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef _SKYPE_REQUEST_CHATS_H_
#define _SKYPE_REQUEST_CHATS_H_
+class SendChatMessageRequest : public HttpRequest
+{
+public:
+ SendChatMessageRequest(const char *regToken, const char *username, time_t timestamp, const char *message, const char *server = SKYPE_ENDPOINTS_HOST) :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/19:%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");
+
+ JSONNODE *node = json_new(5);
+ json_push_back(node, json_new_i("clientmessageid", timestamp));
+ json_push_back(node, json_new_a("messagetype", "RichText"));
+ json_push_back(node, json_new_a("contenttype", "text"));
+ json_push_back(node, json_new_a("content", ptrA(mir_utf8encode(message))));
+
+ ptrA data(mir_utf8encodeT(ptrT(json_write(node))));
+ Body << VALUE(data);
+
+ json_delete(node);
+ }
+};
+
class CreateChatroomRequest : public HttpRequest
{
public:
diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h
index 14877cf9a6..3aba9a4fc4 100644
--- a/protocols/SkypeWeb/src/requests/messages.h
+++ b/protocols/SkypeWeb/src/requests/messages.h
@@ -21,8 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class SendMessageRequest : public HttpRequest
{
public:
- SendMessageRequest(const char *regToken, const char *username, time_t timestamp, const char *message, const char *server = SKYPE_ENDPOINTS_HOST, bool isChat = false) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/%s:%s/messages", server, isChat?"19":"8", username)
+ SendMessageRequest(const char *regToken, const char *username, time_t timestamp, const char *message, const char *server = SKYPE_ENDPOINTS_HOST) :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", server, username)
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp
index bd2846f036..80a38fbbee 100644
--- a/protocols/SkypeWeb/src/skype_chatrooms.cpp
+++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp
@@ -91,7 +91,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam)
if (IsOnline()) {
debugLogA(" > Chat - Outgoing message");
- SendRequest(new SendMessageRequest(RegToken, chat_id, time(NULL), msg, Server, true));
+ SendRequest(new SendChatMessageRequest(RegToken, chat_id, time(NULL), msg, Server));
}
break;