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

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

Issue 11232048: Adding XMPP ping functionality to CLoudPrint. XMPP ping and timeout is controlled thorugh Service S… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
diff --git a/jingle/notifier/listener/push_notifications_send_update_task.cc b/jingle/notifier/listener/push_notifications_send_update_task.cc
index 50ec15e3cf45ab58336d26730ba77e533cc07b25..ae559a6cd16f11a0d9f547fc879644e8bbb57e36 100644
--- a/jingle/notifier/listener/push_notifications_send_update_task.cc
+++ b/jingle/notifier/listener/push_notifications_send_update_task.cc
@@ -26,9 +26,14 @@ PushNotificationsSendUpdateTask::PushNotificationsSendUpdateTask(
PushNotificationsSendUpdateTask::~PushNotificationsSendUpdateTask() {}
int PushNotificationsSendUpdateTask::ProcessStart() {
- scoped_ptr<buzz::XmlElement> stanza(
- MakeUpdateMessage(notification_,
- GetClient()->jid().BareJid()));
+ scoped_ptr<buzz::XmlElement> stanza;
+ if (notification_.ping) {
+ stanza.reset(MakePingStanza(notification_, task_id()));
+ } else {
+ stanza.reset(MakeUpdateMessage(notification_,
+ GetClient()->jid().BareJid()));
+ }
+
DVLOG(1) << "Sending notification " << notification_.ToString()
<< " as stanza " << XmlElementToString(*stanza);
if (SendStanza(stanza.get()) != buzz::XMPP_RETURN_OK) {
@@ -91,4 +96,13 @@ buzz::XmlElement* PushNotificationsSendUpdateTask::MakeUpdateMessage(
return message;
}
+buzz::XmlElement* PushNotificationsSendUpdateTask::MakePingStanza(
+ const Notification& notification, std::string task_id) {
+ DCHECK(notification.ping);
+ buzz::XmlElement* stanza =
+ MakeIq(buzz::STR_GET, buzz::Jid(buzz::STR_EMPTY), task_id);
Vitaly Buka (NO REVIEWS) 2012/10/22 20:52:53 buzz::XmlElement* stanza = MakeIq(buzz::STR_GET,
gene 2012/10/22 21:44:12 Done.
+ stanza->AddElement(new buzz::XmlElement(buzz::QN_PING));
+ return stanza;
+}
+
} // namespace notifier

Powered by Google App Engine
This is Rietveld 408576698