From e7eff3ea50f05132649b3c7a42e49528ef6de65f Mon Sep 17 00:00:00 2001 From: Jon Kristensen Date: Thu, 7 Jun 2012 20:48:00 +0200 Subject: [PATCH] fixed stream features unpickle bug that appeared when no stream:features element was provided by the server --- source/Network/Xmpp/Stream.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/Network/Xmpp/Stream.hs b/source/Network/Xmpp/Stream.hs index 74d9b0e..0880717 100644 --- a/source/Network/Xmpp/Stream.hs +++ b/source/Network/Xmpp/Stream.hs @@ -110,12 +110,14 @@ pickleStreamFeatures :: PU [Node] ServerFeatures pickleStreamFeatures = xpWrap (\(tls, sasl, rest) -> SF tls (mbl sasl) rest) (\(SF tls sasl rest) -> (tls, lmb sasl, rest)) - (xpElemNodes (Name - "features" (Just "http://etherx.jabber.org/streams") (Just "stream")) - (xpTriple - (xpOption pickleTLSFeature) - (xpOption pickleSaslFeature) - (xpAll xpElemVerbatim) + (xpDefault (Nothing, Nothing, []) -- In case there is no features element. + (xpElemNodes (Name + "features" (Just "http://etherx.jabber.org/streams") (Just "stream")) + (xpTriple + (xpOption pickleTLSFeature) + (xpOption pickleSaslFeature) + (xpAll xpElemVerbatim) + ) ) ) where