Browse Source

merge branch '0.3.0.2-entityre_in_attr' of git://github.com/hiratara/pontarius-xmpp into merge

Conflicts:
	source/Network/Xmpp/Stream.hs
master
Philipp Balzarek 12 years ago
parent
commit
32df2f7ef6
  1. 10
      source/Network/Xmpp/Stream.hs

10
source/Network/Xmpp/Stream.hs

@ -827,7 +827,8 @@ elements = do
goE n as = do goE n as = do
(y, ns) <- many' goN (y, ns) <- many' goN
if y == Just (EventEndElement n) if y == Just (EventEndElement n)
then return $ Element n as $ compressNodes ns then return $ Element n (map (id >< compressContents) as)
(compressNodes ns)
else throwError . XmppInvalidXml $ "Missing close tag: " ++ show n else throwError . XmppInvalidXml $ "Missing close tag: " ++ show n
goN = do goN = do
x <- await x <- await
@ -846,6 +847,13 @@ elements = do
compressNodes $ NodeContent (ContentText $ x `Text.append` y) : z compressNodes $ NodeContent (ContentText $ x `Text.append` y) : z
compressNodes (x:xs) = x : compressNodes xs compressNodes (x:xs) = x : compressNodes xs
compressContents :: [Content] -> [Content]
compressContents cs = [ContentText $ Text.concat (map unwrap cs)]
where unwrap (ContentText t) = t
unwrap (ContentEntity t) = t
(><) f g (x, y) = (f x, g y)
withStream :: StateT StreamState IO a -> Stream -> IO a withStream :: StateT StreamState IO a -> Stream -> IO a
withStream action (Stream stream) = Ex.bracketOnError withStream action (Stream stream) = Ex.bracketOnError
(atomically $ takeTMVar stream ) (atomically $ takeTMVar stream )

Loading…
Cancel
Save