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