summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/json.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2016-04-17 15:08:58 +0000
committerRobert Pösel <robyer@seznam.cz>2016-04-17 15:08:58 +0000
commitdb6fa77e681f258d4454699c42cab0c1e61f5d2f (patch)
tree2e2fdcf409210599d080a53b73c89cbe37e7bd88 /protocols/FacebookRM/src/json.cpp
parent965ab314b6ca7f4e7f35060ebef14cd4157138de (diff)
Facebook: Remove option "receive messages from inbox only"
It probably doesn't have any effect anymore. And if it still has any effect, plugin behaves like if it was disabled (receiving all messages). Report any issues with the new FB's feature of "approving" messages from unknown people. git-svn-id: http://svn.miranda-ng.org/main/trunk@16694 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/json.cpp')
-rw-r--r--protocols/FacebookRM/src/json.cpp20
1 files changed, 3 insertions, 17 deletions
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index 2e7f743cd0..ecd69d393b 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -511,7 +511,7 @@ void parseAttachments2(FacebookProto *proto, std::string *message_text, const JS
}
}
-int facebook_json_parser::parse_messages(std::string *pData, std::vector< facebook_message* >* messages, std::map< std::string, facebook_notification* >* notifications, bool inboxOnly)
+int facebook_json_parser::parse_messages(std::string *pData, std::vector< facebook_message* >* messages, std::map< std::string, facebook_notification* >* notifications)
{
// remove old received messages from map
for (std::map<std::string, int>::iterator it = proto->facy.messages_ignore.begin(); it != proto->facy.messages_ignore.end();) {
@@ -548,8 +548,6 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector< facebo
const JSONNode &cls_ = delta_["class"];
std::string cls = cls_.as_string();
if (cls == "NewMessage") {
- // TODO: Support for "folders" was probably removed, we should remove the "inboxOnly" option too - but first check how does that "allow messages request" works
-
const JSONNode &meta_ = delta_["messageMetadata"];
if (!meta_) {
proto->debugLogA("json::parse_messages - No messageMetadata element");
@@ -961,7 +959,7 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector< facebo
return EXIT_SUCCESS;
}
-int facebook_json_parser::parse_unread_threads(std::string *data, std::vector< std::string >* threads, bool inboxOnly)
+int facebook_json_parser::parse_unread_threads(std::string *data, std::vector< std::string >* threads)
{
std::string jsonData = data->substr(9);
@@ -974,12 +972,8 @@ int facebook_json_parser::parse_unread_threads(std::string *data, std::vector< s
return EXIT_FAILURE;
for (auto it = unread_threads.begin(); it != unread_threads.end(); ++it) {
- const JSONNode &folder = (*it)["folder"];
const JSONNode &thread_ids = (*it)["thread_ids"];
- if (inboxOnly && folder.as_string() != "inbox")
- continue;
-
for (auto jt = thread_ids.begin(); jt != thread_ids.end(); ++jt)
threads->push_back((*jt).as_string());
}
@@ -987,7 +981,7 @@ int facebook_json_parser::parse_unread_threads(std::string *data, std::vector< s
return EXIT_SUCCESS;
}
-int facebook_json_parser::parse_thread_messages(std::string *data, std::vector< facebook_message* >* messages, std::map< std::string, facebook_chatroom* >* chatrooms, bool unreadOnly, bool inboxOnly)
+int facebook_json_parser::parse_thread_messages(std::string *data, std::vector< facebook_message* >* messages, std::map< std::string, facebook_chatroom* >* chatrooms, bool unreadOnly)
{
std::string jsonData = data->substr(9);
@@ -1023,7 +1017,6 @@ int facebook_json_parser::parse_thread_messages(std::string *data, std::vector<
const JSONNode &name = (*it)["name"];
//const JSONNode &message_count = (*it)["message_count");
//const JSONNode &unread_count = (*it)["unread_count"); // TODO: use it to check against number of loaded messages... but how?
- const JSONNode &folder = (*it)["folder"];
if (!other_user_fbid || !thread_id) {
proto->debugLogA("!!! Missing other_user_fbid/thread_id");
@@ -1053,9 +1046,6 @@ int facebook_json_parser::parse_thread_messages(std::string *data, std::vector<
if (iter != chatrooms->end())
chatrooms->erase(iter); // this is not chatroom
- if (inboxOnly && folder.as_string() != "inbox")
- continue;
-
if (id == "null")
continue;
@@ -1071,15 +1061,11 @@ int facebook_json_parser::parse_thread_messages(std::string *data, std::vector<
const JSONNode &mid = (*it)["message_id"];
const JSONNode &timestamp = (*it)["timestamp"];
const JSONNode &filtered = (*it)["is_filtered_content"];
- const JSONNode &folder = (*it)["folder"];
const JSONNode &is_unread = (*it)["is_unread"];
if (!author || !body || !mid || !tid || !timestamp)
continue;
- if (inboxOnly && folder.as_string() != "inbox")
- continue;
-
std::string thread_id = tid.as_string();
std::string message_id = mid.as_string();
std::string message_text = body.as_string();