From 193e79c051e4497a20d91aa2bd3e473ae0f5dd3d Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Tue, 17 Sep 2013 12:25:43 +0300 Subject: [PATCH] network 2.3.1.0 support --- pontarius-xmpp.cabal | 2 +- source/Network/Xmpp/Stream.hs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pontarius-xmpp.cabal b/pontarius-xmpp.cabal index 03c0666..0889cea 100644 --- a/pontarius-xmpp.cabal +++ b/pontarius-xmpp.cabal @@ -56,7 +56,7 @@ Library , 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 diff --git a/source/Network/Xmpp/Stream.hs b/source/Network/Xmpp/Stream.hs index 0d3dc74..8dba80f 100644 --- a/source/Network/Xmpp/Stream.hs +++ b/source/Network/Xmpp/Stream.hs @@ -608,6 +608,17 @@ connectSrv config host = do "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) @@ -615,7 +626,7 @@ connectTcp [] = return Nothing 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