changeset 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 b6dbac8ee485
children e56dfe0378a1
files src/memory/memory.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/memory/memory.py	Fri Oct 17 15:49:46 2014 +0200
+++ b/src/memory/memory.py	Fri Oct 17 20:26:01 2014 +0200
@@ -423,7 +423,12 @@
         entity_data = self._getEntitiesData(entity_jid, profile)[entity_jid]
         resource = entity_jid.resource
         if resource:
-            self.updateEntityData(entity_jid.userhostJID(), C.ENTITY_LAST_RESOURCE, resource, profile)
+            try:
+                type_ = self.getEntityDatum(entity_jid.userhostJID(), 'type', profile)
+            except KeyError:
+                type_ = 'contact'
+            if type_ != 'chatroom':
+                self.updateEntityData(entity_jid.userhostJID(), C.ENTITY_LAST_RESOURCE, resource, profile)
         entity_data.setdefault("presence", {})[resource or ''] = (show, priority, statuses)
 
     def _getEntitiesData(self, entity_jid, profile):