From f0346b92e9528d2324089de0ef8de2d19d536528 Mon Sep 17 00:00:00 2001 From: Jon Kristensen Date: Wed, 15 May 2013 15:12:48 +0200 Subject: [PATCH] answerMessage: Set "from" to Nothing For some reason, answerMessage used to set messageFrom = messageTo, while I believe that it should just set it to Nothing (the server will set the "from" attribute for us). Fixes #7. --- source/Network/Xmpp/Stanza.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/Network/Xmpp/Stanza.hs b/source/Network/Xmpp/Stanza.hs index ab3c68f..4f35021 100644 --- a/source/Network/Xmpp/Stanza.hs +++ b/source/Network/Xmpp/Stanza.hs @@ -58,12 +58,13 @@ presenceOnline = presence presenceOffline :: Presence presenceOffline = presence {presenceType = Just Unavailable} --- | Produce an answer message with the given payload, switching the "from" and +-- | Produce an answer message with the given payload, setting "from" to the -- "to" attributes in the original message. Produces a 'Nothing' value of the --- provided message message has no from attribute. +-- provided message message has no "from" attribute. Sets the "from" attribute +-- to 'Nothing' to let the server assign one. answerMessage :: Message -> [Element] -> Maybe Message answerMessage Message{messageFrom = Just frm, ..} payload = - Just Message{ messageFrom = messageTo + Just Message{ messageFrom = Nothing , messageID = Nothing , messageTo = Just frm , messagePayload = payload