summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Base/URL.cpp')
-rw-r--r--Swiften/Base/URL.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/Swiften/Base/URL.cpp b/Swiften/Base/URL.cpp
index c36863f..28fe6d3 100644
--- a/Swiften/Base/URL.cpp
+++ b/Swiften/Base/URL.cpp
@@ -87,6 +87,28 @@ URL URL::fromString(const std::string& urlString) {
}
}
+// FIXME: Escape non-ascii characters
+std::string URL::toString() const {
+ if (empty) {
+ return "";
+ }
+ std::string result = scheme + "://";
+ if (!user.empty()) {
+ result += user;
+ if (!password.empty()) {
+ result += ":" + password;
+ }
+ result += "@";
+ }
+ result += host;
+ if (port) {
+ result += ":";
+ result += boost::lexical_cast<std::string>(*port);
+ }
+ result += path;
+ return result;
+}
+
// Disabling this code for now, since GCC4.5+boost1.42 (on ubuntu) seems to
// result in a bug. Replacing it with naive code.
#if 0