diff options
author | George Hazan <george.hazan@gmail.com> | 2024-09-23 19:52:03 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-09-23 19:52:08 +0300 |
commit | caabdaa3d59f66d21a55c85324e397665bb41881 (patch) | |
tree | 7a6b37e030df591eb8b2fdbeffe8a20cdd358386 /protocols/SkypeWeb/src/skype_chatrooms.cpp | |
parent | b1a24806c4d3944125f9b41acd9b155126a0f5ad (diff) |
fixes #4693 (SkypeWeb: форматирование - вторая часть марлезонского балета)
Diffstat (limited to 'protocols/SkypeWeb/src/skype_chatrooms.cpp')
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index de34a66fa8..e73fc74629 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -325,22 +325,32 @@ bool CSkypeProto::OnChatEvent(const JSONNode &node) return false;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
void CSkypeProto::SendChatMessage(SESSION_INFO *si, const wchar_t *tszMessage)
{
if (!IsOnline())
return;
- T2Utf chat_id(si->ptszID);
CMStringA szMessage(ptrA(mir_utf8encodeW(tszMessage)));
szMessage.TrimRight();
- AddBbcodes(szMessage);
+ bool bRich = AddBbcodes(szMessage);
+
+ CMStringA szUrl = "/users/ME/conversations/" + mir_urlEncode(T2Utf(si->ptszID)) + "/messages";
+ AsyncHttpRequest *pReq = new AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, szUrl, &CSkypeProto::OnMessageSent);
+ JSONNode node;
+ node << CHAR_PARAM("clientmessageid", CMStringA(::FORMAT, "%llu000", (ULONGLONG)time(0)))
+ << CHAR_PARAM("messagetype", bRich ? "RichText" : "Text") << CHAR_PARAM("contenttype", "text") << CHAR_PARAM("content", szMessage);
if (strncmp(szMessage, "/me ", 4) == 0)
- PushRequest(new SendChatActionRequest(chat_id, time(0), szMessage));
- else
- PushRequest(new SendChatMessageRequest(chat_id, time(0), szMessage));
+ node << INT_PARAM("skypeemoteoffset", 4);
+ pReq->m_szParam = node.write().c_str();
+
+ PushRequest(pReq);
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
void CSkypeProto::OnGetChatMembers(MHttpResponse *response, AsyncHttpRequest *pRequest)
{
JsonReply reply(response);
|