quick_frontend, primitivus: remove QuickChat.updateEntityState and QuickChat.setContactStates, use more general QuickChat.update (also called when joining the room to initialise the occupants list)

This commit is contained in:
souliane 2015-03-24 17:31:08 +01:00
commit 78f14091b1

View file

@ -206,30 +206,19 @@ class QuickChat(quick_widgets.QuickWidget):
"""
raise NotImplementedError
def updateEntityState(self, entity, type_, value):
"""Update a state value for the given entity.
def getEntityStates(self, entity):
"""Retrieve states for an entity.
@param entity (jid.JID): entity to update
@param type_ (unicode): type of state (e.g. 'chat_state')
@param value (unicode): new value
@param entity (jid.JID): entity
@return: OrderedDict{unicode: unicode}
"""
contact_list = self.host.contact_lists[self.profile]
contact_list.setCache(entity, type_, value)
clist = self.host.contact_lists[self.profile]
states = OrderedDict()
clist = self.host.contact_lists[self.profile]
for key in self.visible_states:
value = clist.getCache(entity, key)
if value:
states[key] = value
self.setContactStates(entity, states)
def setContactStates(self, contact_jid, states):
"""Set a contact (one2one or MUC occupant) states.
@param contact_jid (jid.JID): contact
@param states (dict{unicode: unicode}): new states
"""
raise NotImplementedError
return states
def addGamePanel(self, widget):
"""Insert a game panel to this Chat dialog.
@ -245,5 +234,12 @@ class QuickChat(quick_widgets.QuickWidget):
"""
raise NotImplementedError
def update(self, entity=None):
"""Update one or all entities.
@param entity (jid.JID): entity to update
"""
raise NotImplementedError
quick_widgets.register(QuickChat)