diff options
Diffstat (limited to 'x11/kdelibs3/patches/patch-ch')
-rw-r--r-- | x11/kdelibs3/patches/patch-ch | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/x11/kdelibs3/patches/patch-ch b/x11/kdelibs3/patches/patch-ch new file mode 100644 index 00000000000..f636954deaa --- /dev/null +++ b/x11/kdelibs3/patches/patch-ch @@ -0,0 +1,76 @@ +$NetBSD: patch-ch,v 1.1 2005/03/17 09:46:36 markd Exp $ + +--- kdecore/network/kresolver.cpp.orig 2004-11-29 06:30:44.000000000 +1300 ++++ kdecore/network/kresolver.cpp +@@ -32,6 +32,7 @@ + #include <time.h> + #include <arpa/inet.h> + #include <netinet/in.h> ++#include <stdlib.h> + + // Qt includes + #include <qapplication.h> +@@ -298,6 +299,9 @@ void KResolverResults::virtual_hook( int + /////////////////////// + // class KResolver + ++QStringList *KResolver::idnDomains = 0; ++ ++ + // default constructor + KResolver::KResolver(QObject *parent, const char *name) + : QObject(parent, name), d(new KResolverPrivate(this)) +@@ -885,10 +889,21 @@ QStrList KResolver::serviceName(int port + static QStringList splitLabels(const QString& unicodeDomain); + static QCString ToASCII(const QString& label); + static QString ToUnicode(const QString& label); +- ++ ++static QStringList *KResolver_initIdnDomains() ++{ ++ const char *kde_use_idn = getenv("KDE_USE_IDN"); ++ if (!kde_use_idn) ++ kde_use_idn = "at:ch:cn:de:dk:kr:jp:li:no:se:tw"; ++ return new QStringList(QStringList::split(':', QString::fromLatin1(kde_use_idn).lower())); ++} ++ + // implement the ToAscii function, as described by IDN documents + QCString KResolver::domainToAscii(const QString& unicodeDomain) + { ++ if (!idnDomains) ++ idnDomains = KResolver_initIdnDomains(); ++ + QCString retval; + // RFC 3490, section 4 describes the operation: + // 1) this is a query, so don't allow unassigned +@@ -897,6 +912,10 @@ QCString KResolver::domainToAscii(const + // separators. + QStringList input = splitLabels(unicodeDomain); + ++ // Do we allow IDN names for this TLD? ++ if (input.count() && !idnDomains->contains(input[input.count()-1].lower())) ++ return unicodeDomain.lower().latin1(); // No IDN allowed for this TLD ++ + // 3) decide whether to enforce the STD3 rules for chars < 0x7F + // we don't enforce + +@@ -928,6 +947,8 @@ QString KResolver::domainToUnicode(const + { + if (asciiDomain.isEmpty()) + return asciiDomain; ++ if (!idnDomains) ++ idnDomains = KResolver_initIdnDomains(); + + QString retval; + +@@ -939,6 +960,10 @@ QString KResolver::domainToUnicode(const + // separators. + QStringList input = splitLabels(asciiDomain); + ++ // Do we allow IDN names for this TLD? ++ if (input.count() && !idnDomains->contains(input[input.count()-1].lower())) ++ return asciiDomain.lower(); // No TLDs allowed ++ + // 3) decide whether to enforce the STD3 rules for chars < 0x7F + // we don't enforce + |