Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2007-11-12 12:09:29 (GMT)
committer Simon McVittie <simon.mcvittie@collabora.co.uk>2007-11-12 12:09:29 (GMT)
commit43d1d48b275664a5fe05f48260438ef7d070e19a (patch)
treea86f3e59ec2f18160acaaeacf5914e30724c05c4
parentf92f197661928a5e908616ddb48531944ff348ba (diff)
parente231a4a9476e6685a9895696cbb7e70de2e5fbba (diff)
Merge branch '4660'
Conflicts: NEWS
-rw-r--r--NEWS2
-rw-r--r--src/presenceservice.py49
-rw-r--r--src/pstest.py16
3 files changed, 43 insertions, 24 deletions
diff --git a/NEWS b/NEWS
index 1c583ac..49cecec 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
* #4692: Don't put activity sharer in 'private' property (correcting a wrong
part of the patch for #4585) (smcv)
+* #4660: when calling ShareActivity(), allow private, tags, color to be set
+ by putting them in the properties dict, which was previously ignored (smcv)
Snapshot 944c5280b4
diff --git a/src/presenceservice.py b/src/presenceservice.py
index 20442de..c179618 100644
--- a/src/presenceservice.py
+++ b/src/presenceservice.py
@@ -728,16 +728,6 @@ class PresenceService(ExportedGObject):
else:
return self._owner.object_path()
- @dbus.service.method(PRESENCE_INTERFACE, in_signature="sssa{sv}",
- out_signature="o", async_callbacks=('async_cb', 'async_err_cb'),
- sender_keyword='sender')
- def ShareActivity(self, actid, atype, name, properties, async_cb,
- async_err_cb, sender):
- _logger.debug('ShareActivity(actid=%r, atype=%r, name=%r, '
- 'properties=%r)', actid, atype, name, properties)
- self._share_activity(actid, atype, name, properties, True,
- async_cb, async_err_cb, sender)
-
def _get_preferred_plugin(self):
for tp in self._plugins:
if tp in self._connected_plugins:
@@ -757,29 +747,56 @@ class PresenceService(ExportedGObject):
for tp in self._handles_buddies:
tp.cleanup()
- def _share_activity(self, actid, atype, name, properties, private,
- async_cb, async_err_cb, sender):
+ @dbus.service.method(PRESENCE_INTERFACE, in_signature="sssa{sv}",
+ out_signature="o", async_callbacks=('async_cb', 'async_err_cb'),
+ sender_keyword='sender')
+ def ShareActivity(self, actid, atype, name, properties, async_cb,
+ async_err_cb, sender):
"""Create the shared Activity.
actid -- XXX
atype -- XXX
name -- XXX
properties -- 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
sender -- unique name of activity
"""
+ _logger.debug('ShareActivity(actid=%r, atype=%r, name=%r, '
+ 'properties=%r)', actid, atype, name, properties)
+
+ # FIXME: we should support the properties dict better.
+ # However, at the moment the only properties not already given
+ # by a separate argument are 'tags', 'color' and 'private', so let's
+ # hard-code support for those and only those. See #4660
+ private = properties.pop('private', True)
+ tags = properties.pop('tags', u'')
+
+ try:
+ if not isinstance(tags, unicode):
+ raise ValueError('"tags" property must be Unicode string')
+
+ if not isinstance(private, (dbus.Boolean, bool)):
+ raise ValueError('"private" property must be boolean')
+
+ if properties:
+ raise ValueError('Unsupported properties given: <%s>'
+ % ', '.join(properties.iterkeys()))
+ except ValueError, e:
+ async_err_cb(e)
+ return
+
objid = self._get_next_object_id()
# XXX: is the preferred Telepathy plugin always the right way to
# share the activity?
- color = self._owner.props.color
+ # We set private=True here - when the activity becomes shared
+ # via join(), we'll set private to the correct value.
activity = Activity(self._session_bus, objid, self,
self._get_preferred_plugin(), 0,
id=actid, type=atype,
name=name, color=color, local=True,
- private=private)
+ private=True, tags=tags)
+
activity.connect("validity-changed",
self._activity_validity_changed_cb)
activity.connect("disappeared", self._activity_disappeared_cb)
diff --git a/src/pstest.py b/src/pstest.py
index 094e15b..b3c8183 100644
--- a/src/pstest.py
+++ b/src/pstest.py
@@ -93,18 +93,18 @@ class TestOwner(GenericOwner):
if not len(self._test_activities):
# Share some activities
actid = util.unique_id("Activity 1")
- callbacks = (lambda *args: self._share_reply_cb(actid, *args),
- lambda *args: self._share_error_cb(actid, *args))
atype = "org.laptop.WebActivity"
- properties = {"foo": "bar"}
- self._ps._share_activity(actid, atype, "Wembley Stadium", properties, callbacks)
+ properties = {"tags": "bar"}
+ self._ps.ShareActivity(actid, atype, "Wembley Stadium", properties,
+ async_cb=lambda path: self._share_reply_cb(actid, path),
+ async_err_cb=lambda e: self._share_error_cb(actid, e))
actid2 = util.unique_id("Activity 2")
- callbacks = (lambda *args: self._share_reply_cb(actid2, *args),
- lambda *args: self._share_error_cb(actid2, *args))
atype = "org.laptop.WebActivity"
- properties = {"baz": "bar"}
- self._ps._share_activity(actid2, atype, "Maine Road", properties, callbacks)
+ properties = {"tags": "baz"}
+ self._ps.ShareActivity(actid2, atype, "Maine Road", properties,
+ async_cb=lambda path: self._share_reply_cb(actid2, path),
+ async_err_cb=lambda e: self._share_error_cb(actid2, e))
# Change a random property ever 10 seconds
if self._change_timeout == 0: