diff options
author | Remko Tronçon <git@el-tramo.be> | 2012-05-05 07:11:25 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2012-05-05 07:11:25 (GMT) |
commit | 1824826fffbe9ebf508264db13843bd1a94f0778 (patch) | |
tree | 418ce84968cfd33c2ca160a58bf70a498e066f5c /Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp | |
parent | 14215c76b373ee8bbb7e73d4577f40eec01f5d85 (diff) | |
download | swift-contrib-1824826fffbe9ebf508264db13843bd1a94f0778.zip swift-contrib-1824826fffbe9ebf508264db13843bd1a94f0778.tar.bz2 |
Serialize error payload.
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp')
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp index e3bfd54..fa6a566 100644 --- a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp @@ -6,10 +6,11 @@ #include <Swiften/Serializer/PayloadSerializers/ErrorSerializer.h> #include <Swiften/Serializer/XML/XMLTextNode.h> +#include <Swiften/Serializer/PayloadSerializerCollection.h> namespace Swift { -ErrorSerializer::ErrorSerializer() : GenericPayloadSerializer<ErrorPayload>() { +ErrorSerializer::ErrorSerializer(PayloadSerializerCollection* serializers) : GenericPayloadSerializer<ErrorPayload>(), serializers(serializers) { } std::string ErrorSerializer::serializePayload(boost::shared_ptr<ErrorPayload> error) const { @@ -55,6 +56,13 @@ std::string ErrorSerializer::serializePayload(boost::shared_ptr<ErrorPayload> er result += "<text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">" + textNode.serialize() + "</text>"; } + if (error->getPayload()) { + PayloadSerializer* serializer = serializers->getPayloadSerializer(error->getPayload()); + if (serializer) { + result += serializer->serialize(error->getPayload()); + } + } + result += "</error>"; return result; } |