diff options
author | Morgan Collett <morgan.collett@gmail.com> | 2007-08-22 14:55:08 (GMT) |
---|---|---|
committer | Morgan Collett <morgan.collett@gmail.com> | 2007-08-22 14:55:08 (GMT) |
commit | 4a2ca8b04e971fbc8774a824eb2b66362b757a86 (patch) | |
tree | 7f0101275d5c23e54197bb9dfca229d646c7a7ba /src/presenceservice.py | |
parent | e82ee34e2e2c83fb51859f193fe8c2e6f9356da2 (diff) |
PresenceService API Change to support sharing by invitation only
Diffstat (limited to 'src/presenceservice.py')
-rw-r--r-- | src/presenceservice.py | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/src/presenceservice.py b/src/presenceservice.py index bc49488..6859796 100644 --- a/src/presenceservice.py +++ b/src/presenceservice.py @@ -708,7 +708,22 @@ class PresenceService(ExportedGObject): out_signature="o", async_callbacks=('async_cb', 'async_err_cb')) def ShareActivity(self, actid, atype, name, properties, async_cb, async_err_cb): - self._share_activity(actid, atype, name, properties, + _logger.warning('ShareActivity deprecated, use AdvertiseActivity') + self._share_activity(actid, atype, name, properties, False, + async_cb, async_err_cb) + + @dbus.service.method(_PRESENCE_INTERFACE, in_signature="sssa{sv}", + out_signature="o", async_callbacks=('async_cb', 'async_err_cb')) + def AdvertiseActivity(self, actid, atype, name, properties, async_cb, + async_err_cb): + self._share_activity(actid, atype, name, properties, False, + async_cb, async_err_cb) + + @dbus.service.method(_PRESENCE_INTERFACE, in_signature="sssa{sv}", + out_signature="o", async_callbacks=('async_cb', 'async_err_cb')) + def InviteActivity(self, actid, atype, name, properties, async_cb, + async_err_cb): + self._share_activity(actid, atype, name, properties, True, async_cb, async_err_cb) def _get_preferred_plugin(self): @@ -730,10 +745,20 @@ class PresenceService(ExportedGObject): for tp in self._handles_buddies: tp.cleanup() - def _share_activity(self, actid, atype, name, properties, async_cb, - async_err_cb): + def _share_activity(self, actid, atype, name, private, + async_cb, async_err_cb): + """Create the shared Activity. + + actid -- XXX + atype -- XXX + name -- XXX + private -- bool: True for by-invitation-only sharing, + False for publicly advertised sharing + async_cb -- function: Callback for success + async_err_cb -- function: Callback for failure + """ objid = self._get_next_object_id() - # FIXME: is the preferred Telepathy plugin always the right way to + # XXX: is the preferred Telepathy plugin always the right way to # share the activity? color = self._owner.props.color activity = Activity(self._session_bus, objid, self, @@ -750,7 +775,7 @@ class PresenceService(ExportedGObject): self._activities_by_handle[tp][room] = activity async_cb(activity.object_path()) - activity.join(activity_shared, async_err_cb, True) + activity.join(activity_shared, async_err_cb, True, private) # local activities are valid at creation by definition, but we can't # connect to the activity's validity-changed signal until its already @@ -765,8 +790,8 @@ class PresenceService(ExportedGObject): activity.props.id) else: self.ActivityDisappeared(activity.object_path()) - _logger.debug("Activity disappeared: %s (%s)", activity.props.name, - activity.props.id) + _logger.debug("Activity disappeared: %s (%s)", + activity.props.name, activity.props.id) def _activity_properties_changed(self, tp, act_handle, props): activity = self._activities_by_handle[tp].get(act_handle) |