comparison frontends/src/quick_frontend/quick_contact_list.py @ 2121:df5cb9e7d0b7

quick frontend (contact list): added isSpecial and isRoom to quickly now if an entity is specific
author Goffi <goffi@goffi.org>
date Sun, 15 Jan 2017 16:00:41 +0100
parents 4d9aeae5d9d0
children 3970ebcf8830
comparison
equal deleted inserted replaced
2120:4d9aeae5d9d0 2121:df5cb9e7d0b7
293 @return: registered value 293 @return: registered value
294 """ 294 """
295 if name is None: 295 if name is None:
296 return self._groups[group] 296 return self._groups[group]
297 return self._groups[group][name] 297 return self._groups[group][name]
298
299 def isRoom(self, entity):
300 """Helper method to know if entity is a MUC room
301
302 @param entity(jid.JID): jid of the entity
303 hint: use bare jid here, as room can't be full jid with MUC
304 @return (bool): True if entity is a room
305 """
306 assert entity.resource is None # FIXME: this may change when MIX will be handled
307 return self.isSpecial(entity, C.CONTACT_SPECIAL_GROUP)
308
309 def isSpecial(self, entity, special_type):
310 """Tell if an entity is of a specialy _type
311
312 @param entity(jid.JID): jid of the special entity
313 if the jid is full, will be added to special extras
314 @param special_type: one of special type (e.g. C.CONTACT_SPECIAL_GROUP)
315 @return (bool): True if entity is from this special type
316 """
317 return self.getCache(entity, C.CONTACT_SPECIAL) == special_type
298 318
299 def setSpecial(self, entity, special_type): 319 def setSpecial(self, entity, special_type):
300 """Set special flag on an entity 320 """Set special flag on an entity
301 321
302 @param entity(jid.JID): jid of the special entity 322 @param entity(jid.JID): jid of the special entity