quick frontend (app): (un)set sync state on (dis)connect:

when connected signal is received, a whole (re)connection has happened, meaning that everything is potentially out of sync (opened widget and contact lists), so host.sync is set accordingly.
It's a temporary option, as (dis)connect is a per-profile signal, and host.sync is global. Methods similar to sync workflow must be implemented on a per-profile basis.
This commit is contained in:
Goffi 2019-04-07 21:09:49 +02:00
commit fc41d45039

View file

@ -696,12 +696,22 @@ class QuickApp(object):
log.debug(_("Connected"))
self.profiles[profile].whoami = jid.JID(jid_s)
self.setPresenceStatus(profile=profile)
# FIXME: fill() is already called for all profiles when doing self.sync = True
# a per-profile fill() should be done once, see below note
self.contact_lists[profile].fill()
# if we were already displaying widgets, they must be resynchronized
# FIXME: self.sync is for all profiles
# while (dis)connection is per-profile.
# A mechanism similar to sync should be available
# on a per-profile basis
self.sync = True
def disconnectedHandler(self, profile):
"""called when the connection is closed"""
log.debug(_("Disconnected"))
self.contact_lists[profile].disconnect()
# FIXME: see note on connectedHandler
self.sync = False
self.setPresenceStatus(C.PRESENCE_UNAVAILABLE, "", profile=profile)
def actionNewHandler(self, action_data, id_, security_limit, profile):