X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=blobdiff_plain;f=account.pyx;h=f700016b3e9afe41515f54240204818dfdbe2219;hp=e562013a8f08a00cd3a5f0d95e6c0b8c5f236e3d;hb=4d20f8e41546818f08ce52c748889e10f96345e8;hpb=e5ebb86780b3aaa049d510bfa0c9ce265ba5ebb5 diff --git a/account.pyx b/account.pyx index e562013..f700016 100644 --- a/account.pyx +++ b/account.pyx @@ -332,3 +332,61 @@ cdef class Account: return accounts + def get_password(self, acc): + ''' @param acc Tuple (username, protocol id) ''' + 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_password(c_account) + else: + return None + + def set_password(self, acc, password): + ''' @param acc Tuple (username, protocol id) ''' + ''' @param password The account's password ''' + cdef account.PurpleAccount *c_account + + c_account = account.c_purple_accounts_find(acc[0], acc[1]) + if c_account: + account.c_purple_account_set_password(c_account, password) + + def get_alias(self, acc): + ''' @param acc Tuple (username, protocol id) ''' + 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_alias(c_account) + else: + return None + + def set_alias(self, acc, alias): + ''' @param acc Tuple (username, protocol id) ''' + ''' @param alias The account's alias ''' + cdef account.PurpleAccount *c_account + + c_account = account.c_purple_accounts_find(acc[0], acc[1]) + if c_account: + account.c_purple_account_set_alias(c_account, alias) + + def set_protocol_id(self, acc, protocol_id): + ''' @param acc Tuple (username, protocol id) ''' + ''' @param protocol_id The new account's protocol id ''' + cdef account.PurpleAccount *c_account + + c_account = account.c_purple_accounts_find(acc[0], acc[1]) + if c_account: + account.c_purple_account_set_protocol_id(c_account, protocol_id) + + def get_protocol_id(self, acc): + ''' @param acc Tuple (username, protocol id) ''' + ''' @return account's protocol id ''' + 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_protocol_id(c_account) + else: + return None +