diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-06-07 16:20:32 (GMT) |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-06-07 16:20:32 (GMT) |
commit | 71cf77ced8545c8220a8e997158146267969a83f (patch) | |
tree | f84f31a41c87564e06f913d1219a30b3c801314c | |
parent | 232fa0828a8265cd51edcc0825c2f4201a80f0a8 (diff) |
Remove most of the distinction between joining and sharing - only the Activity cares, more or less
-rw-r--r-- | src/activity.py | 24 | ||||
-rw-r--r-- | src/presenceservice.py | 2 | ||||
-rw-r--r-- | src/server_plugin.py | 27 |
3 files changed, 11 insertions, 42 deletions
diff --git a/src/activity.py b/src/activity.py index c54b58c..ac1378f 100644 --- a/src/activity.py +++ b/src/activity.py @@ -320,7 +320,7 @@ class Activity(ExportedGObject): unsuccessful """ - self.join(lambda unused: async_cb(), async_err_cb) + self.join(lambda unused: async_cb(), async_err_cb, False) @dbus.service.method(_ACTIVITY_INTERFACE, in_signature="", out_signature="ao") @@ -496,22 +496,6 @@ class Activity(ExportedGObject): return True - def _share(self, async_cb, async_err_cb): - """XXX - not documented yet - - XXX - This method is called externally by the PresenceService - despite the fact that this is supposed to be an internal method! - """ - _logger.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._joined_cb) - self._tp.share_activity(self.props.id, (sigid, async_cb, - async_err_cb, True)) - _logger.debug("done with share attempt %s" % self._id) - def _joined_cb(self, tp, activity_id, room_handle, text_channel, exc, userdata): """XXX - not documented yet @@ -538,7 +522,7 @@ class Activity(ExportedGObject): async_cb(dbus.ObjectPath(self._object_path)) _logger.debug("%s of activity %s succeeded" % (verb, self._id)) - def join(self, async_cb, async_err_cb): + def join(self, async_cb, async_err_cb, sharing): """Local method for the local user to attempt to join the activity. async_cb -- Callback method to be called if join attempt is successful @@ -549,13 +533,15 @@ class Activity(ExportedGObject): which in turn passes them back as parameters in a callback to the _joined_cb method; this callback is set up within this method. """ + _logger.debug("Starting share/join of activity %s", self._id) if self._joined: async_err_cb(RuntimeError("Already joined activity %s" % self.props.id)) return sigid = self._tp.connect('activity-joined', self._joined_cb) self._tp.join_activity(self.props.id, (sigid, async_cb, async_err_cb, - False)) + sharing)) + _logger.debug("triggered share/join attempt on activity %s", self._id) def get_channels(self): """Local method to get the list of channels associated with this diff --git a/src/presenceservice.py b/src/presenceservice.py index 9aefe1a..8aeaac6 100644 --- a/src/presenceservice.py +++ b/src/presenceservice.py @@ -481,7 +481,7 @@ class PresenceService(ExportedGObject): activity.connect("validity-changed", self._activity_validity_changed_cb) self._activities[actid] = activity - activity._share(async_cb, async_err_cb) + activity.join(async_cb, async_err_cb, True) # local activities are valid at creation by definition, but we can't # connect to the activity's validity-changed signal until its already diff --git a/src/server_plugin.py b/src/server_plugin.py index b72bfee..6545fa1 100644 --- a/src/server_plugin.py +++ b/src/server_plugin.py @@ -157,19 +157,14 @@ class ServerPlugin(gobject.GObject): # properties: dict { str => object } # FIXME: are these all the properties or just those that changed? (gobject.SIGNAL_RUN_FIRST, None, [object, object, object]), - 'activity-shared': - # share_activity() succeeded + 'activity-joined': + # join_activity() succeeded # args: # activity ID: str # activity room handle: int or long # channel: telepathy.client.Channel, or None on failure # error: None, or Exception on failure - # userdata as passed to share_activity - (gobject.SIGNAL_RUN_FIRST, None, [object, object, object, object, - object]), - 'activity-joined': - # join_activity() succeeded - # args: as for activity-shared + # userdata as passed to join_activity (gobject.SIGNAL_RUN_FIRST, None, [object, object, object, object, object]), } @@ -571,21 +566,9 @@ class ServerPlugin(gobject.GObject): self._join_activity_get_channel_cb(activity_id, signal, userdata, [handle]) - def share_activity(self, activity_id, userdata): - """Share activity with the network - - activity_id -- unique ID for the activity - userdata -- opaque token to be passed in the resulting event - (id, callback, errback) normally - - Asks the Telepathy server to create a "conference" channel - for the activity or return a handle to an already created - conference channel for the activity. - """ - self._internal_join_activity(activity_id, "activity-shared", userdata) - def join_activity(self, activity_id, userdata): - """Join an activity on the network (or locally) + """Share activity with the network, or join an activity on the + network (or locally) activity_id -- unique ID for the activity userdata -- opaque token to be passed in the resulting event |