diff options
author | Robert Pösel <robyer@seznam.cz> | 2016-08-31 10:11:34 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2016-08-31 10:11:34 +0000 |
commit | f19d5fcb4c2807387aa89649a3601658766e3755 (patch) | |
tree | 3ba439c573e2a864ee68741f6531e0a550ed65bb /protocols/FacebookRM/src/json.cpp | |
parent | 8a904bdef0e8237dee49c1b704d4ebbc2b28a958 (diff) |
Facebook: Improve handling users joining chatroom (fixes #1279)
This commit makes them add to chat's user list and load their name too.
git-svn-id: http://svn.miranda-ng.org/main/trunk@17223 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/json.cpp')
-rw-r--r-- | protocols/FacebookRM/src/json.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index 2c97a56b4a..a46fd08fb2 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -972,6 +972,14 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo } else if (logType == "log:subscribe") { message.type = SUBSCRIBE; + + const JSONNode &fbids_ = log_data_["added_participants"]; + for (auto it2 = fbids_.begin(); it2 != fbids_.end(); ++it2) { + std::string id = (*it2).as_string().substr(5); // strip "fbid:" prefix + if (!message.data.empty()) + message.data += ";"; + message.data += id; + } } else if (logType == "log:unsubscribe") { message.type = UNSUBSCRIBE; @@ -1194,6 +1202,14 @@ int facebook_json_parser::parse_thread_messages(std::string *data, std::vector< } else if (log_type == "log:subscribe") { message.type = SUBSCRIBE; + + const JSONNode &fbids_ = log_data_["added_participants"]; + for (auto it2 = fbids_.begin(); it2 != fbids_.end(); ++it2) { + std::string id = (*it2).as_string().substr(5); // strip "fbid:" prefix + if (!message.data.empty()) + message.data += ";"; + message.data += id; + } } else if (log_type == "log:unsubscribe") { message.type = UNSUBSCRIBE; @@ -1300,6 +1316,14 @@ int facebook_json_parser::parse_history(std::string *data, std::vector< facebook } else if (log_type == "log:subscribe") { message.type = SUBSCRIBE; + + const JSONNode &fbids_ = log_data_["added_participants"]; + for (auto it2 = fbids_.begin(); it2 != fbids_.end(); ++it2) { + std::string id = (*it2).as_string().substr(5); // strip "fbid:" prefix + if (!message.data.empty()) + message.data += ";"; + message.data += id; + } } else if (log_type == "log:unsubscribe") { message.type = UNSUBSCRIBE; |