From fd0d38e50db088692bfff7608df3b765d804e847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Fri, 30 May 2014 12:49:54 +0000 Subject: Facebook: Try to load also sent messages when getting unread messages at login git-svn-id: http://svn.miranda-ng.org/main/trunk@9371 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/client.h | 2 +- protocols/FacebookRM/src/communication.cpp | 3 ++- protocols/FacebookRM/src/messages.cpp | 4 ++-- protocols/FacebookRM/src/process.cpp | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) (limited to 'protocols') diff --git a/protocols/FacebookRM/src/client.h b/protocols/FacebookRM/src/client.h index 5189e1be68..b20d7d70e7 100644 --- a/protocols/FacebookRM/src/client.h +++ b/protocols/FacebookRM/src/client.h @@ -157,7 +157,7 @@ public: std::map messages_ignore; bool channel(); - bool send_message(std::string message_recipient, std::string message_text, std::string *error_text, MessageMethod method); + bool send_message(MCONTACT, std::string message_recipient, std::string message_text, std::string *error_text, MessageMethod method); //////////////////////////////////////////////////////////// // Status handling diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index e60e333b61..4cbe5efc89 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -1079,7 +1079,7 @@ bool facebook_client::channel() } } -bool facebook_client::send_message(std::string message_recipient, std::string message_text, std::string *error_text, MessageMethod method) +bool facebook_client::send_message(MCONTACT hContact, std::string message_recipient, std::string message_text, std::string *error_text, MessageMethod method) { ScopedLock s(send_message_lock_); @@ -1182,6 +1182,7 @@ bool facebook_client::send_message(std::string message_recipient, std::string me { // Remember this message id std::string mid = utils::text::source_get_value(&resp.data, 2, "\"message_id\":\"", "\""); + parent->setString(hContact, FACEBOOK_KEY_MESSAGE_ID, mid.c_str()); messages_ignore.insert(std::make_pair(mid, false)); } break; diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp index 6875014eb9..4c26c1402b 100644 --- a/protocols/FacebookRM/src/messages.cpp +++ b/protocols/FacebookRM/src/messages.cpp @@ -50,7 +50,7 @@ void FacebookProto::SendMsgWorker(void *p) std::string error_text = ""; bool result = false; while (!result && retries > 0) { - result = facy.send_message(dbv.pszVal, data->msg, &error_text, retries % 2 == 0 ? MESSAGE_INBOX : MESSAGE_MERCURY); + result = facy.send_message(data->hContact, dbv.pszVal, data->msg, &error_text, retries % 2 == 0 ? MESSAGE_INBOX : MESSAGE_MERCURY); retries--; } if (result) { @@ -94,7 +94,7 @@ void FacebookProto::SendChatMsgWorker(void *p) } if (!tid.empty()) { - if (facy.send_message(tid, data->msg, &err_message, MESSAGE_TID)) + if (facy.send_message(hContact, tid, data->msg, &err_message, MESSAGE_TID)) UpdateChat(_A2T(data->chat_id.c_str()), facy.self_.user_id.c_str(), facy.self_.real_name.c_str(), data->msg.c_str()); else UpdateChat(_A2T(data->chat_id.c_str()), NULL, NULL, err_message.c_str()); diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index c01bbab62f..e001451d33 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -365,7 +365,7 @@ void FacebookProto::ProcessUnreadMessage(void *p) std::map chatrooms; facebook_json_parser* p = new facebook_json_parser(this); - p->parse_thread_messages(&resp.data, &messages, &chatrooms, true, inboxOnly, limit); + p->parse_thread_messages(&resp.data, &messages, &chatrooms, false, inboxOnly, limit); delete p; for (std::map::iterator it = chatrooms.begin(); it != chatrooms.end(); ) { -- cgit v1.2.3