From 008398e75fea3b107a87eaa3c69e86a2654cf48c Mon Sep 17 00:00:00 2001 From: Philipp Balzarek Date: Sun, 12 May 2013 17:03:56 +0200 Subject: [PATCH] export nsHack from Network.Xmpp.Stream --- source/Network/Xmpp/Stream.hs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/source/Network/Xmpp/Stream.hs b/source/Network/Xmpp/Stream.hs index bbd5790..88a9e81 100644 --- a/source/Network/Xmpp/Stream.hs +++ b/source/Network/Xmpp/Stream.hs @@ -353,14 +353,18 @@ pushElement x = do -- HACK: We remove the "jabber:client" namespace because it is set as -- default in the stream. This is to make isode's M-LINK server happy and -- should be removed once jabber.org accepts prefix-free canonicalization - nsHack e@(Element{elementName = n}) - | nameNamespace n == Just "jabber:client" = - e{ elementName = Name (nameLocalName n) Nothing Nothing - , elementNodes = map mapNSHack $ elementNodes e - } - | otherwise = e - mapNSHack (NodeElement e) = NodeElement $ nsHack e - mapNSHack n = n + +nsHack :: Element -> Element +nsHack e@(Element{elementName = n}) + | nameNamespace n == Just "jabber:client" = + e{ elementName = Name (nameLocalName n) Nothing Nothing + , elementNodes = map mapNSHack $ elementNodes e + } + | otherwise = e + where + mapNSHack :: Node -> Node + mapNSHack (NodeElement el) = NodeElement $ nsHack el + mapNSHack nd = nd -- | Encode and send stanza pushStanza :: Stanza -> Stream -> IO (Either XmppFailure Bool)