Chromium Code Reviews| 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..166db2330160ab29c5678ef0f8742833115d0605 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())); |
|
akalin
2012/10/23 00:37:21
i think it's better to have a separate PingTask cl
|
| + } 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,14 @@ buzz::XmlElement* PushNotificationsSendUpdateTask::MakeUpdateMessage( |
| return message; |
| } |
| +buzz::XmlElement* PushNotificationsSendUpdateTask::MakePingStanza( |
| + const Notification& notification, const std::string& task_id) { |
| + DCHECK(notification.ping); |
| + buzz::XmlElement* stanza = MakeIq(buzz::STR_GET, |
| + buzz::Jid(buzz::STR_EMPTY), |
| + task_id); |
| + stanza->AddElement(new buzz::XmlElement(buzz::QN_PING)); |
| + return stanza; |
| +} |
| + |
| } // namespace notifier |