summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-05-30 12:49:54 +0000
committerRobert Pösel <robyer@seznam.cz>2014-05-30 12:49:54 +0000
commitfd0d38e50db088692bfff7608df3b765d804e847 (patch)
treea244a13fae78e20e7d337c60c8af62cfcf1bd19c /protocols/FacebookRM
parent20051a55a8a7cb710767e09b0a5e6e2a0445c0ae (diff)
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
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r--protocols/FacebookRM/src/client.h2
-rw-r--r--protocols/FacebookRM/src/communication.cpp3
-rw-r--r--protocols/FacebookRM/src/messages.cpp4
-rw-r--r--protocols/FacebookRM/src/process.cpp2
4 files changed, 6 insertions, 5 deletions
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<std::string, bool> 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<std::string, facebook_chatroom*> 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<std::string, facebook_chatroom*>::iterator it = chatrooms.begin(); it != chatrooms.end(); ) {