comparison 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
comparison
equal deleted inserted replaced
1387:3511ff4b40a0 1388:a025242bebe7
204 me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist" 204 me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist"
205 @param extra (dict): message data 205 @param extra (dict): message data
206 """ 206 """
207 raise NotImplementedError 207 raise NotImplementedError
208 208
209 def updateEntityState(self, entity, type_, value): 209 def getEntityStates(self, entity):
210 """Update a state value for the given entity. 210 """Retrieve states for an entity.
211 211
212 @param entity (jid.JID): entity to update 212 @param entity (jid.JID): entity
213 @param type_ (unicode): type of state (e.g. 'chat_state') 213 @return: OrderedDict{unicode: unicode}
214 @param value (unicode): new value 214 """
215 """ 215 states = OrderedDict()
216 contact_list = self.host.contact_lists[self.profile]
217 contact_list.setCache(entity, type_, value)
218 clist = self.host.contact_lists[self.profile] 216 clist = self.host.contact_lists[self.profile]
219 states = OrderedDict()
220 for key in self.visible_states: 217 for key in self.visible_states:
221 value = clist.getCache(entity, key) 218 value = clist.getCache(entity, key)
222 if value: 219 if value:
223 states[key] = value 220 states[key] = value
224 self.setContactStates(entity, states) 221 return states
225
226 def setContactStates(self, contact_jid, states):
227 """Set a contact (one2one or MUC occupant) states.
228
229 @param contact_jid (jid.JID): contact
230 @param states (dict{unicode: unicode}): new states
231 """
232 raise NotImplementedError
233 222
234 def addGamePanel(self, widget): 223 def addGamePanel(self, widget):
235 """Insert a game panel to this Chat dialog. 224 """Insert a game panel to this Chat dialog.
236 225
237 @param widget (Widget): the game panel 226 @param widget (Widget): the game panel
243 232
244 @param widget (Widget): the game panel 233 @param widget (Widget): the game panel
245 """ 234 """
246 raise NotImplementedError 235 raise NotImplementedError
247 236
237 def update(self, entity=None):
238 """Update one or all entities.
239
240 @param entity (jid.JID): entity to update
241 """
242 raise NotImplementedError
243
248 244
249 quick_widgets.register(QuickChat) 245 quick_widgets.register(QuickChat)