Adding function get_types to ProxyInfo class
[python-purple] / account.pyx
index 4a3fced..e562013 100644 (file)
@@ -305,3 +305,30 @@ cdef class Account:
             iter = iter.next
         return buddies
 
             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 = <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
+