Adding functions get/set password to Account class
authorRagner Magalhaes <ragner.magalhaes@openbossa.org>
Tue, 2 Dec 2008 20:55:55 +0000 (20:55 +0000)
committerAnderson Briglia <anderson.briglia@openbossa.org>
Sat, 28 Feb 2009 21:11:15 +0000 (17:11 -0400)
Adding function get/set passoword to set account's password

Signed-off-by: Ragner Magalhaes <ragner.magalhaes@indt.org.br>

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

account.pyx

index e562013..fe27e58 100644 (file)
@@ -332,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)
+