diff options
| author | Richard Maudsley <richard.maudsley@isode.com> | 2014-04-28 08:36:39 (GMT) |
|---|---|---|
| committer | Richard Maudsley <richard.maudsley@isode.com> | 2014-04-28 15:23:59 (GMT) |
| commit | be642f17bfa2df7cb88ddb5fb4aa37438d9e2110 (patch) | |
| tree | c11e239dfcfcab2b38b64e6a19ffb48e8c30c44d /Swiften/Serializer/StreamErrorSerializer.cpp | |
| parent | 64511948b075e650cacfcc78e40371abee1d2716 (diff) | |
| download | swift-contrib-be642f17bfa2df7cb88ddb5fb4aa37438d9e2110.zip swift-contrib-be642f17bfa2df7cb88ddb5fb4aa37438d9e2110.tar.bz2 | |
Create ToplevelElement to replace Element.
Change-Id: I3460f6f4a2ffa9b795080664f49d9138440de72d
Diffstat (limited to 'Swiften/Serializer/StreamErrorSerializer.cpp')
| -rw-r--r-- | Swiften/Serializer/StreamErrorSerializer.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Swiften/Serializer/StreamErrorSerializer.cpp b/Swiften/Serializer/StreamErrorSerializer.cpp index b3d62a0..37ac3ca 100644 --- a/Swiften/Serializer/StreamErrorSerializer.cpp +++ b/Swiften/Serializer/StreamErrorSerializer.cpp @@ -1,53 +1,53 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #include <Swiften/Serializer/StreamErrorSerializer.h> #include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Serializer/XML/XMLElement.h> namespace Swift { StreamErrorSerializer::StreamErrorSerializer() : GenericElementSerializer<StreamError>() { } -SafeByteArray StreamErrorSerializer::serialize(boost::shared_ptr<Element> element) const { +SafeByteArray StreamErrorSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { StreamError::ref error = boost::dynamic_pointer_cast<StreamError>(element); XMLElement errorElement("error", "http://etherx.jabber.org/streams"); std::string typeTag; switch (error->getType()) { case StreamError::BadFormat: typeTag = "bad-format"; break; case StreamError::BadNamespacePrefix: typeTag = "bad-namespace-prefix"; break; case StreamError::Conflict: typeTag = "conflict"; break; case StreamError::ConnectionTimeout: typeTag = "connection-timeout"; break; case StreamError::HostGone: typeTag = "host-gone"; break; case StreamError::HostUnknown: typeTag = "host-unknown"; break; case StreamError::ImproperAddressing: typeTag = "improper-addressing"; break; case StreamError::InternalServerError: typeTag = "internal-server-error"; break; case StreamError::InvalidFrom: typeTag = "invalid-from"; break; case StreamError::InvalidID: typeTag = "invalid-id"; break; case StreamError::InvalidNamespace: typeTag = "invalid-namespace"; break; case StreamError::InvalidXML: typeTag = "invalid-xml"; break; case StreamError::NotAuthorized: typeTag = "not-authorized"; break; case StreamError::NotWellFormed: typeTag = "not-well-formed"; break; case StreamError::PolicyViolation: typeTag = "policy-violation"; break; case StreamError::RemoteConnectionFailed: typeTag = "remote-connection-failed"; break; case StreamError::Reset: typeTag = "reset"; break; case StreamError::ResourceConstraint: typeTag = "resource-constraint"; break; case StreamError::RestrictedXML: typeTag = "restricted-xml"; break; case StreamError::SeeOtherHost: typeTag = "see-other-host"; break; case StreamError::SystemShutdown: typeTag = "system-shutdown"; break; case StreamError::UndefinedCondition: typeTag = "undefined-condition"; break; case StreamError::UnsupportedEncoding: typeTag = "unsupported-encoding"; break; case StreamError::UnsupportedStanzaType: typeTag = "unsupported-stanza-type"; break; case StreamError::UnsupportedVersion: typeTag = "unsupported-version"; break; } errorElement.addNode(boost::make_shared<XMLElement>(typeTag, "urn:ietf:params:xml:ns:xmpp-streams")); if (!error->getText().empty()) { errorElement.addNode(boost::make_shared<XMLElement>("text", "urn:ietf:params:xml:ns:xmpp-streams", error->getText())); |
Swift