From 501c0498d70144d950602879e44840e761e8cc00 Mon Sep 17 00:00:00 2001 From: Ragner Magalhaes Date: Tue, 2 Dec 2008 20:53:51 +0000 Subject: [PATCH] Adding function get_all to Account Adding new function get to Account class to return all accounts Signed-off-by: Ragner Magalhaes git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1368 596f6dd7-e928-0410-a184-9e12fd12cf7e --- account.pyx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/account.pyx b/account.pyx index 4a3fced..e45288d 100644 --- a/account.pyx +++ b/account.pyx @@ -305,3 +305,21 @@ cdef class Account: iter = iter.next return buddies + def get_all(self): + cdef glib.GList *iter + cdef account.PurpleAccount *acc + + accounts = [] + + iter = account.c_purple_accounts_get_all() + while iter: + acc = iter.data + if acc: + username = account.c_purple_account_get_username(acc) + protocol_id = account.c_purple_account_get_protocol_id(acc) + + accounts.append((username, protocol_id)) + iter = iter.next + + return accounts + -- 1.7.9.5