Updated remove_account
authorRagner Magalhaes <ragner.magalhaes@openbossa.org>
Tue, 2 Dec 2008 21:20:08 +0000 (21:20 +0000)
committerAnderson Briglia <anderson.briglia@openbossa.org>
Sat, 28 Feb 2009 21:11:20 +0000 (17:11 -0400)
- Method remove_account changed to remove.
- Uses self.__exists to check to account existance

Signed-off-by: Frederico Simas Duarte <fred.duarte@openbossa.org>

git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1445 596f6dd7-e928-0410-a184-9e12fd12cf7e

account.pyx

index 427d2bd..0ae93fd 100644 (file)
@@ -391,27 +391,25 @@ cdef class Account:
         if self.__exists:
             return False
         else:
         if self.__exists:
             return False
         else:
-            # FIXME: Using purple_accounts_add(...) to save to xml
-            #   I think we could improve this ..
             account.purple_accounts_add(account.purple_account_new( \
                     self.__username, self.__protocol.id))
 
             self.__exists = True
             return True
        
             account.purple_accounts_add(account.purple_account_new( \
                     self.__username, self.__protocol.id))
 
             self.__exists = True
             return True
        
-       def remove_account(self, username, protocol_id):
+       def remove(self):
                """
         Removes as existing account.
 
         @return True if successful, False if account doesnt exists
         """
                """
         Removes as existing account.
 
         @return True if successful, False if account doesnt exists
         """
-               who = account.purple_accounts_find(username, protocol_id)
-               
-               if who == NULL:
-                       return False
-               else
-                       account.purple_accounts_remove( who )
+               if self.__exists:
+                       account.purple_accounts_remove(self._get_structure())
+                       
+                       self__exists = False
                        return True
                        return True
+               else:
+                       return False
 
     def connect(self):
         """
 
     def connect(self):
         """