diff frontends/src/quick_frontend/quick_chat.py @ 1388:a025242bebe7

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)
author souliane <souliane@mailoo.org>
date Tue, 24 Mar 2015 17:31:08 +0100
parents 1f3513cfb246
children 069ad98b360d
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_chat.py	Tue Mar 24 10:46:42 2015 +0100
+++ b/frontends/src/quick_frontend/quick_chat.py	Tue Mar 24 17:31:08 2015 +0100
@@ -206,30 +206,19 @@
         """
         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)
+        states = OrderedDict()
         clist = self.host.contact_lists[self.profile]
-        states = OrderedDict()
         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 @@
         """
         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)