tools: renamed tools.jid.JID attribute "short" to "bare"

This commit is contained in:
souliane 2013-10-29 16:26:55 +01:00
commit 36cea6fc91

View file

@ -70,7 +70,7 @@ class ContactList(urwid.WidgetWrap, QuickContactList):
def __contains__(self, jid):
for group in self.groups:
if jid.short in self.groups[group][1]:
if jid.bare in self.groups[group][1]:
return True
return False
@ -108,7 +108,7 @@ class ContactList(urwid.WidgetWrap, QuickContactList):
def putAlert(self, jid):
"""Put an alert on the jid to get attention from user (e.g. for new message)"""
self.alert_jid.add(jid.short)
self.alert_jid.add(jid.bare)
self.update()
def __groupClicked(self, group_wid):
@ -153,7 +153,7 @@ class ContactList(urwid.WidgetWrap, QuickContactList):
and not contact in self.alert_jid and contact != self.selected):
continue
show_icon, show_attr = const_SHOW_ICON.get(show,('','default'))
contact_disp = ('alert' if contact in self.alert_jid else show_attr, nick or name or jid.node or jid.short)
contact_disp = ('alert' if contact in self.alert_jid else show_attr, nick or name or jid.node or jid.bare)
display = [ show_icon + " " , contact_disp]
if self.show_status:
status_disp = ('status',"\n " + status) if status else ""
@ -180,7 +180,7 @@ class ContactList(urwid.WidgetWrap, QuickContactList):
jid=JID(special)
name = self.getCache(jid, 'name')
nick = self.getCache(jid, 'nick')
special_disp = ('alert' if special in self.alert_jid else 'default', nick or name or jid.node or jid.short)
special_disp = ('alert' if special in self.alert_jid else 'default', nick or name or jid.node or jid.bare)
display = [ " " , special_disp]
header = '(*) ' if special in self.alert_jid else ''
widget = sat_widgets.SelectableText(display,
@ -233,7 +233,7 @@ class ContactList(urwid.WidgetWrap, QuickContactList):
def replace(self, jid, groups=None, attributes=None):
"""add a contact to the list if doesn't exist, else update it"""
QuickContactList.replace(self, jid, groups, attributes)
if jid.short in self.specials:
if jid.bare in self.specials:
return
if not groups:
groups = [None]
@ -244,7 +244,7 @@ class ContactList(urwid.WidgetWrap, QuickContactList):
for group in groups:
if not self.groups.has_key(group):
self.groups[group] = [True,set()] #[unfold,list_of_contacts]
self.groups[group][1].add(jid.short)
self.groups[group][1].add(jid.bare)
self.update()
def remove(self, jid):
@ -253,8 +253,8 @@ class ContactList(urwid.WidgetWrap, QuickContactList):
groups_to_remove = []
for group in self.groups:
contacts = self.groups[group][1]
if jid.short in contacts:
contacts.remove(jid.short)
if jid.bare in contacts:
contacts.remove(jid.bare)
if not len(contacts):
groups_to_remove.append(group)
for group in groups_to_remove:
@ -275,7 +275,7 @@ class ContactList(urwid.WidgetWrap, QuickContactList):
if None in self.groups:
folded, group_jids = self.groups[None]
for group_jid in group_jids:
if JID(group_jid).short == special_jid.short:
if JID(group_jid).bare == special_jid.bare:
group_jids.remove(group_jid)
break
self.update()
@ -286,5 +286,5 @@ class ContactList(urwid.WidgetWrap, QuickContactList):
def updatePresence(self, jid, show, priority, statuses):
#XXX: for the moment, we ignore presence updates for special entities
if jid.short not in self.specials:
if jid.bare not in self.specials:
QuickContactList.updatePresence(self, jid, show, priority, statuses)