diff options
Diffstat (limited to 'Swiften/Serializer/AuthSuccessSerializer.cpp')
-rw-r--r-- | Swiften/Serializer/AuthSuccessSerializer.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Swiften/Serializer/AuthSuccessSerializer.cpp b/Swiften/Serializer/AuthSuccessSerializer.cpp new file mode 100644 index 0000000..6d7f195 --- /dev/null +++ b/Swiften/Serializer/AuthSuccessSerializer.cpp @@ -0,0 +1,17 @@ +#include "Swiften/Serializer/AuthSuccessSerializer.h" + +#include "Swiften/Elements/AuthSuccess.h" +#include "Swiften/StringCodecs/Base64.h" + +namespace Swift { + +AuthSuccessSerializer::AuthSuccessSerializer() { +} + +String AuthSuccessSerializer::serialize(boost::shared_ptr<Element> element) const { + boost::shared_ptr<AuthSuccess> authRequest(boost::dynamic_pointer_cast<AuthSuccess>(element)); + String value = (authRequest->getValue().isEmpty() ? "=" : Base64::encode(authRequest->getValue())); + return "<success xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">" + value + "</challenge>"; +} + +} |