pontarius-xmpp 0.3.0.1 → 0.3.0.2
raw patch · 2 files changed
+28/−8 lines, 2 filesdep ~networkPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: network
API changes (from Hackage documentation)
Files
- pontarius-xmpp.cabal +4/−4
- source/Network/Xmpp/Stream.hs +24/−4
pontarius-xmpp.cabal view
@@ -1,5 +1,5 @@ Name: pontarius-xmpp-Version: 0.3.0.1+Version: 0.3.0.2 Cabal-Version: >= 1.6 Build-Type: Simple License: BSD3@@ -11,7 +11,7 @@ Stability: alpha Homepage: https://github.com/pontarius/pontarius-xmpp/ Bug-Reports: https://github.com/pontarius/pontarius-xmpp/issues/-Package-URL: http://www.jonkri.com/releases/pontarius-xmpp-0.3.0.1.tar.gz+Package-URL: http://www.jonkri.com/releases/pontarius-xmpp-0.3.0.2.tar.gz Synopsis: An XMPP client library Description: Pontarius XMPP is a work in progress implementation of RFC 6120 ("XMPP CORE"), RFC 6121 ("XMPP IM"), and RFC 6122 ("XMPP ADDR").@@ -56,7 +56,7 @@ , iproute >=1.2.4 , lifted-base >=0.1.0.1 , mtl >=2.0.0.0- , network >=2.4.1.0+ , network >=2.3.1.0 , pureMD5 >=2.1.2.1 , resourcet >=0.3.0 , random >=1.0.0.0@@ -121,4 +121,4 @@ Source-Repository this Type: git Location: git://github.com/pontarius/pontarius-xmpp.git- Tag: 0.3.0.1+ Tag: 0.3.0.2
source/Network/Xmpp/Stream.hs view
@@ -1,5 +1,6 @@ {-# OPTIONS_HADDOCK hide #-} +{-# LANGUAGE CPP #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TupleSections #-}@@ -607,6 +608,17 @@ "The hostname could not be validated." throwError XmppIllegalTcpDetails +showPort :: PortID -> String+#if MIN_VERSION_network(2, 4, 1)+showPort = show+#else+showPort (PortNumber x) = "PortNumber " ++ show x+showPort (Service x) = "Service " ++ show x+#if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)+showPort (UnixSocket x) = "UnixSocket " ++ show x+#endif+#endif+ -- Connects to a list of addresses and ports. Surpresses any exceptions from -- connectTcp. connectTcp :: [(HostName, PortID)] -> IO (Maybe Handle)@@ -614,7 +626,7 @@ connectTcp ((address, port):remainder) = do result <- Ex.try $ (do debugM "Pontarius.Xmpp" $ "Connecting to " ++ address ++ " on port " ++- (show port) ++ "."+ (showPort port) ++ "." connectTo address port) :: IO (Either Ex.IOException Handle) case result of Right handle -> do@@ -624,13 +636,21 @@ debugM "Pontarius.Xmpp" "Connection to HostName could not be established." connectTcp remainder +#if MIN_VERSION_dns(1, 0, 0)+fixDnsResult :: Either e a -> Maybe a+fixDnsResult = either (const Nothing) Just+#else+fixDnsResult :: Maybe a -> Maybe a+fixDnsResult = id+#endif+ -- Makes an AAAA query to acquire a IPs, and tries to connect to all of them. If -- a handle can not be acquired this way, an analogous A query is performed. -- Surpresses all IO exceptions. resolvAndConnectTcp :: ResolvSeed -> Domain -> Int -> IO (Maybe Handle) resolvAndConnectTcp resolvSeed domain port = do aaaaResults <- (Ex.try $ rethrowErrorCall $ withResolver resolvSeed $- \resolver -> lookupAAAA resolver domain) :: IO (Either Ex.IOException (Maybe [IPv6]))+ \resolver -> fmap fixDnsResult $ lookupAAAA resolver domain) :: IO (Either Ex.IOException (Maybe [IPv6])) handle <- case aaaaResults of Right Nothing -> return Nothing Right (Just ipv6s) -> connectTcp $@@ -641,7 +661,7 @@ case handle of Nothing -> do aResults <- (Ex.try $ rethrowErrorCall $ withResolver resolvSeed $- \resolver -> lookupA resolver domain) :: IO (Either Ex.IOException (Maybe [IPv4]))+ \resolver -> fmap fixDnsResult $ lookupA resolver domain) :: IO (Either Ex.IOException (Maybe [IPv4])) handle' <- case aResults of Left _ -> return Nothing Right Nothing -> return Nothing@@ -684,7 +704,7 @@ result <- Ex.try $ rethrowErrorCall $ withResolver resolvSeed $ \resolver -> do srvResult <- lookupSRV resolver $ BSC8.pack $ "_xmpp-client._tcp." ++ (Text.unpack realm) ++ "."- case srvResult of+ case fixDnsResult srvResult of Just [(_, _, _, ".")] -> do debugM "Pontarius.Xmpp" $ "\".\" SRV result returned." return $ Just []