comparison 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
comparison
equal deleted inserted replaced
548:8022cca26595 549:2c5ef983f2ef
131 class SatRosterProtocol(xmppim.RosterClientProtocol): 131 class SatRosterProtocol(xmppim.RosterClientProtocol):
132 132
133 def __init__(self, host): 133 def __init__(self, host):
134 xmppim.RosterClientProtocol.__init__(self) 134 xmppim.RosterClientProtocol.__init__(self)
135 self.host = host 135 self.host = host
136 self.got_roster = defer.Deferred()
136 #XXX: the two following dicts keep a local copy of the roster 137 #XXX: the two following dicts keep a local copy of the roster
137 self._groups = {} #map from groups to bare jids: key=group value=set of bare jids 138 self._groups = {} #map from groups to bare jids: key=group value=set of bare jids
138 self._jids = {} #map from bare jids to RosterItem: key=jid value=RosterItem 139 self._jids = {} #map from bare jids to RosterItem: key=jid value=RosterItem
139 140
140 def rosterCb(self, roster): 141 def rosterCb(self, roster):
142 self.onRosterSet(item) 143 self.onRosterSet(item)
143 144
144 def requestRoster(self): 145 def requestRoster(self):
145 """ ask the server for Roster list """ 146 """ ask the server for Roster list """
146 debug("requestRoster") 147 debug("requestRoster")
147 self.getRoster().addCallback(self.rosterCb) 148 d = self.getRoster().addCallback(self.rosterCb)
149 d.chainDeferred(self.got_roster)
148 150
149 def removeItem(self, to): 151 def removeItem(self, to):
150 """Remove a contact from roster list""" 152 """Remove a contact from roster list"""
151 xmppim.RosterClientProtocol.removeItem(self, to) 153 xmppim.RosterClientProtocol.removeItem(self, to)
152 #TODO: check IQ result 154 #TODO: check IQ result