@@ 20,6 20,7 @@ module Network.Protocol.XMPP.Component
( runComponent
) where
+import Control.Applicative ((<|>))
import Control.Monad (when)
import Control.Monad.Error (throwError)
import Data.Bits (shiftR, (.&.))
@@ 62,9 63,11 @@ beginStream jid = do
Just x -> return x
parseStreamID :: X.Event -> Maybe Text
-parseStreamID (X.EventBeginElement name attrs) = X.attributeText
- "{jabber:component:accept}jid"
- (X.Element name attrs [])
+parseStreamID (X.EventBeginElement name attrs) = withNS <|> withoutNS
+ where
+ -- Hack to allow for global namespace without implementing full handling
+ withoutNS = X.attributeText "id" (X.Element name attrs [])
+ withNS = X.attributeText "{jabber:component:accept}id" (X.Element name attrs [])
parseStreamID _ = Nothing
authenticate :: Text -> Text -> M.XMPP ()