Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2011-06-09 14:53:18 (GMT)
committer Simon Schampijer <simon@schampijer.de>2011-06-09 14:53:18 (GMT)
commitc86b6d591733abcbe53dbb0b70c868dd2d94e28b (patch)
tree39283ed55068ef3fb612588f488d57f69cf23704
parent67143d8042c32a0976b063c5af4089da7b325fcf (diff)
Fix invitations from a non sugar client (empathy), part of OLPC #10814
This differentiates between sugar and non sugar invitations using the handle type. For non-sugar invitations we use the activity id to determine which activity to join. Signed-off-by: Simon Schampijer <simon@laptop.org> Acked-By: Sascha Silbe <silbe@activitycentral.com>
-rw-r--r--src/sugar/activity/activity.py29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
index 35082cc..5156725 100644
--- a/src/sugar/activity/activity.py
+++ b/src/sugar/activity/activity.py
@@ -68,6 +68,7 @@ from telepathy.interfaces import CHANNEL, \
CLIENT, \
CLIENT_HANDLER
from telepathy.constants import CONNECTION_HANDLE_TYPE_CONTACT
+from telepathy.constants import CONNECTION_HANDLE_TYPE_ROOM
from sugar import util
from sugar.presence import presenceservice
@@ -389,17 +390,22 @@ class Activity(Window, gtk.Container):
else:
logging.debug('Unknown share scope %r', share_scope)
- def __got_channel_cb(self, wait_loop, connection_path, channel_path):
+ def __got_channel_cb(self, wait_loop, connection_path, channel_path,
+ handle_type):
logging.debug('Activity.__got_channel_cb')
- connection_name = connection_path.replace('/', '.')[1:]
+ pservice = presenceservice.get_instance()
- bus = dbus.SessionBus()
- channel = bus.get_object(connection_name, channel_path)
- room_handle = channel.Get(CHANNEL, 'TargetHandle')
+ if handle_type == CONNECTION_HANDLE_TYPE_ROOM:
+ connection_name = connection_path.replace('/', '.')[1:]
+ bus = dbus.SessionBus()
+ channel = bus.get_object(connection_name, channel_path)
+ room_handle = channel.Get(CHANNEL, 'TargetHandle')
+ mesh_instance = pservice.get_activity_by_handle(connection_path,
+ room_handle)
+ else:
+ mesh_instance = pservice.get_activity(self._activity_id,
+ warn_if_none=False)
- pservice = presenceservice.get_instance()
- mesh_instance = pservice.get_activity_by_handle(connection_path,
- room_handle)
self._set_up_sharing(mesh_instance, SCOPE_PRIVATE)
wait_loop.quit()
@@ -945,8 +951,11 @@ class _ClientHandler(dbus.service.Object, DBusProperties):
account, connection, channels, requests_satisfied,
user_action_time, handler_info)
try:
- for channel in channels:
- self._got_channel_cb(connection, channel[0])
+ for object_path, properties in channels:
+ channel_type = properties[CHANNEL + '.ChannelType']
+ handle_type = properties[CHANNEL + '.TargetHandleType']
+ if channel_type == CHANNEL_TYPE_TEXT:
+ self._got_channel_cb(connection, object_path, handle_type)
except Exception, e:
logging.exception(e)