From 7657d473ee01d087028cd7c99abd9c42b9552d3f Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Mon, 10 Mar 2014 21:47:21 +0100
Subject: [PATCH] ignore attention (XEP-224) when messages is delayed

---
 src/common/connection_handlers_events.py | 5 ++++-
 src/common/protocol/bytestream.py        | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/common/connection_handlers_events.py b/src/common/connection_handlers_events.py
index c8f2ecfdc2..9c68092f86 100644
--- a/src/common/connection_handlers_events.py
+++ b/src/common/connection_handlers_events.py
@@ -1312,7 +1312,10 @@ class DecryptedMessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
             self.displaymarking = self.seclabel.getTag('displaymarking')
 
         if self.stanza.getTag('attention', namespace=nbxmpp.NS_ATTENTION):
-            self.attention = True
+            delayed = self.stanza.getTag('x', namespace=nbxmpp.NS_DELAY) is not\
+                None
+            if not delayed:
+                self.attention = True
 
         self.form_node = self.stanza.getTag('x', namespace=nbxmpp.NS_DATA)
 
diff --git a/src/common/protocol/bytestream.py b/src/common/protocol/bytestream.py
index 016f93c823..7714fa4d39 100644
--- a/src/common/protocol/bytestream.py
+++ b/src/common/protocol/bytestream.py
@@ -468,6 +468,9 @@ class ConnectionSocks5Bytestream(ConnectionBytestream):
                 if listener:
                     self._add_streamhosts_to_query(query, sender, ext_port,
                         [ext_ip])
+            else:
+                self._add_streamhosts_to_query(query, file_props.sender,
+                    ext_port, [ext_ip])
             self.connection.send(iq)
             cleanup_gupnp()
 
-- 
GitLab