X-Git-Url: http://git.maemo.org/git/?p=theonering;a=blobdiff_plain;f=src%2Fchannel_manager.py;h=592a59c5d48d2e138201dbc099356bdd7ee4b2f8;hp=a696d9013a16a813abdad3adaf568f4620e2c451;hb=7cdc5ab1a3dd83850275056e4c50fcb84a30586e;hpb=a840b976430685dbf23bee4e590d1ee23594728c diff --git a/src/channel_manager.py b/src/channel_manager.py index a696d90..592a59c 100644 --- a/src/channel_manager.py +++ b/src/channel_manager.py @@ -5,10 +5,10 @@ import telepathy import tp import channel -import util.misc as util_misc +import util.misc as misc_utils -_moduleLogger = logging.getLogger("channel_manager") +_moduleLogger = logging.getLogger(__name__) class ChannelManager(tp.ChannelManager): @@ -17,6 +17,16 @@ class ChannelManager(tp.ChannelManager): tp.ChannelManager.__init__(self, connection) 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_TEXT, telepathy.CHANNEL_INTERFACE + '.TargetHandleType': dbus.UInt32(telepathy.HANDLE_TYPE_CONTACT) } @@ -28,11 +38,12 @@ class ChannelManager(tp.ChannelManager): ) fixed = { - telepathy.CHANNEL_INTERFACE + '.ChannelType': telepathy.CHANNEL_TYPE_CONTACT_LIST + telepathy.CHANNEL_INTERFACE + '.ChannelType': telepathy.CHANNEL_TYPE_FILE_TRANSFER, + telepathy.CHANNEL_INTERFACE + '.TargetHandleType': dbus.UInt32(telepathy.HANDLE_TYPE_CONTACT) } self._implement_channel_class( - telepathy.CHANNEL_TYPE_CONTACT_LIST, - self._get_list_channel, + telepathy.CHANNEL_TYPE_FILE_TRANSFER, + self._get_file_transfer_channel, fixed, [] ) @@ -58,7 +69,7 @@ class ChannelManager(tp.ChannelManager): def _get_text_channel(self, props): _, surpress_handler, h = self._get_type_requested_handle(props) - accountNumber = util_misc.strip_number(self._conn.session.backend.get_account_number()) + accountNumber = misc_utils.normalize_number(self._conn.session.backend.get_account_number()) if h.phoneNumber == accountNumber: _moduleLogger.debug('New Debug channel') chan = channel.debug_prompt.DebugPromptChannel(self._conn, self, props, h) @@ -67,6 +78,13 @@ class ChannelManager(tp.ChannelManager): chan = channel.text.TextChannel(self._conn, self, props, h) return chan + def _get_file_transfer_channel(self, props): + _, surpress_handler, h = self._get_type_requested_handle(props) + + _moduleLogger.debug('New file transfer channel') + chan = channel.debug_log.DebugLogChannel(self._conn, self, props, h) + return chan + def _get_media_channel(self, props): _, surpress_handler, h = self._get_type_requested_handle(props)