From e5cbbcebacb064a4e291a12c05af9ebf93376fd9 Mon Sep 17 00:00:00 2001 From: Ragner Magalhaes Date: Tue, 2 Dec 2008 21:09:44 +0000 Subject: [PATCH] Updated get parameters inside Account class. FIXES: - When using property, "set_*" methods didn't return anything, so whe couldn't know if the operation was successful or not. Because of this, I've moved them into separate methods outside of the property (like username and protocol_id). Signed-off-by: Bruno Abinader Acked-by: Ricardo Guimaraes git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1414 596f6dd7-e928-0410-a184-9e12fd12cf7e --- account.pyx | 69 +++++++++++++++++++++++++++++++---------------------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/account.pyx b/account.pyx index bd2eb44..d5f5ef2 100644 --- a/account.pyx +++ b/account.pyx @@ -82,14 +82,7 @@ cdef class Account: return None else: return None - def __set_password(self, password): - if self.__exists: - account.purple_account_set_password(self._get_structure(), \ - password) - return True - else: - return False - password = property(__get_password, __set_password) + password = property(__get_password) def __get_alias(self): cdef char *alias = NULL @@ -101,14 +94,7 @@ cdef class Account: return None else: return None - def __set_alias(self, alias): - if self.__exists: - account.purple_account_set_alias(self._get_structure(), \ - alias) - return True - else: - return False - alias = property(__get_alias, __set_alias) + alias = property(__get_alias) def __get_user_info(self): cdef char *user_info = NULL @@ -120,14 +106,7 @@ cdef class Account: return None else: return None - def __set_user_info(self, user_info): - if self.__exists: - account.purple_account_set_user_info(self._get_structure(), \ - user_info) - return True - else: - return False - user_info = property(__get_user_info, __set_user_info) + user_info = property(__get_user_info) def __get_remember_password(self): if self.__exists: @@ -135,15 +114,7 @@ cdef class Account: self._get_structure()) else: return None - def __set_remember_password(self, remember_password): - if self.__exists: - account.purple_account_set_remember_password( \ - self._get_structure(), remember_password) - return True - else: - return False - remember_password = property(__get_remember_password, \ - __set_remember_password) + remember_password = property(__get_remember_password) def set_username(self, username): if self.__exists: @@ -160,6 +131,38 @@ cdef class Account: else: return False + def set_password(self, password): + if self.__exists: + account.purple_account_set_password(self._get_structure(), \ + password) + return True + else: + return False + + def set_alias(self, alias): + if self.__exists: + account.purple_account_set_alias(self._get_structure(), \ + alias) + return True + else: + return False + + def set_user_info(self, user_info): + if self.__exists: + account.purple_account_set_user_info(self._get_structure(), \ + user_info) + return True + else: + return False + + def set_remember_password(self, remember_password): + if self.__exists: + account.purple_account_set_remember_password( \ + self._get_structure(), remember_password) + return True + else: + return False + def new(self): if self.__exists: return False -- 1.7.9.5