From 10113448da51cb8e01aedc75c348769b9ebbf0f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sun, 17 Apr 2016 15:08:50 +0000 Subject: Facebook: Fix sending multi chat messages and codepage of their error messages git-svn-id: http://svn.miranda-ng.org/main/trunk@16692 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/communication.cpp | 8 +++++++- protocols/FacebookRM/src/messages.cpp | 6 ++++-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'protocols') diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index b1a0f23691..2878888130 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -1381,13 +1381,19 @@ int facebook_client::send_message(int seqid, MCONTACT hContact, const std::strin data += "&message_batch[0][action_type]=ma-type:user-generated-message"; if (isChatRoom) { - data += "&message_batch[0][thread_id]=" + std::string(threadId); + // NOTE: Remove "id." prefix as here we need to give threadFbId and not threadId + std::string thread_fbid = threadId; + if (thread_fbid.substr(0, 3) == "id.") + thread_fbid = thread_fbid.substr(3); + + data += "&message_batch[0][thread_fbid]=" + thread_fbid; } else { data += "&message_batch[0][specific_to_list][0]=fbid:" + std::string(userId); data += "&message_batch[0][specific_to_list][1]=fbid:" + this->self_.user_id; data += "&message_batch[0][other_user_fbid]=" + std::string(userId); } + data += "&message_batch[0][thread_id]="; data += "&message_batch[0][author]=fbid:" + this->self_.user_id; data += "&message_batch[0][author_email]"; data += "&message_batch[0][timestamp]=" + utils::time::mili_timestamp(); diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp index 487040e331..a7fdc4674f 100644 --- a/protocols/FacebookRM/src/messages.cpp +++ b/protocols/FacebookRM/src/messages.cpp @@ -109,8 +109,10 @@ void FacebookProto::SendChatMsgWorker(void *p) if (!tid.empty()) { if (facy.send_message(0, hContact, data->msg, &err_message) == SEND_MESSAGE_OK) UpdateChat(data->chat_id.c_str(), facy.self_.user_id.c_str(), facy.self_.real_name.c_str(), data->msg.c_str()); - else - UpdateChat(data->chat_id.c_str(), NULL, NULL, err_message.c_str()); + else { + ptrA text(mir_utf8encode(err_message.c_str())); + UpdateChat(data->chat_id.c_str(), NULL, NULL, text); + } } } -- cgit v1.2.3