X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=blobdiff_plain;f=account.pyx;h=fe27e58b1bc39638515bdd7b0a0e2d7f67a4d824;hp=e45288d3ba7f5638821d1771446a743d9df10873;hb=3884b9d3f22588784501bde1734107aeb4ff0841;hpb=501c0498d70144d950602879e44840e761e8cc00 diff --git a/account.pyx b/account.pyx index e45288d..fe27e58 100644 --- a/account.pyx +++ b/account.pyx @@ -305,6 +305,15 @@ cdef class Account: iter = iter.next return buddies + def new(self, username, protocol_id): + cdef account.PurpleAccount *c_account + c_account = account.c_purple_account_new(username, protocol_id) + + if c_account == NULL: + return None + + return (username, protocol_id) + def get_all(self): cdef glib.GList *iter cdef account.PurpleAccount *acc @@ -323,3 +332,22 @@ 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) +