X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=blobdiff_plain;f=account.pyx;h=1a621409d6138af151d61e38accdaf0d5810faf6;hp=bd2eb4444f46707cd53ade5015c26a2d61475a08;hb=a99a8cb697789ce35e1fa3a21713729f7b11f1ba;hpb=ffbfc7db585641edc16beb23a6dcd17041df870e diff --git a/account.pyx b/account.pyx index bd2eb44..1a62140 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,17 +114,15 @@ 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): + """ + Sets the account's username. + + @param username The username + @return True if successful, False if account doesn't exists + """ if self.__exists: account.purple_account_set_username(self._get_structure(), \ username) @@ -154,13 +131,81 @@ cdef class Account: return False def set_protocol_id(self, protocol_id): + """ + Sets the account's protocol ID. + + @param protocol_id The protocol ID + @return True if successful, False if account doesn't exists + """ if self.__exists: self.__protocol._set_protocol_id(protocol_id) return True else: return False + def set_password(self, password): + """ + Sets the account's password. + + @param password The password + @return True if successful, False if account doesn't exists + """ + if self.__exists: + account.purple_account_set_password(self._get_structure(), \ + password) + return True + else: + return False + + def set_alias(self, alias): + """ + Sets the account's alias + + @param alias The alias + @return True if successful, False if account doesn't exists + """ + if self.__exists: + account.purple_account_set_alias(self._get_structure(), \ + alias) + return True + else: + return False + + def set_user_info(self, user_info): + """ + Sets the account's user information + + @param user_info The user information + @return True if successful, False if account doesn't exists + """ + 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): + """ + Sets whether or not this account should save its password. + + @param remember_password True if should remember the password, + or False otherwise + @return True if successful, False if account doesn't exists + """ + if self.__exists: + account.purple_account_set_remember_password( \ + self._get_structure(), remember_password) + return True + else: + return False + def new(self): + """ + Creates a new account. + + @return True if successful, False if account already exists + """ if self.__exists: return False else: