From: Ragner Magalhaes Date: Tue, 2 Dec 2008 21:08:54 +0000 (+0000) Subject: Adding function accounts_get_all() to Purple class X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=commitdiff_plain;h=90f6e43b25dd3932fcc71a4f7afa5ecfcf2e3dc4;ds=inline Adding function accounts_get_all() to Purple class Adding function accounts_get_all() to Purple class to return all accounts Signed-off-by: Ragner Magalhaes Acked-by: Bruno Abinader Acked-by: Dinorah Monteiro git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1412 596f6dd7-e928-0410-a184-9e12fd12cf7e --- diff --git a/purple.pyx b/purple.pyx index 96a5241..6a269cd 100644 --- a/purple.pyx +++ b/purple.pyx @@ -352,6 +352,28 @@ cdef class Purple: else: return None + def accounts_get_all(self): + cdef glib.GList *iter + cdef account.PurpleAccount *acc + cdef char *username + cdef char *protocol_id + + iter = account.purple_accounts_get_all() + account_list = [] + + while iter: + acc = iter.data + + if acc: + username = account.purple_account_get_username(acc) + protocol_id = account.purple_account_get_protocol_id(acc) + + if username != NULL and protocol_id != NULL: + account_list.append(Account(username, protocol_id)) + iter = iter.next + + return account_list + include "plugin.pyx" include "proxy.pyx" #include "protocol.pyx"