Browse Source

stopped using idna2008 as clients don't have to support internationalization

master
Jon Kristensen 15 years ago
parent
commit
e3514ee1dc
  1. 14
      Network/XMPP/Address.hs
  2. 2
      pontarius-xmpp.cabal

14
Network/XMPP/Address.hs

@ -3,8 +3,6 @@
{-# OPTIONS_HADDOCK hide #-} {-# OPTIONS_HADDOCK hide #-}
-- TODO: Move away from stringprep for all three profiles.
-- TODO: When no longer using stringprep, do appropriate testing. (Including -- TODO: When no longer using stringprep, do appropriate testing. (Including
-- testing addresses like a@b/c@d/e, a/b@c, a@/b, a/@b...) -- testing addresses like a@b/c@d/e, a/b@c, a@/b, a/@b...)
@ -14,8 +12,7 @@
-- This module deals with XMPP addresses (also known as JIDs and JabberIDs). For -- This module deals with XMPP addresses (also known as JIDs and JabberIDs). For
-- more information on XMPP addresses, see RFC 6122: XMPP: Address Format. -- more information on XMPP addresses, see RFC 6122: XMPP: Address Format.
-- --
-- Provided hostnames may contain international characters; Pontarius XMPP will -- This module does not internationalize hostnames.
-- try to convert such hostnames to internationalized hostnames.
module Network.XMPP.Address (fromString, fromStrings, isBare, isFull) where module Network.XMPP.Address (fromString, fromStrings, isBare, isFull) where
@ -30,8 +27,6 @@ import Text.StringPrep (StringPrepProfile (..), a1, b1, b2, c11, c12, c21, c22,
c3, c4, c5, c6, c7, c8, c9, runStringPrep) c3, c4, c5, c6, c7, c8, c9, runStringPrep)
import Text.NamePrep (namePrepProfile) import Text.NamePrep (namePrepProfile)
import Data.Text.IDNA2008 (toASCII)
import Network.URI (isIPv4address, isIPv6address) import Network.URI (isIPv4address, isIPv6address)
import qualified Data.ByteString.Char8 as DBC (pack) import qualified Data.ByteString.Char8 as DBC (pack)
@ -92,7 +87,8 @@ fromStrings l s r
-- function was successful, or Nothing otherwise. -- function was successful, or Nothing otherwise.
domainpart' :: Maybe String domainpart' :: Maybe String
domainpart' | isIPv4address s || isIPv6address s = Just s domainpart' | isIPv4address s || isIPv6address s = Just s
| otherwise = toASCII s | validHostname s = Just s
| otherwise = Nothing
-- Validates that non-domainpart strings have an appropriate length. -- Validates that non-domainpart strings have an appropriate length.
validateNonDomainpart :: Maybe String -> Bool validateNonDomainpart :: Maybe String -> Bool
@ -102,6 +98,10 @@ fromStrings l s r
validPartLength :: String -> Bool validPartLength :: String -> Bool
validPartLength p = length p > 0 && length p < 1024 validPartLength p = length p > 0 && length p < 1024
-- Validates a host name
validHostname :: String -> Bool
validHostname _ = True -- TODO
-- | Returns True if the address is `bare', and False otherwise. -- | Returns True if the address is `bare', and False otherwise.

2
pontarius-xmpp.cabal

@ -31,7 +31,7 @@ Library
base64-string, pureMD5, utf8-string, network, xml-types, base64-string, pureMD5, utf8-string, network, xml-types,
text, transformers, bytestring, cereal ==0.3.3.0, random, text, transformers, bytestring, cereal ==0.3.3.0, random,
xml-enumerator, tls, tls-extra, containers, mtl, text-icu, xml-enumerator, tls, tls-extra, containers, mtl, text-icu,
stringprep, idna2008 ==0.0.1.0, asn1-data, cryptohash ==0.7.0, stringprep, asn1-data, cryptohash ==0.7.0,
time, certificate, ranges, uuid time, certificate, ranges, uuid
-- Other-Modules: -- Other-Modules:
-- HS-Source-Dirs: -- HS-Source-Dirs:

Loading…
Cancel
Save