From 721f33c5cfb6153da4b3fba8c166d700ca800459 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Tue, 14 Feb 2012 19:35:09 +0100 Subject: [PATCH] fix traceback. Fixes #7103 --- src/common/zeroconf/client_zeroconf.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/common/zeroconf/client_zeroconf.py b/src/common/zeroconf/client_zeroconf.py index c5049c6fc..b91b98c21 100644 --- a/src/common/zeroconf/client_zeroconf.py +++ b/src/common/zeroconf/client_zeroconf.py @@ -803,11 +803,19 @@ class ClientZeroconf: def on_ok(_waitid): # if timeout: # self._owner.set_timeout(timeout) - to = stanza.getTo() + to = unicode(stanza.getTo()) + to = gajim.get_jid_without_resource(to) + + try: + item = self.roster[to] + except KeyError: + # Contact offline + item = None + conn = None if to in self.recipient_to_hash: conn = self.connections[self.recipient_to_hash[to]] - elif item['address'] in self.ip_to_hash: + elif item and item['address'] in self.ip_to_hash: hash_ = self.ip_to_hash[item['address']] if self.hash_to_port[hash_] == item['port']: conn = self.connections[hash_]