diff --git a/source/Network/Xmpp.hs b/source/Network/Xmpp.hs index b673831..dc0cb0d 100644 --- a/source/Network/Xmpp.hs +++ b/source/Network/Xmpp.hs @@ -180,6 +180,6 @@ auth :: Text.Text -- ^ The username -> XmppConMonad (Either AuthError Jid) auth username passwd resource = runErrorT $ do ErrorT $ xmppSasl [scramSha1 username Nothing passwd] - res <- lift $ xmppBind resource + jid <- lift $ xmppBind resource lift $ xmppStartSession - return res + return jid diff --git a/source/Network/Xmpp/Bind.hs b/source/Network/Xmpp/Bind.hs index d09d82d..cf00495 100644 --- a/source/Network/Xmpp/Bind.hs +++ b/source/Network/Xmpp/Bind.hs @@ -13,6 +13,8 @@ import Network.Xmpp.Types import Network.Xmpp.Pickle import Network.Xmpp.Monad +import Control.Monad.State(modify) + -- Produces a `bind' element, optionally wrapping a resource. bindBody :: Maybe Text -> Element bindBody = pickleElem $ @@ -29,6 +31,7 @@ xmppBind rsrc = do answer <- xmppSendIQ' "bind" Nothing Set Nothing (bindBody rsrc) let Right IQResult{iqResultPayload = Just b} = answer -- TODO: Error handling let Right jid = unpickleElem jidP b + modify (\s -> s{sJid = Just jid}) return jid where -- Extracts the character data in the `jid' element.