Mercurial > libervia-backend
comparison src/core/xmpp.py @ 1299:3360074a2f00 frontends_multi_profiles
core: fixed some logging calls without unicode strings, and use of print
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 06 Feb 2015 18:53:07 +0100 |
parents | f8a8434dbac7 |
children | ba73798317a7 |
comparison
equal
deleted
inserted
replaced
1298:e2f71b715708 | 1299:3360074a2f00 |
---|---|
185 """Register item in local cache | 185 """Register item in local cache |
186 | 186 |
187 item must be already registered in self._jids before this method is called | 187 item must be already registered in self._jids before this method is called |
188 @param item (RosterIem): item added | 188 @param item (RosterIem): item added |
189 """ | 189 """ |
190 log.debug("registering item: {}".format(item.jid.full())) | 190 log.debug(u"registering item: {}".format(item.jid.full())) |
191 if item.entity.resource: | 191 if item.entity.resource: |
192 log.warning("Received a roster item with a resource, this is not common but not restricted by RFC 6121, this case may be not well tested.") | 192 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.") |
193 import ipdb; ipdb.set_trace() | |
194 if not item.subscriptionTo and not item.subscriptionFrom and not item.ask: | 193 if not item.subscriptionTo and not item.subscriptionFrom and not item.ask: |
195 #XXX: current behaviour: we don't want contact in our roster list | 194 #XXX: current behaviour: we don't want contact in our roster list |
196 # if there is no presence subscription | 195 # if there is no presence subscription |
197 # may change in the future | 196 # may change in the future |
198 self.removeItem(item.jid) # FIXME: to be checked | 197 self.removeItem(item.jid) # FIXME: to be checked |
199 return | 198 return |
200 if not item.subscriptionTo: | 199 if not item.subscriptionTo: |
201 if not item.subscriptionFrom: | 200 if not item.subscriptionFrom: |
202 log.info(_("There's no subscription between you and [{}]!").format(item.jid.full())) | 201 log.info(_(u"There's no subscription between you and [{}]!").format(item.jid.full())) |
203 else: | 202 else: |
204 log.info(_("You are not subscribed to [{}]!").format(item.jid.full())) | 203 log.info(_(u"You are not subscribed to [{}]!").format(item.jid.full())) |
205 if not item.subscriptionFrom: | 204 if not item.subscriptionFrom: |
206 log.info(_("[{}] is not subscribed to you!").format(item.jid.full())) | 205 log.info(_(u"[{}] is not subscribed to you!").format(item.jid.full())) |
207 #self.host.memory.addContact(item.jid, item_attr, item.groups, self.parent.profile) | |
208 | 206 |
209 for group in item.groups: | 207 for group in item.groups: |
210 self._groups.setdefault(group, set()).add(item.entity) | 208 self._groups.setdefault(group, set()).add(item.entity) |
211 | 209 |
212 def requestRoster(self): | 210 def requestRoster(self): |
240 self._jids[item.entity] = item | 238 self._jids[item.entity] = item |
241 self.host.bridge.newContact(item.jid.full(), self.getAttributes(item), item.groups, self.parent.profile) | 239 self.host.bridge.newContact(item.jid.full(), self.getAttributes(item), item.groups, self.parent.profile) |
242 | 240 |
243 def removeReceived(self, request): | 241 def removeReceived(self, request): |
244 entity = request.item.entity | 242 entity = request.item.entity |
245 print _("removing %s from roster list") % entity.full() | 243 log.info(u"removing %s from roster list" % entity.full()) |
246 | 244 |
247 # we first remove item from local cache (self._groups and self._jids) | 245 # we first remove item from local cache (self._groups and self._jids) |
248 try: | 246 try: |
249 item = self._jids.pop(entity) | 247 item = self._jids.pop(entity) |
250 except KeyError: | 248 except KeyError: |