fix roster handling with zeroconf. Fixes #5820
This commit is contained in:
parent
1048db503e
commit
edccb053a8
|
@ -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():
|
||||
|
|
|
@ -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():
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue