import telepathy
import channel
+import util.misc as util_misc
_moduleLogger = logging.getLogger("channel_manager")
for channel_type in self._requestable_channel_classes:
for chan in self._channels[channel_type].values():
try:
- _moduleLogger.info("Closing %s %s" % (channel_type, chan._object_path))
+ _moduleLogger.debug("Closing %s %s" % (channel_type, chan._object_path))
chan.Close()
except Exception:
_moduleLogger.exception("Shutting down %r" % (chan, ))
chan = self._requestable_channel_classes[type](props, **args)
if hasattr(self._conn, "add_channels"):
- # Newer python-telepathy
+ # HACK Newer python-telepathy
self._conn.add_channels([chan], signal=signal)
elif hasattr(self._conn, "add_channel"):
- # Older python-telepathy
+ # HACK Older python-telepathy
self._conn.add_channel(chan, handle, suppress_handler)
else:
raise RuntimeError("Uhh, what just happened with the connection")
)
def _get_list_channel(self, props):
- _, surpress_handler, handle = self._get_type_requested_handle(props)
+ _, surpress_handler, h = self._get_type_requested_handle(props)
_moduleLogger.debug('New contact list channel')
- chan = channel.contact_list.create_contact_list_channel(self._conn, self, props, handle)
+ chan = channel.contact_list.create_contact_list_channel(self._conn, self, props, h)
return chan
def _get_text_channel(self, props):
- _, surpress_handler, handle = self._get_type_requested_handle(props)
+ _, surpress_handler, h = self._get_type_requested_handle(props)
- _moduleLogger.debug('New text channel')
- chan = channel.text.TextChannel(self._conn, self, props, handle)
+ accountNumber = util_misc.strip_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)
+ else:
+ _moduleLogger.debug('New text channel')
+ chan = channel.text.TextChannel(self._conn, self, props, h)
return chan
def _get_media_channel(self, props):
- _, surpress_handler, handle = self._get_type_requested_handle(props)
+ _, surpress_handler, h = self._get_type_requested_handle(props)
_moduleLogger.debug('New media channel')
- chan = channel.call.CallChannel(self._conn, self, props, handle)
+ chan = channel.call.CallChannel(self._conn, self, props, h)
return chan