8 import util.misc as util_misc
11 _moduleLogger = logging.getLogger("channel_manager")
14 class ChannelManager(tp.ChannelManager):
16 def __init__(self, connection):
17 tp.ChannelManager.__init__(self, connection)
20 telepathy.CHANNEL_INTERFACE + '.ChannelType': telepathy.CHANNEL_TYPE_TEXT,
21 telepathy.CHANNEL_INTERFACE + '.TargetHandleType': dbus.UInt32(telepathy.HANDLE_TYPE_CONTACT)
23 self._implement_channel_class(
24 telepathy.CHANNEL_TYPE_TEXT,
25 self._get_text_channel,
31 telepathy.CHANNEL_INTERFACE + '.ChannelType': telepathy.CHANNEL_TYPE_CONTACT_LIST
33 self._implement_channel_class(
34 telepathy.CHANNEL_TYPE_CONTACT_LIST,
35 self._get_list_channel,
41 telepathy.CHANNEL_INTERFACE + '.ChannelType': telepathy.CHANNEL_TYPE_STREAMED_MEDIA,
42 telepathy.CHANNEL_INTERFACE + '.TargetHandleType': dbus.UInt32(telepathy.HANDLE_TYPE_CONTACT)
44 self._implement_channel_class(
45 telepathy.CHANNEL_TYPE_STREAMED_MEDIA,
46 self._get_media_channel,
48 [telepathy.CHANNEL_INTERFACE + '.TargetHandle']
51 def _get_list_channel(self, props):
52 _, surpress_handler, h = self._get_type_requested_handle(props)
54 _moduleLogger.debug('New contact list channel')
55 chan = channel.contact_list.create_contact_list_channel(self._conn, self, props, h)
58 def _get_text_channel(self, props):
59 _, surpress_handler, h = self._get_type_requested_handle(props)
61 accountNumber = util_misc.strip_number(self._conn.session.backend.get_account_number())
62 if h.phoneNumber == accountNumber:
63 _moduleLogger.debug('New Debug channel')
64 chan = channel.debug_prompt.DebugPromptChannel(self._conn, self, props, h)
66 _moduleLogger.debug('New text channel')
67 chan = channel.text.TextChannel(self._conn, self, props, h)
70 def _get_media_channel(self, props):
71 _, surpress_handler, h = self._get_type_requested_handle(props)
73 _moduleLogger.debug('New media channel')
74 chan = channel.call.CallChannel(self._conn, self, props, h)