Mercurial > libervia-backend
comparison frontends/src/quick_frontend/quick_contact_list.py @ 688:f7878ad3c846
tools: renamed tools.jid.JID attribute "short" to "bare"
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 29 Oct 2013 16:26:55 +0100 |
parents | 0b9bd47dffcd |
children | bfabeedbf32e |
comparison
equal
deleted
inserted
replaced
687:af0d08a84cc6 | 688:f7878ad3c846 |
---|---|
32 """Update the jid in the list when something changed""" | 32 """Update the jid in the list when something changed""" |
33 raise NotImplementedError | 33 raise NotImplementedError |
34 | 34 |
35 def getCache(self, jid, name): | 35 def getCache(self, jid, name): |
36 try: | 36 try: |
37 jid_cache = self._cache[jid.short] | 37 jid_cache = self._cache[jid.bare] |
38 if name == 'status': #XXX: we get the first status for 'status' key | 38 if name == 'status': #XXX: we get the first status for 'status' key |
39 return jid_cache['statuses'].get('default','') | 39 return jid_cache['statuses'].get('default','') |
40 return jid_cache[name] | 40 return jid_cache[name] |
41 except (KeyError, IndexError): | 41 except (KeyError, IndexError): |
42 return None | 42 return None |
43 | 43 |
44 def setCache(self, jid, name, value): | 44 def setCache(self, jid, name, value): |
45 jid_cache = self._cache.setdefault(jid.short, {}) | 45 jid_cache = self._cache.setdefault(jid.bare, {}) |
46 jid_cache[name] = value | 46 jid_cache[name] = value |
47 | 47 |
48 def __contains__(self, jid): | 48 def __contains__(self, jid): |
49 raise NotImplementedError | 49 raise NotImplementedError |
50 | 50 |
58 self.setCache(jid, 'name', attributes['name']) | 58 self.setCache(jid, 'name', attributes['name']) |
59 | 59 |
60 def remove(self, jid): | 60 def remove(self, jid): |
61 """remove a contact from the list""" | 61 """remove a contact from the list""" |
62 try: | 62 try: |
63 del self.specials[jid.short] | 63 del self.specials[jid.bare] |
64 except KeyError: | 64 except KeyError: |
65 pass | 65 pass |
66 | 66 |
67 def add(self, jid, param_groups=None): | 67 def add(self, jid, param_groups=None): |
68 """add a contact to the list""" | 68 """add a contact to the list""" |
69 raise NotImplementedError | 69 raise NotImplementedError |
70 | 70 |
71 def getSpecial(self, jid): | 71 def getSpecial(self, jid): |
72 """Return special type of jid, or None if it's not special""" | 72 """Return special type of jid, or None if it's not special""" |
73 return self.specials.get(jid.short) | 73 return self.specials.get(jid.bare) |
74 | 74 |
75 def setSpecial(self, jid, _type, show=False): | 75 def setSpecial(self, jid, _type, show=False): |
76 """Set entity as a special | 76 """Set entity as a special |
77 @param jid: jid of the entity | 77 @param jid: jid of the entity |
78 @param _type: special type (e.g.: "MUC") | 78 @param _type: special type (e.g.: "MUC") |
79 @param show: True to display the dialog to chat with this entity | 79 @param show: True to display the dialog to chat with this entity |
80 """ | 80 """ |
81 self.specials[jid.short] = _type | 81 self.specials[jid.bare] = _type |
82 | 82 |
83 def updatePresence(self, jid, show, priority, statuses): | 83 def updatePresence(self, jid, show, priority, statuses): |
84 """Update entity's presence status | 84 """Update entity's presence status |
85 @param jid: entity to update's jid | 85 @param jid: entity to update's jid |
86 @param show: availability | 86 @param show: availability |