diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2013-07-25 15:32:48 +0200 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2013-07-25 15:32:48 +0200 |
commit | bc681a770e1846ef0ae7cbd3f514f5164d9de203 (patch) | |
tree | 61c68a2d1274fc8264d6f814c5ab7acfb02c7410 | |
parent | 1faaaca87037710473ced8187414a295b872ebe9 (diff) |
phoenix-test: cope with not having the contact list interface
-rwxr-xr-x | src/phoenix-test.py | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/phoenix-test.py b/src/phoenix-test.py index 5acc150..c821bda 100755 --- a/src/phoenix-test.py +++ b/src/phoenix-test.py @@ -86,10 +86,17 @@ class TestConnection: self.fully_subscribed = False self.call_success = False - self.connection.connect ('notify::contact-list-state', - self.contact_list_state_cb, None) + self.contact_list = self.connection.has_interface( + Tp.IFACE_CONNECTION_INTERFACE_CONTACT_LIST) - if connection.get_contact_list_state() == Tp.ContactListState.SUCCESS: + if self.contact_list: + self.connection.connect ('notify::contact-list-state', + self.contact_list_state_cb, None) + + if connection.get_contact_list_state() == Tp.ContactListState.SUCCESS: + self.start_test() + + else: self.start_test() def contact_list_state_cb (self, connection, spec, data): @@ -178,18 +185,21 @@ class TestConnection: def got_test_contact (self, c, r, u): self.contact = c.dup_contact_by_id_finish (r) - s = self.contact.get_subscribe_state () - # If we're not subscribed, subscribe, needed to make calls for example - if s != Tp.SubscriptionState.YES: - print "Asking for subscription" - self.contact.request_subscription_async ("Test subscription", - lambda c, r, u: c.request_subscription_finish (r) , + + if self.contact_list: + s = self.contact.get_subscribe_state () + # If we're not subscribed, subscribe, needed to make calls for example + if s != Tp.SubscriptionState.YES: + print "Asking for subscription" + self.contact.request_subscription_async ("Test subscription", + lambda c, r, u: c.request_subscription_finish (r) , + None) + + self.contact.connect ("notify::publish-state", self.contact_states_cb, + None) + self.contact.connect ("notify::subscribe-state", self.contact_states_cb, None) - self.contact.connect ("notify::publish-state", self.contact_states_cb, - None) - self.contact.connect ("notify::subscribe-state", self.contact_states_cb, - None) self.contact.connect ("notify::capabilities", lambda *x: self.handle_capabilities(), None) self.handle_capabilities () |