From 6de6090d402a505f5c9d7a483e0570c8c917fa27 Mon Sep 17 00:00:00 2001 From: Ragner Magalhaes Date: Tue, 2 Dec 2008 21:19:27 +0000 Subject: [PATCH] Added set_alias to Buddy class. FIXES: - Added set_alias to Buddy class. - Updated get_buddies_online() from Account class to return a list of Buddy classes instead of a tuple (name, alias). Signed-off-by: Bruno Abinader Acked-by: Ragner Magalhaes git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1443 596f6dd7-e928-0410-a184-9e12fd12cf7e --- account.pyx | 10 +++++----- buddy.pyx | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/account.pyx b/account.pyx index 407dc4e..c724094 100644 --- a/account.pyx +++ b/account.pyx @@ -505,13 +505,13 @@ cdef class Account: blist.purple_buddy_get_presence(c_buddy)): name = blist.purple_buddy_get_name(c_buddy) + new_buddy = Buddy(name, self) + c_alias = blist.purple_buddy_get_alias_only(c_buddy) - if c_alias == NULL: - alias = None - else: - alias = c_alias + if c_alias: + new_buddy.set_alias(c_alias) - buddies_list.append((name, alias)) + buddies_list.append(new_buddy) iter = iter.next return buddies_list else: diff --git a/buddy.pyx b/buddy.pyx index 9a4523a..10e88bf 100644 --- a/buddy.pyx +++ b/buddy.pyx @@ -125,3 +125,10 @@ cdef class Buddy: else: return None idle = property(__get_idle) + + def set_alias(self, alias): + if self.__exists: + blist.purple_blist_alias_buddy(self._get_structure(), alias) + return True + else: + return False -- 1.7.9.5