[Pkg-sugar-commit] [sugar-toolkit] 04/06: Fix invitations from a non sugar client (empathy), part of OLPC #10814
Jonas Smedegaard
dr at jones.dk
Thu Apr 16 18:52:31 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag v0.92.2
in repository sugar-toolkit.
commit c7dee06967eac64e18dc8c6d2b8121967f9dd4ed
Author: Simon Schampijer <simon at schampijer.de>
Date: Thu Jun 9 16:53:18 2011 +0200
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 at laptop.org>
Acked-By: Sascha Silbe <silbe at activitycentral.com>
---
src/sugar/activity/activity.py | 29 +++++++++++++++++++----------
1 file 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)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-sugar/sugar-toolkit.git
More information about the pkg-sugar-commit
mailing list