summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Network')
-rw-r--r--Swiften/Network/DomainNameResolver.cpp14
-rw-r--r--Swiften/Network/DomainNameResolver.h3
-rw-r--r--Swiften/Network/PlatformDomainNameResolver.cpp5
3 files changed, 3 insertions, 19 deletions
diff --git a/Swiften/Network/DomainNameResolver.cpp b/Swiften/Network/DomainNameResolver.cpp
index 854b97f..96c5165 100644
--- a/Swiften/Network/DomainNameResolver.cpp
+++ b/Swiften/Network/DomainNameResolver.cpp
@@ -6,23 +6,9 @@
#include "Swiften/Network/DomainNameResolver.h"
-#include <idna.h>
-
namespace Swift {
DomainNameResolver::~DomainNameResolver() {
}
-String DomainNameResolver::getNormalized(const String& domain) {
- char* output;
- if (idna_to_ascii_8z(domain.getUTF8Data(), &output, 0) == IDNA_SUCCESS) {
- String result(output);
- free(output);
- return result;
- }
- else {
- return domain;
- }
-}
-
}
diff --git a/Swiften/Network/DomainNameResolver.h b/Swiften/Network/DomainNameResolver.h
index 4f8829c..cf9d521 100644
--- a/Swiften/Network/DomainNameResolver.h
+++ b/Swiften/Network/DomainNameResolver.h
@@ -21,8 +21,5 @@ namespace Swift {
virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const String& name) = 0;
virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const String& name) = 0;
-
- protected:
- static String getNormalized(const String& domain);
};
}
diff --git a/Swiften/Network/PlatformDomainNameResolver.cpp b/Swiften/Network/PlatformDomainNameResolver.cpp
index 44c87e0..3f72466 100644
--- a/Swiften/Network/PlatformDomainNameResolver.cpp
+++ b/Swiften/Network/PlatformDomainNameResolver.cpp
@@ -18,6 +18,7 @@
#include <algorithm>
#include "Swiften/Base/String.h"
+#include "Swiften/IDN/IDNA.h"
#include "Swiften/Network/HostAddress.h"
#include "Swiften/EventLoop/EventLoop.h"
#include "Swiften/Network/HostAddressPort.h"
@@ -95,11 +96,11 @@ PlatformDomainNameResolver::PlatformDomainNameResolver(EventLoop* eventLoop) : e
}
boost::shared_ptr<DomainNameServiceQuery> PlatformDomainNameResolver::createServiceQuery(const String& name) {
- return boost::shared_ptr<DomainNameServiceQuery>(new PlatformDomainNameServiceQuery(getNormalized(name), eventLoop));
+ return boost::shared_ptr<DomainNameServiceQuery>(new PlatformDomainNameServiceQuery(IDNA::getEncoded(name), eventLoop));
}
boost::shared_ptr<DomainNameAddressQuery> PlatformDomainNameResolver::createAddressQuery(const String& name) {
- return boost::shared_ptr<DomainNameAddressQuery>(new AddressQuery(getNormalized(name), eventLoop));
+ return boost::shared_ptr<DomainNameAddressQuery>(new AddressQuery(IDNA::getEncoded(name), eventLoop));
}
}