summaryrefslogtreecommitdiffstats
blob: 152607ded71aa98b073da9ac2f3b21cc4e56cdcc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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>";
}

}