- username = account.c_purple_account_get_username(acc)
- protocol_id = account.c_purple_account_get_protocol_id(acc)
- self.account_add(username.split("/")[0], protocol_id, "172.18.216.211", 8080)
+ username = <char *> account.purple_account_get_username(acc)
+ protocol_id = <char *> account.purple_account_get_protocol_id(acc)
+
+ if username != NULL and protocol_id != NULL:
+ account_list.append(Account(username, \
+ Protocol(protocol_id), self))
+ iter = iter.next
+
+ return account_list
+
+ def accounts_get_all_active(self):
+ '''Returns a list of all enabled accounts.
+
+ @return A list of all enabled accounts.
+ '''
+
+ cdef glib.GList *iter
+ cdef account.PurpleAccount *acc
+ cdef char *username
+ cdef char *protocol_id
+
+ #FIXME: The list is owned by the caller, and must be g_list_free()d
+ # to avoid leaking the nodes.
+
+ iter = account.purple_accounts_get_all_active()
+ account_list = []
+
+ while iter:
+ acc = <account.PurpleAccount *> iter.data
+
+ if <account.PurpleAccount *>acc:
+ username = <char *> account.purple_account_get_username(acc)
+ protocol_id = <char *> account.purple_account_get_protocol_id(acc)
+
+ if username != NULL and protocol_id != NULL:
+ account_list.append(Account(username, \
+ Protocol(protocol_id), self))
+ iter = iter.next
+
+ return account_list
+
+ def protocols_get_all(self):
+ '''Returns a list of all protocols.
+
+ @return A list of all protocols.
+ '''
+
+ cdef glib.GList *iter
+ cdef plugin.PurplePlugin *pp
+
+ iter = plugin.purple_plugins_get_protocols()
+ protocol_list = []
+ while iter:
+ pp = <plugin.PurplePlugin*> iter.data
+ if pp.info and pp.info.name:
+ protocol_list.append(Protocol(pp.info.id))