diff --git a/services/presence/activity.py b/services/presence/activity.py index 6a4ee568..7471b46c 100644 --- a/services/presence/activity.py +++ b/services/presence/activity.py @@ -229,7 +229,7 @@ class Activity(DBusGObject): # Not for us return - (sigid, async_cb, async_err_cb) = userdata + (sigid, owner, async_cb, async_err_cb) = userdata self._tp.disconnect(sigid) if exc: @@ -238,16 +238,17 @@ class Activity(DBusGObject): else: self._handle_share_join(tp, text_channel) self.send_properties() + owner.add_activity(self) async_cb(dbus.ObjectPath(self._object_path)) logging.debug("Share of activity %s succeeded." % self._id) - def _share(self, (async_cb, async_err_cb)): + def _share(self, (async_cb, async_err_cb), owner): logging.debug("Starting share of activity %s" % self._id) if self._joined: async_err_cb(RuntimeError("Already shared activity %s" % self.props.id)) return sigid = self._tp.connect('activity-shared', self._shared_cb) - self._tp.share_activity(self.props.id, (sigid, async_cb, async_err_cb)) + self._tp.share_activity(self.props.id, (sigid, owner, async_cb, async_err_cb)) logging.debug("done with share attempt %s" % self._id) def _joined_cb(self, tp, activity_id, text_channel, exc, userdata): diff --git a/services/presence/presenceservice.py b/services/presence/presenceservice.py index 9fa34834..fd4cbb6b 100644 --- a/services/presence/presenceservice.py +++ b/services/presence/presenceservice.py @@ -169,7 +169,10 @@ class PresenceService(dbus.service.Object): del self._activities[activity.props.id] def _buddy_activities_changed(self, tp, contact_handle, activities): - logging.debug("------------activities changed-------------") + acts = [] + for act in activities: + acts.append(str(act)) + logging.debug("Handle %s activities changed: %s" % (contact_handle, acts)) buddies = self._handles_buddies[tp] buddy = buddies.get(contact_handle) @@ -306,7 +309,7 @@ class PresenceService(dbus.service.Object): id=actid, type=atype, name=name, color=color, local=True) activity.connect("validity-changed", self._activity_validity_changed_cb) self._activities[actid] = activity - activity._share(callbacks) + activity._share(callbacks, self._owner) # local activities are valid at creation by definition, but we can't # connect to the activity's validity-changed signal until its already