Browse Source

Make legacy sesion bind optional and disabled by default

master
Jon Kristensen 13 years ago
parent
commit
d06ebc86eb
  1. 6
      source/Network/Xmpp/Sasl.hs
  2. 5
      source/Network/Xmpp/Types.hs

6
source/Network/Xmpp/Sasl.hs

@ -107,7 +107,13 @@ auth :: [SaslHandler]
auth mechanisms resource con = runErrorT $ do auth mechanisms resource con = runErrorT $ do
ErrorT $ xmppSasl mechanisms con ErrorT $ xmppSasl mechanisms con
jid <- ErrorT $ xmppBind resource con jid <- ErrorT $ xmppBind resource con
ErrorT $ flip withStream con $ do
s <- get
case establishSession $ streamConfiguration s of
False -> return $ Right Nothing
True -> do
_ <- lift $ startSession con _ <- lift $ startSession con
return $ Right Nothing
return Nothing return Nothing
-- Produces a `bind' element, optionally wrapping a resource. -- Produces a `bind' element, optionally wrapping a resource.

5
source/Network/Xmpp/Types.hs

@ -1036,6 +1036,10 @@ data StreamConfiguration =
, socketDetails :: Maybe (Socket, SockAddr) , socketDetails :: Maybe (Socket, SockAddr)
-- | DNS resolver configuration -- | DNS resolver configuration
, resolvConf :: ResolvConf , resolvConf :: ResolvConf
-- | Whether or not to perform the legacy
-- session bind as defined in the (outdated)
-- RFC 3921 specification
, establishSession :: Bool
} }
@ -1044,6 +1048,7 @@ instance Default StreamConfiguration where
, toJid = Nothing , toJid = Nothing
, socketDetails = Nothing , socketDetails = Nothing
, resolvConf = defaultResolvConf , resolvConf = defaultResolvConf
, establishSession = False
} }
data Hostname = Hostname Text deriving (Eq, Show) data Hostname = Hostname Text deriving (Eq, Show)

Loading…
Cancel
Save