Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu.vizoso@collabora.co.uk>2010-08-08 09:06:52 (GMT)
committer Tomeu Vizoso <tomeu.vizoso@collabora.co.uk>2010-08-20 13:02:28 (GMT)
commit628c07688d1dc86a6c494e07b37301cad8f5907c (patch)
treead1ec72894cfff3113454c73e3e55e5061d18106
parent02be50cccf4bc0916797689f8dbc26ec96bd9924 (diff)
Request again the current activity when we get to know about a new
activity through a buddy's ActivitiesChanged.
-rw-r--r--src/jarabe/desktop/meshbox.py2
-rw-r--r--src/jarabe/model/neighborhood.py16
2 files changed, 17 insertions, 1 deletions
diff --git a/src/jarabe/desktop/meshbox.py b/src/jarabe/desktop/meshbox.py
index 92ce47a..0fea384 100644
--- a/src/jarabe/desktop/meshbox.py
+++ b/src/jarabe/desktop/meshbox.py
@@ -502,7 +502,7 @@ class MeshBox(gtk.VBox):
icon.destroy()
def __buddy_notify_current_activity_cb(self, buddy_model, pspec):
- logging.debug('MeshBox.__buddy_notify_current_activity_cb')
+ logging.debug('MeshBox.__buddy_notify_current_activity_cb %s', buddy_model.props.current_activity)
if buddy_model.props.current_activity is None:
if not buddy_model.props.key in self._buddies:
self._add_buddy(buddy_model)
diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py
index c355e25..022a35a 100644
--- a/src/jarabe/model/neighborhood.py
+++ b/src/jarabe/model/neighborhood.py
@@ -336,6 +336,8 @@ class _Account(gobject.GObject):
logging.debug('_Account.__current_activity_changed_cb %r %r %r', contact_handle, activity_id, room_handle)
if contact_handle in self._buddy_handles:
contact_id = self._buddy_handles[contact_handle]
+ if not activity_id and room_handle:
+ activity_id = self._activity_handles.get(room_handle, '')
self.emit('current-activity-updated', contact_id, activity_id)
def __get_current_activity_cb(self, contact_handle, activity_id, room_handle):
@@ -366,6 +368,16 @@ class _Account(gobject.GObject):
error_handler=partial(self.__error_handler_cb,
'ActivityProperties.GetProperties'))
+ # Sometimes we'll get CurrentActivityChanged before we get to
+ # know about the activity so we miss the event. In that case,
+ # request again the current activity for this buddy.
+ connection = self._connection[CONNECTION_INTERFACE_BUDDY_INFO]
+ connection.GetCurrentActivity(
+ buddy_handle,
+ reply_handler=partial(self.__get_current_activity_cb, buddy_handle),
+ error_handler=partial(self.__error_handler_cb,
+ 'BuddyInfo.GetCurrentActivity'))
+
if not activity_id in self._buddies_per_activity:
self._buddies_per_activity[activity_id] = set()
self._buddies_per_activity[activity_id].add(buddy_handle)
@@ -746,6 +758,10 @@ class Neighborhood(gobject.GObject):
logging.debug('__current_activity_updated_cb Unknown buddy with '
'contact_id %r', contact_id)
return
+ if activity_id and activity_id not in self._activities:
+ logging.debug('__current_activity_updated_cb Unknown activity with '
+ 'id %s', activity_id)
+ activity_id = ''
buddy = self._buddies[contact_id]
if buddy.props.current_activity is not None: