summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-05-18 16:22:06 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-05-18 16:50:18 (GMT)
commit8472194d716e0e3b95a66bf5be45c246ee79d0af (patch)
treeb9f473e0e606b012ee5013e85d2cf5e7523b7029 /Swiften/Serializer/AuthRequestSerializer.cpp
parentb1b3b8f88517ad8b14795cc8a6265962d2935be3 (diff)
downloadswift-8472194d716e0e3b95a66bf5be45c246ee79d0af.zip
swift-8472194d716e0e3b95a66bf5be45c246ee79d0af.tar.bz2
Propagate use of SafeByteArray down to the connection.
Diffstat (limited to 'Swiften/Serializer/AuthRequestSerializer.cpp')
-rw-r--r--Swiften/Serializer/AuthRequestSerializer.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/Swiften/Serializer/AuthRequestSerializer.cpp b/Swiften/Serializer/AuthRequestSerializer.cpp
index 33bdd77..e38dc85 100644
--- a/Swiften/Serializer/AuthRequestSerializer.cpp
+++ b/Swiften/Serializer/AuthRequestSerializer.cpp
@@ -8,15 +8,16 @@
#include <Swiften/Elements/AuthRequest.h>
#include <Swiften/StringCodecs/Base64.h>
-#include <Swiften/Base/ByteArray.h>
+#include <Swiften/Base/SafeByteArray.h>
#include <Swiften/Base/SafeString.h>
+#include <Swiften/Base/Concat.h>
namespace Swift {
AuthRequestSerializer::AuthRequestSerializer() {
}
-std::string AuthRequestSerializer::serialize(boost::shared_ptr<Element> element) const {
+SafeString AuthRequestSerializer::serialize(boost::shared_ptr<Element> element) const {
boost::shared_ptr<AuthRequest> authRequest(boost::dynamic_pointer_cast<AuthRequest>(element));
SafeString value;
boost::optional<SafeByteArray> message = authRequest->getMessage();
@@ -28,7 +29,7 @@ std::string AuthRequestSerializer::serialize(boost::shared_ptr<Element> element)
value = Base64::encode(*message);
}
}
- return "<auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"" + authRequest->getMechanism() + "\">" + value.toString() + "</auth>";
+ return concat(SafeString("<auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"" + authRequest->getMechanism() + "\">"), value, SafeString("</auth>"));
}
}