From 381d98ca9375eb7bcc0b73cd0331fd6465ff1609 Mon Sep 17 00:00:00 2001
From: Philipp Balzarek
Date: Thu, 20 Jun 2013 20:33:27 +0200
Subject: [PATCH] ignore whitespaces between elements
---
source/Network/Xmpp/Stream.hs | 3 +++
1 file changed, 3 insertions(+)
diff --git a/source/Network/Xmpp/Stream.hs b/source/Network/Xmpp/Stream.hs
index 47b0da7..9a418a0 100644
--- a/source/Network/Xmpp/Stream.hs
+++ b/source/Network/Xmpp/Stream.hs
@@ -19,6 +19,7 @@ import Control.Monad.Trans.Resource as R
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BSC8
+import Data.Char (isSpace)
import Data.Conduit
import Data.Conduit.Binary as CB
import qualified Data.Conduit.Internal as DCI
@@ -772,6 +773,8 @@ elements = do
-- This might be an XML error if the end element tag is not
-- "". TODO: We might want to check this at a later time
Just (EventEndElement _) -> lift $ R.monadThrow StreamEnd
+ Just (EventContent (ContentText ct)) | Text.all isSpace ct ->
+ elements
Nothing -> return ()
_ -> lift $ R.monadThrow $ InvalidXmppXml $ "not an element: " ++ show x
where