diff options
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp')
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp index 76909c7..e57fd12 100644 --- a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp @@ -20,29 +20,29 @@ DiscoInfoSerializer::DiscoInfoSerializer() : GenericPayloadSerializer<DiscoInfo> } std::string DiscoInfoSerializer::serializePayload(boost::shared_ptr<DiscoInfo> discoInfo) const { - XMLElement queryElement("query", "http://jabber.org/protocol/disco#info"); - if (!discoInfo->getNode().empty()) { - queryElement.setAttribute("node", discoInfo->getNode()); - } - foreach(const DiscoInfo::Identity& identity, discoInfo->getIdentities()) { - boost::shared_ptr<XMLElement> identityElement(new XMLElement("identity")); - if (!identity.getLanguage().empty()) { - identityElement->setAttribute("xml:lang", identity.getLanguage()); - } - identityElement->setAttribute("category", identity.getCategory()); - identityElement->setAttribute("name", identity.getName()); - identityElement->setAttribute("type", identity.getType()); - queryElement.addNode(identityElement); - } - foreach(const std::string& feature, discoInfo->getFeatures()) { - boost::shared_ptr<XMLElement> featureElement(new XMLElement("feature")); - featureElement->setAttribute("var", feature); - queryElement.addNode(featureElement); - } - foreach(const Form::ref extension, discoInfo->getExtensions()) { - queryElement.addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(extension))); - } - return queryElement.serialize(); + XMLElement queryElement("query", "http://jabber.org/protocol/disco#info"); + if (!discoInfo->getNode().empty()) { + queryElement.setAttribute("node", discoInfo->getNode()); + } + foreach(const DiscoInfo::Identity& identity, discoInfo->getIdentities()) { + boost::shared_ptr<XMLElement> identityElement(new XMLElement("identity")); + if (!identity.getLanguage().empty()) { + identityElement->setAttribute("xml:lang", identity.getLanguage()); + } + identityElement->setAttribute("category", identity.getCategory()); + identityElement->setAttribute("name", identity.getName()); + identityElement->setAttribute("type", identity.getType()); + queryElement.addNode(identityElement); + } + foreach(const std::string& feature, discoInfo->getFeatures()) { + boost::shared_ptr<XMLElement> featureElement(new XMLElement("feature")); + featureElement->setAttribute("var", feature); + queryElement.addNode(featureElement); + } + foreach(const Form::ref extension, discoInfo->getExtensions()) { + queryElement.addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(extension))); + } + return queryElement.serialize(); } } |