diff options
Diffstat (limited to 'Swiften/Component/ComponentHandshakeGenerator.cpp')
-rw-r--r-- | Swiften/Component/ComponentHandshakeGenerator.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Swiften/Component/ComponentHandshakeGenerator.cpp b/Swiften/Component/ComponentHandshakeGenerator.cpp index 422f986..4081420 100644 --- a/Swiften/Component/ComponentHandshakeGenerator.cpp +++ b/Swiften/Component/ComponentHandshakeGenerator.cpp @@ -7,16 +7,17 @@ #include "Swiften/Component/ComponentHandshakeGenerator.h" #include "Swiften/StringCodecs/Hexify.h" #include "Swiften/StringCodecs/SHA1.h" +#include <Swiften/Base/String.h> namespace Swift { -String ComponentHandshakeGenerator::getHandshake(const String& streamID, const String& secret) { - String concatenatedString = streamID + secret; - concatenatedString.replaceAll('&', "&"); - concatenatedString.replaceAll('<', "<"); - concatenatedString.replaceAll('>', ">"); - concatenatedString.replaceAll('\'', "'"); - concatenatedString.replaceAll('"', """); +std::string ComponentHandshakeGenerator::getHandshake(const std::string& streamID, const std::string& secret) { + std::string concatenatedString = streamID + secret; + String::replaceAll(concatenatedString, '&', "&"); + String::replaceAll(concatenatedString, '<', "<"); + String::replaceAll(concatenatedString, '>', ">"); + String::replaceAll(concatenatedString, '\'', "'"); + String::replaceAll(concatenatedString, '"', """); return Hexify::hexify(SHA1::getHash(ByteArray(concatenatedString))); } |