From f49eebc1d4c1278286afff0996a28ff8b6a3ebdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Fri, 12 Feb 2016 01:58:23 +0000 Subject: Facebook: Update some requests format, changes for stickers and new support for sending stickers (send message "[[sticker:STICKER_ID]]") git-svn-id: http://svn.miranda-ng.org/main/trunk@16272 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/json.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'protocols/FacebookRM/src/json.cpp') diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index 1978499c55..76eb2e0f49 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -106,13 +106,14 @@ int facebook_json_parser::parse_buddy_list(std::string *data, List::List< facebo } // Facebook is not sending this info anymore, it should be removed + // TODO: It is now supported to get via /ajax/mercury/tabs_presence.php request, and it is also getting through classic pull as special type of event const JSONNode &p = (*it)["p"]; if (p) { - std::string status = p["status"].as_string(); // this seems to be "active" everytime + std::string status = p["status"].as_string(); // this seems to be "active" or "invisible" or null std::string webStatus = p["webStatus"].as_string(); // "active", "idle" or "offline" - std::string fbAppStatus = p["fbAppStatus"].as_string(); // "offline" or "active" - std::string messengerStatus = p["messengerStatus"].as_string(); // "offline" or "active" - std::string otherStatus = p["otherStatus"].as_string(); // "offline" or "active" - this seems to be "active" when webStatus is "idle" or "active" only + std::string fbAppStatus = p["fbAppStatus"].as_string(); // "offline" or "active" or "invisible" or null + std::string messengerStatus = p["messengerStatus"].as_string(); // "offline" or "active" or "invisible" or null + std::string otherStatus = p["otherStatus"].as_string(); // "offline" or "active" or "invisible" or null - this seems to be "active" when webStatus is "idle" or "active" only // this may never happen if (status != "active") @@ -369,18 +370,18 @@ void parseAttachments(FacebookProto *proto, std::string *message_text, const JSO attachments_text += "\n" + absolutizeUrl(link) + "\n"; } - // Stickers as smileys - if (proto->getByte(FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS)) { - const JSONNode &metadata = (*itAttachment)["metadata"]; - if (metadata) { - const JSONNode &stickerId_ = metadata["stickerID"]; - if (stickerId_) { - std::string sticker = "[[sticker:" + stickerId_.as_string() + "]]\n"; - attachments_text += sticker; + const JSONNode &metadata = (*itAttachment)["metadata"]; + if (metadata) { + const JSONNode &stickerId_ = metadata["stickerID"]; + if (stickerId_) { + std::string sticker = "[[sticker:" + stickerId_.as_string() + "]]\n"; + attachments_text += sticker; - if (other_user_fbid.empty() && !thread_id.empty()) - other_user_fbid = proto->ThreadIDToContactID(thread_id); + if (other_user_fbid.empty() && !thread_id.empty()) + other_user_fbid = proto->ThreadIDToContactID(thread_id); + // Stickers as smileys + if (proto->getByte(FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS)) { // FIXME: rewrite smileyadd to use custom smileys per protocol and not per contact and then remove this ugliness if (!other_user_fbid.empty()) { MCONTACT hContact = proto->ContactIDToHContact(other_user_fbid); -- cgit v1.2.3