diff sat/core/xmpp.py @ 2892:82b781c46841

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.
author Goffi <goffi@goffi.org>
date Sun, 07 Apr 2019 18:49:41 +0200
parents 6a0f42e9410a
children c7c52c0dc13a
line wrap: on
line diff
--- a/sat/core/xmpp.py	Sun Apr 07 18:47:17 2019 +0200
+++ b/sat/core/xmpp.py	Sun Apr 07 18:49:41 2019 +0200
@@ -1171,6 +1171,19 @@
             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 """
         if self.versioning: