summaryrefslogtreecommitdiff
path: root/sunshine/channel_manager.py
diff options
context:
space:
mode:
Diffstat (limited to 'sunshine/channel_manager.py')
-rw-r--r--sunshine/channel_manager.py74
1 files changed, 7 insertions, 67 deletions
diff --git a/sunshine/channel_manager.py b/sunshine/channel_manager.py
index 6c65b2d..229cedc 100644
--- a/sunshine/channel_manager.py
+++ b/sunshine/channel_manager.py
@@ -80,64 +80,16 @@ class SunshineChannelManager(telepathy.server.ChannelManager):
__text_channel_id = 1
__media_channel_id = 1
- def __init__(self, connection):
+ def __init__(self, connection, protocol):
telepathy.server.ChannelManager.__init__(self, connection)
+ self.set_requestable_channel_classes(protocol.requestable_channels)
+
+ self.implement_channel_classes(telepathy.CHANNEL_TYPE_TEXT, self._get_text_channel)
+ self.implement_channel_classes(telepathy.CHANNEL_TYPE_CONTACT_LIST, self._get_list_channel)
+ #self.implement_channel_classes(telepathy.CHANNEL_TYPE_STREAMED_MEDIA, self._get_media_channel)
+ #self.implement_channel_classes(telepathy.CHANNEL_TYPE_FILE_TRANSFER, self._get_ft_channel)
- classes = [
- ({telepathy.CHANNEL_INTERFACE + '.ChannelType': telepathy.CHANNEL_TYPE_TEXT,
- telepathy.CHANNEL_INTERFACE + '.TargetHandleType': dbus.UInt32(telepathy.HANDLE_TYPE_CONTACT)},
- [telepathy.CHANNEL_INTERFACE + '.TargetHandle',
- telepathy.CHANNEL_INTERFACE + '.TargetID']),
-
- ({telepathy.CHANNEL_INTERFACE + '.ChannelType': telepathy.CHANNEL_TYPE_TEXT,
- telepathy.CHANNEL_INTERFACE + '.TargetHandleType': dbus.UInt32(telepathy.HANDLE_TYPE_ROOM)},
- [telepathy.CHANNEL_INTERFACE + '.TargetHandle',
- telepathy.CHANNEL_INTERFACE + '.TargetID']),
- ]
- self.implement_channel_classes(telepathy.CHANNEL_TYPE_TEXT, self._get_text_channel, classes)
-
- classes = [
- ({telepathy.CHANNEL_INTERFACE + '.ChannelType': telepathy.CHANNEL_TYPE_CONTACT_LIST,
- telepathy.CHANNEL_INTERFACE + '.TargetHandleType': dbus.UInt32(telepathy.HANDLE_TYPE_GROUP)},
- [telepathy.CHANNEL_INTERFACE + '.TargetHandle',
- telepathy.CHANNEL_INTERFACE + '.TargetID']),
-
- ({telepathy.CHANNEL_INTERFACE + '.ChannelType': telepathy.CHANNEL_TYPE_CONTACT_LIST,
- telepathy.CHANNEL_INTERFACE + '.TargetHandleType': dbus.UInt32(telepathy.HANDLE_TYPE_LIST)},
- [telepathy.CHANNEL_INTERFACE + '.TargetHandle',
- telepathy.CHANNEL_INTERFACE + '.TargetID'])
- ]
- self.implement_channel_classes(telepathy.CHANNEL_TYPE_CONTACT_LIST, self._get_list_channel, classes)
-
-# classes = [
-# ({telepathy.CHANNEL_INTERFACE + '.ChannelType': telepathy.CHANNEL_TYPE_STREAMED_MEDIA,
-# telepathy.CHANNEL_INTERFACE + '.TargetHandleType': dbus.UInt32(telepathy.HANDLE_TYPE_CONTACT)},
-# [telepathy.CHANNEL_INTERFACE + '.TargetHandle',
-# telepathy.CHANNEL_INTERFACE + '.TargetID',
-# telepathy.CHANNEL_TYPE_STREAMED_MEDIA + '.InitialAudio',
-# telepathy.CHANNEL_TYPE_STREAMED_MEDIA + '.InitialVideo'])
-# ]
-# self.implement_channel_classes(telepathy.CHANNEL_TYPE_STREAMED_MEDIA, self._get_media_channel, classes)
-#
-# fixed = {telepathy.CHANNEL_INTERFACE + '.ChannelType': telepathy.CHANNEL_TYPE_TEXT,
-# telepathy.CHANNEL_INTERFACE + '.TargetHandleType': dbus.UInt32(telepathy.HANDLE_TYPE_CONTACT)}
-# self._implement_channel_class(telepathy.CHANNEL_TYPE_TEXT,
-# self._get_text_channel, fixed, [])
-#
-# fixed = {telepathy.CHANNEL_INTERFACE + '.ChannelType': telepathy.CHANNEL_TYPE_TEXT,
-# telepathy.CHANNEL_INTERFACE + '.TargetHandleType': dbus.UInt32(telepathy.HANDLE_TYPE_ROOM)}
-# self._implement_channel_class(telepathy.CHANNEL_TYPE_TEXT,
-# self._get_text_channel, fixed, [])
-#
-# fixed = {telepathy.CHANNEL_INTERFACE + '.ChannelType': telepathy.CHANNEL_TYPE_CONTACT_LIST}
-# self._implement_channel_class(telepathy.CHANNEL_TYPE_CONTACT_LIST,
-# self._get_list_channel, fixed, [])
-
-# fixed = {telepathy.CHANNEL_INTERFACE + '.ChannelType': telepathy.CHANNEL_TYPE_STREAMED_MEDIA,
-# telepathy.CHANNEL_INTERFACE + '.TargetHandleType': dbus.UInt32(telepathy.HANDLE_TYPE_CONTACT)}
-# self._implement_channel_class(telepathy.CHANNEL_TYPE_STREAMED_MEDIA,
-# self._get_media_channel, fixed, [telepathy.CHANNEL_INTERFACE + '.TargetHandle'])
def _get_list_channel(self, props):
_, surpress_handler, handle = self._get_type_requested_handle(props)
@@ -150,18 +102,6 @@ class SunshineChannelManager(telepathy.server.ChannelManager):
channel = SunshineContactListChannelFactory(self._conn,
self, handle, props)
return channel
-
-# def _get_list_channel(self, props):
-# _, surpress_handler, handle = self._get_type_requested_handle(props)
-#
-# if handle.get_type() == telepathy.HANDLE_TYPE_GROUP:
-# channel = SunshineGroupChannel(self._conn, self, props)
-# logger.debug('New group channel')
-# else:
-# channel = SunshineContactListChannelFactory(self._conn,
-# self, handle, props)
-# logger.debug('New contact list channel: %s' % (handle.name))
-# return channel
def _get_text_channel(self, props, conversation=None):
_, surpress_handler, handle = self._get_type_requested_handle(props)