summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-12-04 21:49:44 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-12-04 23:52:36 (GMT)
commit897ad55ffee76c9e84ffb174d700f6182a3e7d0b (patch)
treef31e6bd601cf5f1483a3f4ad5e79a492d3a9ca3e /Swiften/Network/DomainNameResolver.cpp
parentc8802e3bef6b73d349a711b187c72aea0a3dd964 (diff)
downloadswift-contrib-897ad55ffee76c9e84ffb174d700f6182a3e7d0b.zip
swift-contrib-897ad55ffee76c9e84ffb174d700f6182a3e7d0b.tar.bz2
Implemented CAresDomainNameResolver.
Diffstat (limited to 'Swiften/Network/DomainNameResolver.cpp')
-rw-r--r--Swiften/Network/DomainNameResolver.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/Swiften/Network/DomainNameResolver.cpp b/Swiften/Network/DomainNameResolver.cpp
index 907dfc9..63ed881 100644
--- a/Swiften/Network/DomainNameResolver.cpp
+++ b/Swiften/Network/DomainNameResolver.cpp
@@ -1,8 +1,22 @@
#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;
+ }
+}
+
}