Fixed debug messages warning.
[python-purple] / account.pyx
index 56d725b..5e92065 100644 (file)
@@ -279,13 +279,20 @@ 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):
+    def get_buddies_online(self, acc):
+        cdef account.PurpleAccount *c_account
         cdef glib.GSList *iter
         cdef blist.PurpleBuddy *buddy
         cdef char *c_name = NULL
         cdef char *c_alias = NULL
+
+        c_account = account.c_purple_accounts_find(acc[0], acc[1])
+        if c_account:
+            iter = blist.c_purple_find_buddies(c_account, NULL)
+        else:
+            return None
+
         buddies = []
-        iter = blist.c_purple_find_buddies(self.c_account, NULL)
         while iter:
             c_name = NULL
             c_alias = NULL
@@ -429,7 +436,7 @@ cdef class Account:
         c_account = account.c_purple_accounts_find(acc[0], acc[1])
         if c_account:
             account.c_purple_account_set_enabled(c_account, <char *> ui, bool(value))
+
     def get_enabled(self, acc, ui):
         ''' @param acc Tuple (username, protocol id) '''
         ''' @param ui The UI '''
@@ -451,7 +458,7 @@ cdef class Account:
             return account.c_purple_account_is_connected(c_account)
         else:
             return False
-    
+
     def connect(self, acc):
         ''' @param acc Tuple (username, protocol id) '''
         ''' @param ui The UI '''
@@ -460,7 +467,7 @@ cdef class Account:
         c_account = account.c_purple_accounts_find(acc[0], acc[1])
         if c_account:
             account.c_purple_account_connect(c_account)
-    
+
     def disconnect(self, acc):
         ''' @param acc Tuple (username, protocol id) '''
         ''' @param ui The UI '''
@@ -469,3 +476,24 @@ cdef class Account:
         c_account = account.c_purple_accounts_find(acc[0], acc[1])
         if c_account:
             account.c_purple_account_disconnect(c_account)
+
+    def set_remember_password(self, acc, value):
+        cdef account.PurpleAccount *c_account
+        c_account = account.c_purple_accounts_find(acc[0], acc[1])
+        if c_account:
+            account.c_purple_account_set_remember_password(c_account, value)
+
+    def get_remember_password(self, acc):
+        cdef account.PurpleAccount *c_account
+        c_account = account.c_purple_accounts_find(acc[0], acc[1])
+        if c_account:
+            return account.c_purple_account_get_remember_password(c_account)
+        else:
+            return None
+
+    def remove(self, acc):
+        cdef account.PurpleAccount *c_account
+
+        c_account = account.c_purple_accounts_find(acc[0], acc[1])
+        if c_account:
+            account.c_purple_accounts_delete(c_account)