Browse Source

Update to xml-picklers 0.2.2 Add LangTag to Network.Xmpp re-export list

master
Philipp Balzarek 14 years ago
parent
commit
bcbe68bcac
  1. 2
      pontarius-xmpp.cabal
  2. 1
      source/Network/Xmpp.hs
  3. 6
      source/Network/Xmpp/IM/Message.hs
  4. 2
      source/Network/Xmpp/Monad.hs
  5. 4
      source/Network/Xmpp/Pickle.hs
  6. 2
      source/Network/Xmpp/Stream.hs

2
pontarius-xmpp.cabal

@ -49,7 +49,7 @@ Library @@ -49,7 +49,7 @@ Library
, stm -any
, xml-types -any
, xml-conduit >= 1.0
, xml-picklers >= 0.2
, xml-picklers >= 0.2.2
, data-default -any
, stringprep >= 0.1.5
Exposed-modules: Network.Xmpp

1
source/Network/Xmpp.hs

@ -144,6 +144,7 @@ module Network.Xmpp @@ -144,6 +144,7 @@ module Network.Xmpp
, fork
, forkSession
-- * Misc
, LangTag(..)
, exampleParams
) where

6
source/Network/Xmpp/IM/Message.hs

@ -19,19 +19,19 @@ data MessageThread = MessageThread @@ -19,19 +19,19 @@ data MessageThread = MessageThread
data MessageSubject = MessageSubject (Maybe LangTag) Text
xpMessageSubject :: PU [Element] MessageSubject
xpMessageSubject = xpElems .
xpMessageSubject = xpUnliftElems .
xpWrap (\(l, s) -> MessageSubject l s)
(\(MessageSubject l s) -> (l,s))
$ xpElem "{jabber:client}subject" xpLangTag $ xpContent xpId
xpMessageBody :: PU [Element] MessageBody
xpMessageBody = xpElems .
xpMessageBody = xpUnliftElems .
xpWrap (\(l, s) -> MessageBody l s)
(\(MessageBody l s) -> (l,s))
$ xpElem "{jabber:client}body" xpLangTag $ xpContent xpId
xpMessageThread :: PU [Element] MessageThread
xpMessageThread = xpElems
xpMessageThread = xpUnliftElems
. xpWrap (\(t, p) -> MessageThread p t)
(\(MessageThread p t) -> (t,p))
$ xpElem "{jabber:client}thread"

2
source/Network/Xmpp/Monad.hs

@ -90,7 +90,7 @@ pullPickle :: PU [Node] a -> XmppConMonad a @@ -90,7 +90,7 @@ pullPickle :: PU [Node] a -> XmppConMonad a
pullPickle p = do
res <- unpickleElem p <$> pullElement
case res of
Left e -> liftIO . Ex.throwIO $ StreamXMLError e
Left e -> liftIO . Ex.throwIO $ StreamXMLError (show e)
Right r -> return r
-- Pulls a stanza (or stream error) from the stream. Throws an error on a stream

4
source/Network/Xmpp/Pickle.hs

@ -70,11 +70,11 @@ right (Right r) = r @@ -70,11 +70,11 @@ right (Right r) = r
unpickleElem' :: PU [Node] c -> Element -> c
unpickleElem' p x = case unpickle (xpNodeElem p) x of
Left l -> error $ l ++ "\n saw: " ++ ppElement x
Left l -> error $ (show l) ++ "\n saw: " ++ ppElement x
Right r -> r
-- Given a pickler and an element, produces an object.
unpickleElem :: PU [Node] a -> Element -> Either String a
unpickleElem :: PU [Node] a -> Element -> Either UnpickleError a
unpickleElem p x = unpickle (xpNodeElem p) x
-- Given a pickler and an object, produces an Element.

2
source/Network/Xmpp/Stream.hs

@ -33,7 +33,7 @@ streamUnpickleElem :: PU [Node] a @@ -33,7 +33,7 @@ streamUnpickleElem :: PU [Node] a
-> StreamSink a
streamUnpickleElem p x = do
case unpickleElem p x of
Left l -> throwError $ StreamXMLError l
Left l -> throwError $ StreamXMLError (show l)
Right r -> return r
-- This is the conduit sink that handles the stream XML events. We extend it

Loading…
Cancel
Save