Browse Source

Parse version numbers properly; allow for >=1.1 and <2.0 versions

Fixes #50.
master
Jon Kristensen 12 years ago
parent
commit
0afba3f39a
  1. 9
      source/Network/Xmpp/Stream.hs
  2. 1
      source/Network/Xmpp/Types.hs

9
source/Network/Xmpp/Stream.hs

@ -134,10 +134,13 @@ startStream = runErrorT $ do
response <- ErrorT $ runEventsSink $ streamS expectedTo response <- ErrorT $ runEventsSink $ streamS expectedTo
case response of case response of
Right (ver, from, to, sid, lt, features) Right (ver, from, to, sid, lt, features)
| (Text.unpack ver) /= "1.0" -> | versionFromText ver == Nothing -> closeStreamWithError
StreamUnsupportedVersion Nothing
"Unspecified version"
| let v = versionFromText ver
in isJust v && majorVersion (fromJust v) >= 2 ->
closeStreamWithError StreamUnsupportedVersion Nothing closeStreamWithError StreamUnsupportedVersion Nothing
"Unknown version" "Non-1.x version"
-- HACK: We ignore MUST-strength requirement (section 4.7.4. of RFC -- HACK: We ignore MUST-strength requirement (section 4.7.4. of RFC
-- 6120) for the sake of compatibility with jabber.org -- 6120) for the sake of compatibility with jabber.org
-- | lt == Nothing -> -- | lt == Nothing ->

1
source/Network/Xmpp/Types.hs

@ -74,6 +74,7 @@ module Network.Xmpp.Types
, parseJid , parseJid
, TlsBehaviour(..) , TlsBehaviour(..)
, AuthFailure(..) , AuthFailure(..)
, versionFromText
) where ) where
import Control.Applicative ((<$>), (<|>), many) import Control.Applicative ((<$>), (<|>), many)

Loading…
Cancel
Save