From 665016ccc08724f10f38d1bfa8e5e9ace37ff811 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Sat, 25 Apr 2009 16:29:49 +0000
Subject: [PATCH] don't overwrite stanza ID in zeroconf so that we reply with
 correct ID to requests. Thanks Mattj

---
 src/common/zeroconf/client_zeroconf.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/common/zeroconf/client_zeroconf.py b/src/common/zeroconf/client_zeroconf.py
index a643454fac..7b3459cdeb 100644
--- a/src/common/zeroconf/client_zeroconf.py
+++ b/src/common/zeroconf/client_zeroconf.py
@@ -689,8 +689,9 @@ class ClientZeroconf:
 		# look for hashed connections
 		if to in self.recipient_to_hash:
 			conn = self.connections[self.recipient_to_hash[to]]
-			id_ = conn.Dispatcher.getAnID()
-			stanza.setID(id_)
+			if not stanza.getID():
+				id_ = conn.Dispatcher.getAnID()
+				stanza.setID(id_)
 			if conn.add_stanza(stanza, is_message):
 				if on_ok:
 					on_ok(id_)
@@ -699,14 +700,16 @@ class ClientZeroconf:
 			hash_ = self.ip_to_hash[item['address']]
 			if self.hash_to_port[hash_] == item['port']:
 				conn = self.connections[hash_]
-				id_ = conn.Dispatcher.getAnID()
-				stanza.setID(id_)
+				if not stanza.getID():
+					id_ = conn.Dispatcher.getAnID()
+					stanza.setID(id_)
 				if conn.add_stanza(stanza, is_message):
 					if on_ok:
 						on_ok(id_)
 
 		# otherwise open new connection
-		stanza.setID('zero')
+		if not stanza.getID():
+			stanza.setID('zero')
 		P2PClient(None, item['address'], item['port'], self,
 			[(stanza, is_message)], to, on_ok=on_ok, on_not_ok=on_not_ok)
 
-- 
GitLab