Added set/get enabled Account class methods.
authorRagner Magalhaes <ragner.magalhaes@openbossa.org>
Tue, 2 Dec 2008 21:10:33 +0000 (21:10 +0000)
committerAnderson Briglia <anderson.briglia@openbossa.org>
Sat, 28 Feb 2009 21:11:18 +0000 (17:11 -0400)
FIXES:
 - Added set/get enabled Account class methods.

Signed-off-by: Bruno Abinader <bruno.abinader@indt.org.br>
Acked-by: Ragner Magalhaes <ragner.magalhaes@indt.org.br>
Acked-by: Ricardo Guimaraes <ricardo.guimaraes@indt.org.br>

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

account.pyx

index 90f09b1..78fac03 100644 (file)
@@ -116,6 +116,14 @@ cdef class Account:
             return None
     remember_password = property(__get_remember_password)
 
+    def __get_enabled(self):
+        if self.__exists:
+            return account.purple_account_get_enabled(self._get_structure(), \
+                    self.core.ui_name)
+        else:
+            return None
+    enabled = property(__get_enabled)
+
     def set_username(self, username):
         """
         Sets the account's username.
@@ -200,6 +208,20 @@ cdef class Account:
         else:
             return False
 
+    def set_enabled(self, value):
+        """
+        Sets wheter or not this account is enabled.
+
+        @param value True if it is enabled, or False otherwise
+        @return True if successful, False if account doesn't exists
+        """
+        if self.__exists:
+            account.purple_account_set_enabled(self._get_structure(), \
+                    self.core.ui_name, bool(value))
+            return True
+        else:
+            return False
+
     def new(self):
         """
         Creates a new account.