X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=blobdiff_plain;f=account.pyx;h=e562013a8f08a00cd3a5f0d95e6c0b8c5f236e3d;hp=4a3fced68a2ffd335c8cdbf000495dd76ff305c4;hb=ac12b59ff91e972e8f34209ed58a1f7dfa4cb6f5;hpb=dbb6e1a206514e79c23089ffe48ec1d1ade3642b diff --git a/account.pyx b/account.pyx index 4a3fced..e562013 100644 --- a/account.pyx +++ b/account.pyx @@ -305,3 +305,30 @@ cdef class Account: iter = iter.next return buddies + def new(self, username, protocol_id): + cdef account.PurpleAccount *c_account + c_account = account.c_purple_account_new(username, protocol_id) + + if c_account == NULL: + return None + + return (username, protocol_id) + + 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 +