comparison src/memory/memory.py @ 1240:22adf1eb59f5

memory: don't save last resource in entity data for the MUC jids
author souliane <souliane@mailoo.org>
date Fri, 17 Oct 2014 20:26:01 +0200
parents 9c17bd37e6e5
children c6cf44e6330b
comparison
equal deleted inserted replaced
1239:b6dbac8ee485 1240:22adf1eb59f5
421 if not profile: 421 if not profile:
422 raise exceptions.ProfileUnknownError(_('Trying to get entity data for a non-existant profile')) 422 raise exceptions.ProfileUnknownError(_('Trying to get entity data for a non-existant profile'))
423 entity_data = self._getEntitiesData(entity_jid, profile)[entity_jid] 423 entity_data = self._getEntitiesData(entity_jid, profile)[entity_jid]
424 resource = entity_jid.resource 424 resource = entity_jid.resource
425 if resource: 425 if resource:
426 self.updateEntityData(entity_jid.userhostJID(), C.ENTITY_LAST_RESOURCE, resource, profile) 426 try:
427 type_ = self.getEntityDatum(entity_jid.userhostJID(), 'type', profile)
428 except KeyError:
429 type_ = 'contact'
430 if type_ != 'chatroom':
431 self.updateEntityData(entity_jid.userhostJID(), C.ENTITY_LAST_RESOURCE, resource, profile)
427 entity_data.setdefault("presence", {})[resource or ''] = (show, priority, statuses) 432 entity_data.setdefault("presence", {})[resource or ''] = (show, priority, statuses)
428 433
429 def _getEntitiesData(self, entity_jid, profile): 434 def _getEntitiesData(self, entity_jid, profile):
430 """Get data dictionary for entities 435 """Get data dictionary for entities
431 @param entity_jid: JID of the entity, or C.ENTITY_ALL for all entities) 436 @param entity_jid: JID of the entity, or C.ENTITY_ALL for all entities)