[Sugar-devel] [PATCH sugar] Anly approve and not handle channels in the shell, part of OLPC #10738

Simon Schampijer simon at schampijer.de
Thu Apr 14 13:42:05 EDT 2011


We only approve channels in the shell and do not claim to handle them
anymore. The handling is now done by the activity (toolkit patch).
More info about approving and handling of channels can be found at [1].

This patch does as well only handle sugar activity invitations, invitations
from non-sugar clients will be handled in a separate patch.

[1] http://telepathy.freedesktop.org/doc/book/sect.channel-dispatcher.clients.html

Signed-off-by: Simon Schampijer <simon at laptop.org>
---
 src/jarabe/model/telepathyclient.py |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/jarabe/model/telepathyclient.py b/src/jarabe/model/telepathyclient.py
index c6fbac1..cea8693 100644
--- a/src/jarabe/model/telepathyclient.py
+++ b/src/jarabe/model/telepathyclient.py
@@ -19,11 +19,16 @@ import logging
 import dbus
 from dbus import PROPERTIES_IFACE
 from telepathy.interfaces import CLIENT, \
+                                 CHANNEL, \
+                                 CHANNEL_TYPE_TEXT, \
                                  CLIENT_APPROVER, \
                                  CLIENT_HANDLER, \
                                  CLIENT_INTERFACE_REQUESTS
 from telepathy.server import DBusProperties
 
+from telepathy.constants import CONNECTION_HANDLE_TYPE_CONTACT
+from telepathy.constants import CONNECTION_HANDLE_TYPE_ROOM
+
 from sugar import dispatch
 
 
@@ -48,9 +53,6 @@ class TelepathyClient(dbus.service.Object, DBusProperties):
         self._implement_property_get(CLIENT, {
             'Interfaces': lambda: list(self._interfaces),
           })
-        self._implement_property_get(CLIENT_HANDLER, {
-            'HandlerChannelFilter': self.__get_filters_cb,
-          })
         self._implement_property_get(CLIENT_APPROVER, {
             'ApproverChannelFilter': self.__get_filters_cb,
           })
@@ -60,8 +62,17 @@ class TelepathyClient(dbus.service.Object, DBusProperties):
 
     def __get_filters_cb(self):
         logging.debug('__get_filters_cb')
-        filter_dict = dbus.Dictionary({}, signature='sv')
-        return dbus.Array([filter_dict], signature='a{sv}')
+
+        filt = {
+            CHANNEL + '.ChannelType': CHANNEL_TYPE_TEXT,
+            CHANNEL + '.TargetHandleType': CONNECTION_HANDLE_TYPE_ROOM,
+            }
+        filter_dict = dbus.Dictionary(filt, signature='sv')
+        filters = dbus.Array([filter_dict], signature='a{sv}')
+
+        logging.debug('__get_filters_cb %r', filters)
+
+        return filters
 
     @dbus.service.method(dbus_interface=CLIENT_HANDLER,
                          in_signature='ooa(oa{sv})aota{sv}', out_signature='')
-- 
1.7.4



More information about the Sugar-devel mailing list