Mercurial > libervia-backend
diff frontends/src/quick_frontend/quick_contact_management.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 | 84a6e83157c2 |
children | bfabeedbf32e |
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_contact_management.py Mon Oct 28 19:04:49 2013 +0100 +++ b/frontends/src/quick_frontend/quick_contact_management.py Tue Oct 29 16:26:55 2013 +0100 @@ -30,7 +30,7 @@ self.__contactlist = {} def __contains__(self, entity): - return entity.short in self.__contactlist + return entity.bare in self.__contactlist def clear(self): """Clear all the contact list""" @@ -38,13 +38,13 @@ def add(self, entity): """Add contact to the list, update resources""" - if not self.__contactlist.has_key(entity.short): - self.__contactlist[entity.short] = {'resources':[]} + if not self.__contactlist.has_key(entity.bare): + self.__contactlist[entity.bare] = {'resources':[]} if not entity.resource: return - if entity.resource in self.__contactlist[entity.short]['resources']: - self.__contactlist[entity.short]['resources'].remove(entity.resource) - self.__contactlist[entity.short]['resources'].append(entity.resource) + if entity.resource in self.__contactlist[entity.bare]['resources']: + self.__contactlist[entity.bare]['resources'].remove(entity.resource) + self.__contactlist[entity.bare]['resources'].append(entity.resource) def getContFromGroup(self, group): """Return all contacts which are in given group""" @@ -60,28 +60,28 @@ @param entity: jid of the contact @param name: name of the attribute @return: asked attribute""" - if self.__contactlist.has_key(entity.short): + if self.__contactlist.has_key(entity.bare): if name == 'status': #FIXME: for the moment, we only use the first status - if self.__contactlist[entity.short]['statuses']: - return self.__contactlist[entity.short]['statuses'].values()[0] - if self.__contactlist[entity.short].has_key(name): - return self.__contactlist[entity.short][name] + if self.__contactlist[entity.bare]['statuses']: + return self.__contactlist[entity.bare]['statuses'].values()[0] + if self.__contactlist[entity.bare].has_key(name): + return self.__contactlist[entity.bare][name] else: debug(_('Trying to get attribute for an unknown contact')) return None def isConnected(self, entity): """Tell if the contact is online""" - return self.__contactlist.has_key(entity.short) + return self.__contactlist.has_key(entity.bare) def remove(self, entity): """remove resource. If no more resource is online or is no resource is specified, contact is deleted""" try: if entity.resource: - self.__contactlist[entity.short]['resources'].remove(entity.resource) - if not entity.resource or not self.__contactlist[entity.short]['resources']: + self.__contactlist[entity.bare]['resources'].remove(entity.resource) + if not entity.resource or not self.__contactlist[entity.bare]['resources']: #no more resource available: the contact seems really disconnected - del self.__contactlist[entity.short] + del self.__contactlist[entity.bare] except KeyError: error(_('INTERNAL ERROR: Key error')) raise @@ -92,11 +92,11 @@ @param key: name of the attribute @param value: value of the attribute """ - if self.__contactlist.has_key(entity.short): - self.__contactlist[entity.short][key] = value + if self.__contactlist.has_key(entity.bare): + self.__contactlist[entity.bare][key] = value else: - debug (_('Trying to update an unknown contact: %s'), entity.short) + debug (_('Trying to update an unknown contact: %s'), entity.bare) def get_full(self, entity): - return entity.short+'/'+self.__contactlist[entity.short]['resources'][-1] + return entity.bare+'/'+self.__contactlist[entity.bare]['resources'][-1]