#1953: Retrieve friends' nicks from the profile.

This commit is contained in:
Tomeu Vizoso 2007-07-09 21:34:28 +02:00
parent ecca1dca00
commit f0c8fe19fe
3 changed files with 5 additions and 4 deletions

2
NEWS
View File

@ -1,3 +1,5 @@
* #1953: Retrieve friends' nicks from the profile. (tomeu)
Snapshot aa6a024368
* #1825: Fix tab label padding. (marco)

View File

@ -36,7 +36,7 @@ class BuddyModel(gobject.GObject):
([gobject.TYPE_PYOBJECT]))
}
def __init__(self, key=None, buddy=None):
def __init__(self, key=None, buddy=None, nick=None):
if (key and buddy) or (not key and not buddy):
raise RuntimeError("Must specify only _one_ of key or buddy.")
@ -51,7 +51,6 @@ class BuddyModel(gobject.GObject):
self._pservice = presenceservice.get_instance()
self._buddy = None
self._nick = None
# If given just a key, try to get the buddy from the PS first
if not buddy:
@ -72,7 +71,7 @@ class BuddyModel(gobject.GObject):
self._key = key
# Set color to 'inactive'/'disconnected'
self._set_color_from_string(_NOT_PRESENT_COLOR)
self._name = "Unknown buddy"
self._nick = nick
def _set_color_from_string(self, color_string):
self._color = XoColor(color_string)

View File

@ -69,7 +69,7 @@ class Friends(gobject.GObject):
# HACK: don't screw up on old friends files
if len(key) < 20:
continue
buddy = BuddyModel(key=key)
buddy = BuddyModel(key=key, nick=cp.get(key, 'nick'))
self.add_friend(buddy)
except Exception, exc:
logging.error("Error parsing friends file: %s" % exc)