pontarius-xmpp-extras 0.1.0.5 → 0.1.0.6
raw patch · 2 files changed
+19/−3 lines, 2 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Network.Xmpp.Extras.MUC: joinMUCResult :: Jid -> Maybe MUCHistoryReq -> Session -> IO (Either StanzaError PresenceType)
Files
Network/Xmpp/Extras/MUC.hs view
@@ -3,11 +3,12 @@ -- Portability : I'm too young to die -- XEP-0045: Multi-User Chat -{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE OverloadedStrings, RecordWildCards #-} module Network.Xmpp.Extras.MUC ( MUCHistoryReq(..) , joinMUC+ , joinMUCResult , sendMUC ) where @@ -47,6 +48,21 @@ ) []]) mhr ] } ) where elementify name show content = fmap (\s -> ("seconds", [ContentText $ T.pack $ show s])) $ maybeToList content++-- |Like `joinMUC`, but waits for the server reply.+joinMUCResult :: Jid -> Maybe MUCHistoryReq -> Session -> IO (Either StanzaError PresenceType)+joinMUCResult jid mhr sess = do+ joinMUC jid mhr sess+ waitForResult jid sess++waitForResult :: Jid -> Session -> IO (Either StanzaError PresenceType)+waitForResult jid sess = do+ pres <- pullPresence sess+ case pres of+ Left p@(PresenceError {..}) | presenceErrorFrom == Just jid -> pure $ Left presenceErrorStanzaError+ | otherwise -> waitForResult jid sess+ Right p@(Presence{..}) | presenceFrom == Just jid -> pure $ Right presenceType+ | otherwise -> waitForResult jid sess -- |Send a broadcast message. `Jid` must be bare. sendMUC :: Jid -> Text -> Session -> IO (Either XmppFailure ())
pontarius-xmpp-extras.cabal view
@@ -1,5 +1,5 @@ name: pontarius-xmpp-extras-version: 0.1.0.5+version: 0.1.0.6 synopsis: XEPs implementation on top of pontarius-xmpp -- description: license: OtherLicense@@ -18,7 +18,7 @@ Source-repository this type: git location: https://github.com/l29ah/pontarius-xmpp-extras.git- tag: 0.1.0.5+ tag: 0.1.0.6 library exposed-modules: