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.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/sunshine/channel_manager.py b/sunshine/channel_manager.py
index 8cff4b9..cd02197 100644
--- a/sunshine/channel_manager.py
+++ b/sunshine/channel_manager.py
@@ -25,7 +25,7 @@ import telepathy
from sunshine.channel.contact_list import SunshineContactListChannelFactory
from sunshine.channel.group import SunshineGroupChannel
-from sunshine.channel.text import SunshineTextChannel
+from sunshine.channel.text import SunshineTextChannel, SunshineRoomTextChannel
#from sunshine.channel.media import SunshineMediaChannel
from sunshine.handle import SunshineHandleFactory
@@ -42,6 +42,11 @@ class SunshineChannelManager(telepathy.server.ChannelManager):
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, [])
@@ -66,13 +71,19 @@ class SunshineChannelManager(telepathy.server.ChannelManager):
def _get_text_channel(self, props, conversation=None):
_, surpress_handler, handle = self._get_type_requested_handle(props)
- if handle.get_type() != telepathy.HANDLE_TYPE_CONTACT:
- raise telepathy.NotImplemented('Only contacts are allowed')
+ if handle.get_type() == telepathy.HANDLE_TYPE_CONTACT:
+ logger.debug('New text channel for contact handle, name: %s, id: %s, type: %s' % (handle.name, handle.id, handle.type))
- logger.debug('New text channel for handle, name: %s, id: %s, type: %s' % (handle.name, handle.id, handle.type))
+ channel = SunshineTextChannel(self._conn, self, conversation, props)
+ return channel
+ elif handle.get_type() == telepathy.HANDLE_TYPE_ROOM:
+ logger.debug('New text channel for room handle, name: %s, id: %s, type: %s' % (handle.name, handle.id, handle.type))
+
+ channel = SunshineRoomTextChannel(self._conn, self, conversation, props)
+ return channel
+ else:
+ raise telepathy.NotImplemented('Unknown handle for text channel.')
- channel = SunshineTextChannel(self._conn, self, conversation, props)
- return channel
# def _get_media_channel(self, props, call=None):
# _, surpress_handler, handle = self._get_type_requested_handle(props)