Chromium Code Reviews| Index: remoting/protocol/jingle_messages.cc |
| diff --git a/remoting/protocol/jingle_messages.cc b/remoting/protocol/jingle_messages.cc |
| index 8c8c1640bfd0cf223720c7b8c84a6c8c4a81331b..85b13b4478d6ad47791cf75b648c39e7833fe41b 100644 |
| --- a/remoting/protocol/jingle_messages.cc |
| +++ b/remoting/protocol/jingle_messages.cc |
| @@ -342,10 +342,23 @@ bool JingleMessage::ParseXml(const buzz::XmlElement* stanza, |
| return false; |
| } |
| + const XmlElement* plugin_tag = |
| + jingle_tag->FirstNamed(QName(kChromotingXmlNamespace, "plugin")); |
| + if (plugin_tag) { |
| + plugin_message.reset(new XmlElement(*plugin_tag)); |
| + } else { |
| + plugin_message.reset(nullptr); |
|
Sergey Ulanov
2016/12/14 01:31:50
don't need nullptr.
Hzj_jie
2016/12/14 20:03:48
Done, also several other resets.
|
| + } |
| + |
| if (action == SESSION_INFO) { |
| // session-info messages may contain arbitrary information not |
| // defined by the Jingle protocol. We don't need to parse it. |
| const XmlElement* child = jingle_tag->FirstElement(); |
| + // Plugin messages are action independent, which should not be considered as |
| + // session-info. |
| + if (child == plugin_tag) { |
| + child = child->NextElement(); |
| + } |
| if (child) { |
| // session-info is allowed to be empty. |
| info.reset(new XmlElement(*child)); |
| @@ -443,6 +456,10 @@ std::unique_ptr<buzz::XmlElement> JingleMessage::ToXml() const { |
| LOG(FATAL) << "Invalid action value " << action; |
| jingle_tag->AddAttr(QName(kEmptyNamespace, "action"), action_attr); |
| + if (plugin_message) { |
| + jingle_tag->AddElement(new XmlElement(*plugin_message)); |
| + } |
| + |
| if (action == SESSION_INFO) { |
| if (info.get()) |
| jingle_tag->AddElement(new XmlElement(*info.get())); |