core: added a rosterResync method to bridge:
rosterResync do a full resynchronisation of roster with server. This should not be needed, but may be useful if user suspect a sync issue for whatever reason.
This commit is contained in:
parent
5ceffc1491
commit
f51e924eb6
2 changed files with 52 additions and 1 deletions
|
|
@ -145,6 +145,7 @@ class SAT(service.Service):
|
|||
self.bridge.register_method("addContact", self._addContact)
|
||||
self.bridge.register_method("updateContact", self._updateContact)
|
||||
self.bridge.register_method("delContact", self._delContact)
|
||||
self.bridge.register_method("rosterResync", self._rosterResync)
|
||||
self.bridge.register_method("isConnected", self.isConnected)
|
||||
self.bridge.register_method("launchAction", self.launchCallback)
|
||||
self.bridge.register_method("actionsGet", self.actionsGet)
|
||||
|
|
@ -809,6 +810,10 @@ class SAT(service.Service):
|
|||
self.profiles[profile].presence.unsubscribe(to_jid) # is not asynchronous
|
||||
return self.profiles[profile].roster.removeItem(to_jid)
|
||||
|
||||
def _rosterResync(self, profile_key):
|
||||
client = self.getClient(profile_key)
|
||||
return client.roster.resync()
|
||||
|
||||
## Discovery ##
|
||||
# discovery methods are shortcuts to self.memory.disco
|
||||
# the main difference with client.disco is that self.memory.disco manage cache
|
||||
|
|
|
|||
|
|
@ -1170,6 +1170,19 @@ class SatRosterProtocol(xmppim.RosterClientProtocol):
|
|||
roster_item_elt = roster_item.toElement().toXml()
|
||||
roster_cache[roster_jid_s] = roster_item_elt
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def resync(self):
|
||||
"""Ask full roster to resync database
|
||||
|
||||
this should not be necessary, but may be used if user suspsect roster
|
||||
to be somehow corrupted
|
||||
"""
|
||||
roster_cache = self.roster_cache
|
||||
yield roster_cache.clear()
|
||||
self._jids.clear()
|
||||
self._groups.clear()
|
||||
yield self.requestRoster()
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def requestRoster(self):
|
||||
"""Ask the server for Roster list """
|
||||
|
|
|
|||
Loading…
Reference in a new issue