Adding function is_connected to Account
authorRagner Magalhaes <ragner.magalhaes@openbossa.org>
Tue, 2 Dec 2008 20:57:59 +0000 (20:57 +0000)
committerAnderson Briglia <anderson.briglia@openbossa.org>
Sat, 28 Feb 2009 21:11:15 +0000 (17:11 -0400)
Adding function is_connected to verify account's connection

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@1382 596f6dd7-e928-0410-a184-9e12fd12cf7e

account.pyx

index 9c36757..d400522 100644 (file)
@@ -399,6 +399,19 @@ cdef class Account:
         if c_account:
             return account.c_purple_account_get_enabled(c_account, ui)
         else:
-            return None
+            return False
+
+    def is_connected(self, acc):
+        ''' @param acc Tuple (username, protocol id) '''
+        ''' @param ui The UI '''
+        cdef account.PurpleAccount *c_account
+
+        c_account = account.c_purple_accounts_find(acc[0], acc[1])
+        if c_account:
+            return account.c_purple_account_is_connected(c_account)
+        else:
+            return False
+