comparison frontends/src/quick_frontend/quick_contact_list.py @ 1983:8c4087fd034a

quick_frontend: allow presence of entities without resource
author Goffi <goffi@goffi.org>
date Wed, 29 Jun 2016 13:42:35 +0200
parents 02d21a589be2
children 20fb71b656e3
comparison
equal deleted inserted replaced
1982:e6b51b7ff31f 1983:8c4087fd034a
469 except KeyError: 469 except KeyError:
470 log.error(u"Presence unavailable received for an unknown resource [{}]".format(entity)) 470 log.error(u"Presence unavailable received for an unknown resource [{}]".format(entity))
471 if not cache[C.CONTACT_RESOURCES]: 471 if not cache[C.CONTACT_RESOURCES]:
472 cache[C.CONTACT_MAIN_RESOURCE] = None 472 cache[C.CONTACT_MAIN_RESOURCE] = None
473 else: 473 else:
474 assert entity.resource 474 if not entity.resource:
475 log.warning(_(u"received presence from entity without resource: {}".format(entity)))
475 resources_data = cache[C.CONTACT_RESOURCES] 476 resources_data = cache[C.CONTACT_RESOURCES]
476 resource_data = resources_data.setdefault(entity.resource, {}) 477 resource_data = resources_data.setdefault(entity.resource, {})
477 resource_data[C.PRESENCE_SHOW] = show 478 resource_data[C.PRESENCE_SHOW] = show
478 resource_data[C.PRESENCE_PRIORITY] = int(priority) 479 resource_data[C.PRESENCE_PRIORITY] = int(priority)
479 resource_data[C.PRESENCE_STATUSES] = statuses 480 resource_data[C.PRESENCE_STATUSES] = statuses