diff options
author | Robert Pösel <robyer@seznam.cz> | 2013-02-08 20:36:11 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2013-02-08 20:36:11 +0000 |
commit | 7a3c2fe12668ba4346e2b31b34f0b0c4b9ac590d (patch) | |
tree | e9e7b4f7162f00b7ec8258e117b00315c07a615f /protocols/FacebookRM | |
parent | 4a8df3f745894019f883efdea54b5fa244228d61 (diff) |
Facebook: Fixed getting notifications.
git-svn-id: http://svn.miranda-ng.org/main/trunk@3485 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r-- | protocols/FacebookRM/src/json.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index eaf33a083e..a3eef2c4c7 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -268,8 +268,7 @@ int facebook_json_parser::parse_messages( void* data, std::vector< facebook_mess std::string last_msg = "";
- for (Array::const_iterator itMessage(messagesArray.Begin());
- itMessage != messagesArray.End(); ++itMessage)
+ for (Array::const_iterator itMessage(messagesArray.Begin()); itMessage != messagesArray.End(); ++itMessage)
{
const Object& objMember = *itMessage;
@@ -432,29 +431,32 @@ int facebook_json_parser::parse_messages( void* data, std::vector< facebook_mess mir_free(szTitle);
mir_free(szText);
}
- else if ( type.Value( ) == "app_msg" ) // event notification
+ else if ( type.Value() == "notification_json" ) // event notification
{
if (!DBGetContactSettingByte(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE, DEFAULT_EVENT_NOTIFICATIONS_ENABLE))
continue;
-
- const String& text = objMember["response"]["payload"]["title"];
- const String& link = objMember["response"]["payload"]["link"];
- // TODO RM: include additional text of notification if exits? (e.g. comment text)
- //const String& text2 = objMember["response"]["payload"]["alert"]["text"];
- const Number& time_sent = objMember["response"]["payload"]["alert"]["time_sent"];
- if (time_sent.Value() > proto->facy.last_notification_time_) // Check agains duplicit notifications
+ const Array& notificationsArray = objMember["nodes"];
+
+ for (Array::const_iterator itNotification(notificationsArray.Begin()); itNotification != notificationsArray.End(); ++itNotification)
{
- proto->facy.last_notification_time_ = time_sent.Value();
+ const Object& objNotification = *itNotification;
- facebook_notification* notification = new facebook_notification( );
- notification->text = utils::text::remove_html(
- utils::text::special_expressions_decode(
- utils::text::slashu_to_utf8( text.Value( )) ));
+ //const String& text = objNotification["title"]["text"];
+ const String& text = objNotification["unaggregatedTitle"]["text"];
+ const String& link = objNotification["url"];
- notification->link = utils::text::special_expressions_decode( link.Value( ));
+ const Number& time_sent = objNotification["timestamp"]["time"];
+ if (time_sent.Value() > proto->facy.last_notification_time_) // Check agains duplicit notifications
+ {
+ proto->facy.last_notification_time_ = time_sent.Value();
- notifications->push_back( notification );
+ facebook_notification* notification = new facebook_notification();
+ notification->text = utils::text::slashu_to_utf8(text.Value());
+ notification->link = utils::text::special_expressions_decode(link.Value());
+
+ notifications->push_back(notification);
+ }
}
}
else if ( type.Value( ) == "typ" ) // chat typing notification
|