quick_frontend, primitivus: various fixes (MUC and cached signals):

- actually call the cached signals, everything was there but the call was not done
    - display '[]' instead of '[None]' when group message coming from the room (no resource)
    - catch the exception when trying to delete an occupant who's not in the room
    - do not cache a "main resource" for MUC entities
This commit is contained in:
souliane 2015-03-25 15:25:51 +01:00
commit ff0166e95f
2 changed files with 10 additions and 4 deletions

View file

@ -388,6 +388,7 @@ class QuickApp(object):
cached_signals = self.signals_cache.pop(profile, [])
for function_name, handler, args, kwargs in cached_signals:
log.debug(u"Calling cached signal [%s] with args %s and kwargs %s" % (function_name, args, kwargs))
handler(*args, **kwargs)
self.callListeners('profilePlugged', profile=profile)

View file

@ -296,6 +296,7 @@ class QuickContactList(QuickWidget):
self._specials.remove(entity_bare)
else:
self._specials.add(entity_bare)
cache[C.CONTACT_MAIN_RESOURCE] = None
# now the attribute we keep in cache
for attribute, value in attributes.iteritems():
@ -401,8 +402,9 @@ class QuickContactList(QuickWidget):
resource_data[C.PRESENCE_PRIORITY] = int(priority)
resource_data[C.PRESENCE_STATUSES] = statuses
priority_resource = max(resources_data, key=lambda res: resources_data[res][C.PRESENCE_PRIORITY])
cache[C.CONTACT_MAIN_RESOURCE] = priority_resource
if entity.bare not in self._specials:
priority_resource = max(resources_data, key=lambda res: resources_data[res][C.PRESENCE_PRIORITY])
cache[C.CONTACT_MAIN_RESOURCE] = priority_resource
self.update()
def onNickUpdate(self, entity, new_nick, profile):