diff options
Diffstat (limited to 'src/sugar/presence/presenceservice.py')
-rw-r--r-- | src/sugar/presence/presenceservice.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/sugar/presence/presenceservice.py b/src/sugar/presence/presenceservice.py index 8e50980..6b42290 100644 --- a/src/sugar/presence/presenceservice.py +++ b/src/sugar/presence/presenceservice.py @@ -36,7 +36,8 @@ from sugar.presence.util import get_connection_manager from telepathy.interfaces import ACCOUNT, \ ACCOUNT_MANAGER, \ CONNECTION -from telepathy.constants import HANDLE_TYPE_CONTACT +from telepathy.constants import HANDLE_TYPE_CONTACT, \ + HANDLE_TYPE_ROOM _logger = logging.getLogger('sugar.presence.presenceservice') @@ -263,14 +264,16 @@ class PresenceService(gobject.GObject): 'instance') return self._activity_cache else: - for connection in get_connection_manager().connections: - try: - room_handle = connection.GetActivity(activity_id) - activity = Activity(connection, room_handle) - self._activity_cache = activity - return activity - except: - pass + connection_manager = get_connection_manager() + connections_per_account = connection_manager.get_connections_per_account() + for account_path, connection in connections_per_account.items(): + room_handles = connection.RequestHandles(HANDLE_TYPE_ROOM, + [activity_id], + dbus_interface=CONNECTION) + activity = Activity(account_path, connection, + room_handle=room_handles[0]) + self._activity_cache = activity + return activity return None |