+ def load_accounts(self):
+ cdef glib.GList *iter
+ cdef account.PurpleAccount *acc
+ 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)
+ self.account_add(username.split("/")[0], protocol_id, "172.18.216.211", 8080)
+ iter = iter.next
+
+ def account_add(self, username, protocol_id, host, port):
+ if not self.account_verify(username):
+ acc = purple.Account(username, protocol_id)
+ self.__accounts[username] = acc
+ if not account.c_purple_accounts_find(username, protocol_id):
+ acc.proxy.set_type(purple.ProxyInfoType().HTTP)
+ acc.proxy.set_host(host)
+ acc.proxy.set_port(port)
+ acc.save_into_xml()
+
+ def account_verify(self, acc_username):
+ if self.__accounts:
+ for username in self.__accounts.keys():
+ if acc_username == username:
+ return self.__accounts[username]
+ else:
+ return None
+
+include "plugin.pyx"