diff src/core/xmpp.py @ 549:2c5ef983f2ef

core: client.roster has now a got_roster deferred which is fired when roster is available
author Goffi <goffi@goffi.org>
date Thu, 22 Nov 2012 00:44:56 +0100
parents 2c4016921403
children 0bb2e0d1c878
line wrap: on
line diff
--- a/src/core/xmpp.py	Wed Nov 14 21:47:56 2012 +0100
+++ b/src/core/xmpp.py	Thu Nov 22 00:44:56 2012 +0100
@@ -133,6 +133,7 @@
     def __init__(self, host):
         xmppim.RosterClientProtocol.__init__(self)
         self.host = host
+        self.got_roster = defer.Deferred()
         #XXX: the two following dicts keep a local copy of the roster
         self._groups = {} #map from groups to bare jids: key=group value=set of bare jids
         self._jids = {} #map from bare jids to RosterItem: key=jid value=RosterItem
@@ -144,7 +145,8 @@
     def requestRoster(self):
         """ ask the server for Roster list """
         debug("requestRoster")
-        self.getRoster().addCallback(self.rosterCb)
+        d = self.getRoster().addCallback(self.rosterCb)
+        d.chainDeferred(self.got_roster)
 
     def removeItem(self, to):
         """Remove a contact from roster list"""