#1953: Retrieve friends' nicks from the profile.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user