diff options
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; } |