Browse Source

Make legacy sesion bind optional and disabled by default

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

8
source/Network/Xmpp/Sasl.hs

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

5
source/Network/Xmpp/Types.hs

@ -1036,6 +1036,10 @@ data StreamConfiguration = @@ -1036,6 +1036,10 @@ data StreamConfiguration =
, socketDetails :: Maybe (Socket, SockAddr)
-- | DNS resolver configuration
, 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 @@ -1044,6 +1048,7 @@ instance Default StreamConfiguration where
, toJid = Nothing
, socketDetails = Nothing
, resolvConf = defaultResolvConf
, establishSession = False
}
data Hostname = Hostname Text deriving (Eq, Show)

Loading…
Cancel
Save