Mercurial > libervia-backend
comparison src/core/xmpp.py @ 1426:614145ef6e60
core (xmpp): RosterItem.jid is deprecated in Wokkel 0.7.1, use RosterItem.entity instead
author | souliane <souliane@mailoo.org> |
---|---|
date | Fri, 24 Apr 2015 14:54:24 +0200 |
parents | 176de79c8c39 |
children | 1e833970b7f0 |
comparison
equal
deleted
inserted
replaced
1425:7f8af1e69812 | 1426:614145ef6e60 |
---|---|
185 for item in roster.itervalues(): | 185 for item in roster.itervalues(): |
186 if not item.subscriptionTo and not item.subscriptionFrom and not item.ask: | 186 if not item.subscriptionTo and not item.subscriptionFrom and not item.ask: |
187 #XXX: current behaviour: we don't want contact in our roster list | 187 #XXX: current behaviour: we don't want contact in our roster list |
188 # if there is no presence subscription | 188 # if there is no presence subscription |
189 # may change in the future | 189 # may change in the future |
190 self.removeItem(item.jid) # FIXME: to be checked | 190 self.removeItem(item.entity) # FIXME: to be checked |
191 else: | 191 else: |
192 self._registerItem(item) | 192 self._registerItem(item) |
193 | 193 |
194 def _registerItem(self, item): | 194 def _registerItem(self, item): |
195 """Register item in local cache | 195 """Register item in local cache |
196 | 196 |
197 item must be already registered in self._jids before this method is called | 197 item must be already registered in self._jids before this method is called |
198 @param item (RosterIem): item added | 198 @param item (RosterIem): item added |
199 """ | 199 """ |
200 log.debug(u"registering item: {}".format(item.jid.full())) | 200 log.debug(u"registering item: {}".format(item.entity.full())) |
201 if item.entity.resource: | 201 if item.entity.resource: |
202 log.warning(u"Received a roster item with a resource, this is not common but not restricted by RFC 6121, this case may be not well tested.") | 202 log.warning(u"Received a roster item with a resource, this is not common but not restricted by RFC 6121, this case may be not well tested.") |
203 if not item.subscriptionTo: | 203 if not item.subscriptionTo: |
204 if not item.subscriptionFrom: | 204 if not item.subscriptionFrom: |
205 log.info(_(u"There's no subscription between you and [{}]!").format(item.jid.full())) | 205 log.info(_(u"There's no subscription between you and [{}]!").format(item.entity.full())) |
206 else: | 206 else: |
207 log.info(_(u"You are not subscribed to [{}]!").format(item.jid.full())) | 207 log.info(_(u"You are not subscribed to [{}]!").format(item.entity.full())) |
208 if not item.subscriptionFrom: | 208 if not item.subscriptionFrom: |
209 log.info(_(u"[{}] is not subscribed to you!").format(item.jid.full())) | 209 log.info(_(u"[{}] is not subscribed to you!").format(item.entity.full())) |
210 | 210 |
211 for group in item.groups: | 211 for group in item.groups: |
212 self._groups.setdefault(group, set()).add(item.entity) | 212 self._groups.setdefault(group, set()).add(item.entity) |
213 | 213 |
214 def requestRoster(self): | 214 def requestRoster(self): |
239 def setReceived(self, request): | 239 def setReceived(self, request): |
240 #TODO: implement roster versioning (cf RFC 6121 §2.6) | 240 #TODO: implement roster versioning (cf RFC 6121 §2.6) |
241 item = request.item | 241 item = request.item |
242 self._jids[item.entity] = item | 242 self._jids[item.entity] = item |
243 self._registerItem(item) | 243 self._registerItem(item) |
244 self.host.bridge.newContact(item.jid.full(), self.getAttributes(item), item.groups, self.parent.profile) | 244 self.host.bridge.newContact(item.entity.full(), self.getAttributes(item), item.groups, self.parent.profile) |
245 | 245 |
246 def removeReceived(self, request): | 246 def removeReceived(self, request): |
247 entity = request.item.entity | 247 entity = request.item.entity |
248 log.info(u"removing %s from roster list" % entity.full()) | 248 log.info(u"removing %s from roster list" % entity.full()) |
249 | 249 |