Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Unified Diff: jingle/notifier/listener/push_notifications_send_update_task.cc

Issue 9190029: use push messaging in cache invalidation xmpp channel (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: jingle/notifier/listener/push_notifications_send_update_task.cc
===================================================================
--- jingle/notifier/listener/push_notifications_send_update_task.cc (revision 117278)
+++ jingle/notifier/listener/push_notifications_send_update_task.cc (working copy)
@@ -44,10 +44,12 @@
const buzz::QName kQnPush(kPushNotificationsNamespace, "push");
const buzz::QName kQnChannel(buzz::STR_EMPTY, "channel");
const buzz::QName kQnData(kPushNotificationsNamespace, "data");
+ const buzz::QName kQnRecipient(kPushNotificationsNamespace, "recipient");
// Create our update stanza. The message is constructed as:
// <message from='{full jid}' to='{bare jid}' type='headline'>
// <push xmlns='google:push' channel='{channel}'>
+ // [<recipient to='{bare jid}'>{base-64 encoded data}</data>]*
// <data>{base-64 encoded data}</data>
// </push>
// </message>
@@ -60,6 +62,24 @@
push->AddAttr(kQnChannel, notification.channel);
message->AddElement(push);
+ const RecipientList& recipients = notification.recipients;
+ for (uint i = 0; i < recipients.size(); ++i) {
+ const Recipient& recipient = recipients[i];
+ buzz::XmlElement* recipient_element =
+ new buzz::XmlElement(kQnRecipient, true);
+ recipient_element->AddAttr(buzz::QN_TO, recipient.to);
+ if (!recipient.user_specific_data.empty()) {
+ std::string base64_data;
+ if (!base::Base64Encode(recipient.user_specific_data, &base64_data)) {
+ LOG(WARNING) << "Could not encode data "
+ << recipient.user_specific_data;
+ } else {
+ recipient_element->SetBodyText(base64_data);
+ }
+ }
+ push->AddElement(recipient_element);
akalin 2012/01/12 23:06:44 i think this should be moved to right after the re
ghc 2012/01/13 01:23:07 Done.
+ }
+
buzz::XmlElement* data = new buzz::XmlElement(kQnData, true);
std::string base64_data;
if (!base::Base64Encode(notification.data, &base64_data)) {

Powered by Google App Engine
This is Rietveld 408576698