From fdb6a888778819027ce0f3a2afcd91b1dea6690d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 5 Nov 2012 17:54:21 -0400 Subject: [PATCH] ignore Messages from our client's own jid shouldn't ever happen, but hey --- Assistant/Threads/XMPPClient.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Assistant/Threads/XMPPClient.hs b/Assistant/Threads/XMPPClient.hs index 3ef7018518..3d454d9c87 100644 --- a/Assistant/Threads/XMPPClient.hs +++ b/Assistant/Threads/XMPPClient.hs @@ -105,7 +105,7 @@ xmppClientThread urlrenderer = NamedThread "XMPPClient" $ do data XMPPEvent = GotNetMessage NetMessage | PresenceMessage Presence - | Ignorable Presence + | Ignorable ReceivedStanza | Unknown ReceivedStanza | ProtocolError ReceivedStanza deriving Show @@ -114,8 +114,8 @@ data XMPPEvent decodeStanza :: JID -> ReceivedStanza -> [XMPPEvent] decodeStanza selfjid s@(ReceivedPresence p) | presenceType p == PresenceError = [ProtocolError s] - | presenceFrom p == Nothing = [Ignorable p] - | presenceFrom p == Just selfjid = [Ignorable p] + | presenceFrom p == Nothing = [Ignorable s] + | presenceFrom p == Just selfjid = [Ignorable s] | otherwise = maybe [PresenceMessage p] decode (getGitAnnexAttrValue p) where decode (attr, v) @@ -126,7 +126,9 @@ decodeStanza selfjid s@(ReceivedPresence p) {- Things sent via presence imply a presence message, - along with their real meaning. -} impliedp v = [PresenceMessage p, v] -decodeStanza _ s@(ReceivedMessage m) +decodeStanza selfjid s@(ReceivedMessage m) + | messageFrom m == Nothing = [Ignorable s] + | messageFrom m == Just selfjid = [Ignorable s] | messageType m == MessageError = [ProtocolError s] | otherwise = maybe [Unknown s] decode (getGitAnnexAttrValue m) where