From edccb053a8960cdf6ccf818900db248079d27e44 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Tue, 26 Oct 2010 11:25:30 +0200 Subject: [PATCH] fix roster handling with zeroconf. Fixes #5820 --- src/common/zeroconf/connection_zeroconf.py | 4 +++- src/common/zeroconf/roster_zeroconf.py | 2 ++ src/roster_window.py | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/common/zeroconf/connection_zeroconf.py b/src/common/zeroconf/connection_zeroconf.py index ed9acf725..2cb9f74c2 100644 --- a/src/common/zeroconf/connection_zeroconf.py +++ b/src/common/zeroconf/connection_zeroconf.py @@ -47,6 +47,7 @@ from common import GnuPG from common.zeroconf import client_zeroconf from common.zeroconf import zeroconf from connection_handlers_zeroconf import * +from common.connection_handlers_events import * import locale @@ -210,7 +211,8 @@ class ConnectionZeroconf(CommonConnection, ConnectionHandlersZeroconf): else: self.connection.announce() self.roster = self.connection.getRoster() - self.dispatch('ROSTER', self.roster) + gajim.nec.push_incoming_event(RosterReceivedEvent(None, conn=self, + xmpp_roster=self.roster)) # display contacts already detected and resolved for jid in self.roster.keys(): diff --git a/src/common/zeroconf/roster_zeroconf.py b/src/common/zeroconf/roster_zeroconf.py index 17325192e..307fd392e 100644 --- a/src/common/zeroconf/roster_zeroconf.py +++ b/src/common/zeroconf/roster_zeroconf.py @@ -24,6 +24,8 @@ class Roster: def __init__(self, zeroconf): self._data = None self.zeroconf = zeroconf # our zeroconf instance + self.version = '' + self.received_from_server = True def update_roster(self): for val in self.zeroconf.contacts.values(): diff --git a/src/roster_window.py b/src/roster_window.py index fc0b4f416..0e341443d 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -2472,6 +2472,10 @@ class RosterWindow: self.chg_contact_status(obj.contact, obj.show, obj.status, account) + def _nec_roster_received(self, obj): + self.fill_contacts_and_groups_dicts(obj.roster, obj.conn.name) + self.add_account_contacts(obj.conn.name) + self.fire_up_unread_messages_events(obj.conn.name) ################################################################################ ### Menu and GUI callbacks @@ -6202,3 +6206,5 @@ class RosterWindow: gajim.ged.register_event_handler('presence-received', ged.GUI1, self._nec_presence_received) + gajim.ged.register_event_handler('roster-received', ged.GUI1, + self._nec_roster_received)