diff options
Diffstat (limited to 'Presence/XMPPServer.hs')
-rw-r--r-- | Presence/XMPPServer.hs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Presence/XMPPServer.hs b/Presence/XMPPServer.hs index 1f88fb9c..6176bbe6 100644 --- a/Presence/XMPPServer.hs +++ b/Presence/XMPPServer.hs | |||
@@ -51,7 +51,7 @@ import qualified Data.Conduit.List as CL | |||
51 | import qualified Data.Conduit.Binary as CB | 51 | import qualified Data.Conduit.Binary as CB |
52 | import Data.Conduit.Blaze (builderToByteStringFlush) | 52 | import Data.Conduit.Blaze (builderToByteStringFlush) |
53 | 53 | ||
54 | import qualified Text.XML.Stream.Render as XML | 54 | import qualified Text.XML.Stream.Render as XML hiding (content) |
55 | import qualified Text.XML.Stream.Parse as XML | 55 | import qualified Text.XML.Stream.Parse as XML |
56 | import Data.XML.Types as XML | 56 | import Data.XML.Types as XML |
57 | import Data.Maybe | 57 | import Data.Maybe |
@@ -77,6 +77,7 @@ import EventUtil | |||
77 | import ControlMaybe | 77 | import ControlMaybe |
78 | import LockedChan | 78 | import LockedChan |
79 | import PeerResolve | 79 | import PeerResolve |
80 | import Blaze.ByteString.Builder (Builder) | ||
80 | 81 | ||
81 | peerport :: PortNumber | 82 | peerport :: PortNumber |
82 | peerport = 5269 | 83 | peerport = 5269 |
@@ -247,13 +248,17 @@ wlog s = putStrLn s >> hFlush stdout | |||
247 | wlogb :: ByteString -> IO () | 248 | wlogb :: ByteString -> IO () |
248 | wlogb s = Strict8.putStrLn s >> hFlush stdout | 249 | wlogb s = Strict8.putStrLn s >> hFlush stdout |
249 | 250 | ||
251 | renderBuilderFlush :: Monad m => XML.RenderSettings -> Conduit (Flush Event) m (Flush Builder) | ||
252 | renderBuilderFlush = undefined | ||
253 | |||
250 | xmlStream :: ReadCommand -> WriteCommand -> ( Source IO XML.Event | 254 | xmlStream :: ReadCommand -> WriteCommand -> ( Source IO XML.Event |
251 | , Sink (Flush XML.Event) IO () ) | 255 | , Sink (Flush XML.Event) IO () ) |
252 | xmlStream conread conwrite = (xsrc,xsnk) | 256 | xmlStream conread conwrite = (xsrc,xsnk) |
253 | where | 257 | where |
254 | xsrc = src $= XML.parseBytes XML.def | 258 | xsrc = src $= XML.parseBytes XML.def |
259 | xsnk :: Sink (Flush Event) IO () | ||
255 | xsnk = -- XML.renderBytes XML.def =$ snk | 260 | xsnk = -- XML.renderBytes XML.def =$ snk |
256 | XML.renderBuilderFlush XML.def | 261 | renderBuilderFlush XML.def |
257 | =$= builderToByteStringFlush | 262 | =$= builderToByteStringFlush |
258 | =$= discardFlush | 263 | =$= discardFlush |
259 | =$ snk | 264 | =$ snk |
@@ -271,7 +276,7 @@ xmlStream conread conwrite = (xsrc,xsnk) | |||
271 | (\v -> yield v >> src) | 276 | (\v -> yield v >> src) |
272 | v | 277 | v |
273 | snk = awaitForever $ liftIO . conwrite | 278 | snk = awaitForever $ liftIO . conwrite |
274 | 279 | ||
275 | 280 | ||
276 | type FlagCommand = STM Bool | 281 | type FlagCommand = STM Bool |
277 | type ReadCommand = IO (Maybe ByteString) | 282 | type ReadCommand = IO (Maybe ByteString) |