From 08a030007159cc4c073101c8b532823e5395b976 Mon Sep 17 00:00:00 2001 From: Philipp Balzarek Date: Mon, 3 Mar 2014 19:32:44 +0100 Subject: [PATCH] handle code attribute in stanza errors rfc 3920 allowed a "code" attribute in stanza errors. For compatibility, we allow for (but ignore) it. --- source/Network/Xmpp/Marshal.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/Network/Xmpp/Marshal.hs b/source/Network/Xmpp/Marshal.hs index ae4fe3d..2c9ea01 100644 --- a/source/Network/Xmpp/Marshal.hs +++ b/source/Network/Xmpp/Marshal.hs @@ -188,10 +188,12 @@ xpStanzaErrorCondition = ("xpErrorCondition" , "") xpWrapEither xpStanzaError :: PU [Node] StanzaError xpStanzaError = ("xpStanzaError" , "") xpWrap - (\(tp, (cond, txt, ext)) -> StanzaError tp cond txt ext) - (\(StanzaError tp cond txt ext) -> (tp, (cond, txt, ext))) + (\((tp, _code), (cond, txt, ext)) -> StanzaError tp cond txt ext) + (\(StanzaError tp cond txt ext) -> ((tp, Nothing), (cond, txt, ext))) (xpElem "{jabber:client}error" - (xpAttr "type" xpStanzaErrorType) + (xp2Tuple + (xpAttr "type" xpStanzaErrorType) + (xpAttribute' "code" xpId)) (xp3Tuple xpStanzaErrorCondition (xpOption $ xpElem "{jabber:client}text"