Added missing structures on conversation.pxd.
[python-purple] / account.pyx
index 0e98548..d720910 100644 (file)
 #  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-cimport glib
-
-cimport account
-cimport blist
-cimport savedstatuses
-cimport status
+cimport purple
 
 cdef class Account:
     """ Account class """
     cdef account.PurpleAccount *__account
     cdef savedstatuses.PurpleSavedStatus *__sstatus
 
-    def __cinit__(self, char *username, char *protocol_id):
+    def __init__(self, char *username, char *protocol_id):
         self.__account = account.c_purple_account_new(username, protocol_id)
 
     def set_password(self, password):
@@ -50,16 +45,29 @@ cdef class Account:
         self.__sstatus = savedstatuses.c_purple_savedstatus_new(NULL, status.PURPLE_STATUS_AVAILABLE)
         savedstatuses.c_purple_savedstatus_activate(self.__sstatus)
 
-    def get_buddies_online(self, acc):
+    def get_buddies_online(self):
         cdef glib.GSList *iter
         cdef blist.PurpleBuddy *buddy
         buddies = []
         iter = blist.c_purple_find_buddies(self.__account, NULL)
         while iter:
             buddy = <blist.PurpleBuddy *> iter.data
-            if <object> buddy and \
+            if <blist.PurpleBuddy *>buddy and \
                 account.c_purple_account_is_connected(blist.c_purple_buddy_get_account(buddy)) and \
                 status.c_purple_presence_is_online(blist.c_purple_buddy_get_presence(buddy)):
                 buddies += [buddy.name]
             iter = iter.next
         return buddies
+
+    def get_proxyinfo(self):
+        cdef proxy.PurpleProxyInfo *c_proxyinfo
+        c_proxyinfo = account.c_purple_account_get_proxy_info(self.__account)
+        if c_proxyinfo == NULL:
+            return None
+        cdef ProxyInfo proxyinfo
+        proxyinfo = proxy.ProxyInfo()
+        proxyinfo.c_proxyinfo = c_proxyinfo
+        return proxyinfo
+
+    def set_proxyinfo(self, ProxyInfo proxyinf):
+        account.c_purple_account_set_proxy_info(self.__account, proxyinf.c_proxyinfo)