fix roster handling with zeroconf. Fixes #5820

This commit is contained in:
Yann Leboulanger 2010-10-26 11:25:30 +02:00
parent 1048db503e
commit edccb053a8
3 changed files with 11 additions and 1 deletions

View File

@ -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():

View File

@ -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():

View File

@ -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)