Adding function get_all to Account
[python-purple] / account.pyx
index 4a3fced..e45288d 100644 (file)
@@ -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 = <account.PurpleAccount *> iter.data
+            if <account.PurpleAccount *>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
+