Adding function get_protocol_id to Account class
[python-purple] / account.pyx
index e562013..f700016 100644 (file)
@@ -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
+