diff options
author | Jonas Smedegaard <dr@jones.dk> | 2008-10-19 22:17:19 (GMT) |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2008-10-19 22:17:19 (GMT) |
commit | 2a07f41c5edcfd178eb799685eea942ea2c410e5 (patch) | |
tree | 66f037668900de4bfcc4f559fd0586cdf0139b51 | |
parent | a7986c9c9a7af8fa463948c8ee7aa02c070f84da (diff) | |
parent | 3e1e63157aee2e36f2d1c895655661c9e19c58ef (diff) |
Merge commit 'v0.82.2' into upstream
-rw-r--r-- | NEWS | 17 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/telepathy_plugin.py | 27 |
3 files changed, 43 insertions, 3 deletions
@@ -1,3 +1,20 @@ +sugar-presence-service 0.82.2 (2008-08-08) +========================================== + +The "I should use pyflakes more often" release. + +This brown paper bag release fixes a stupid name error in #5618 fixe. + +sugar-presence-service 0.82.1 (2008-08-07) +========================================== + +The "One more bug fixed" release. + +Fixes: + +* dev.laptop.org #5618: PS should drop handles causing InspectHandles failing + + sugar-presence-service 0.82.0 (2008-08-06) ========================================== diff --git a/configure.ac b/configure.ac index 8ffeedc..aa5cbc6 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([Sugar Presence Service],[0.82.0],[],[sugar-presence-service]) +AC_INIT([Sugar Presence Service],[0.82.2],[],[sugar-presence-service]) AC_PREREQ([2.59]) diff --git a/src/telepathy_plugin.py b/src/telepathy_plugin.py index 2042111..25bbd1c 100644 --- a/src/telepathy_plugin.py +++ b/src/telepathy_plugin.py @@ -35,6 +35,7 @@ from telepathy.interfaces import (CONN_INTERFACE, CHANNEL_TYPE_TEXT, CONN_INTERFACE_PRESENCE, CONN_INTERFACE_AVATARS, CONN_INTERFACE_ALIASING, CHANNEL_TYPE_CONTACT_LIST, CONN_MGR_INTERFACE) +from telepathy.errors import (InvalidArgument, InvalidHandle) import psutils @@ -356,6 +357,20 @@ class TelepathyPlugin(gobject.GObject): _logger.debug('%r: Contacts now offline: %r', self, handles) self.emit("contacts-offline", handles) + def _inspect_handles_one_by_one(self, handle_type, handles): + jids = [] + + for handle in handles: + try: + jid = self._conn[CONN_INTERFACE].InspectHandles(handle_type, + [handle]) + except (InvalidArgument, InvalidHandle): + continue + else: + jids.append(jid[0]) + + return jids + def _contacts_online(self, handles): """Handle contacts coming online""" relevant = [] @@ -375,8 +390,16 @@ class TelepathyPlugin(gobject.GObject): if not relevant: return - jids = self._conn[CONN_INTERFACE].InspectHandles( - HANDLE_TYPE_CONTACT, relevant) + try: + jids = self._conn[CONN_INTERFACE].InspectHandles( + HANDLE_TYPE_CONTACT, relevant) + except (InvalidArgument, InvalidHandle): + # InspectHandles failed so discard invalid handles by trying to + # inspect them one by one. + # FIXME: the Contacts interface should offer a proper way to do this. + jids = self._inspect_handles_one_by_one(HANDLE_TYPE_CONTACT, relevant) + if not jids: + return handle_to_objid = self.identify_contacts(None, relevant, jids) objids = [] |