import weakref
+import itertools
import logging
import telepathy
self._callChannels = weakref.WeakValueDictionary()
def close(self):
- for chan in self._listChannels.values():
- chan.Close()
- for chan in self._textChannels.values():
- chan.Close()
- for chan in self._callChannels.values():
- chan.Close()
+ for chan in itertools.chain(
+ self._listChannels.values(), self._textChannels.values(), self._callChannels.values()
+ ):
+ try:
+ chan.close()
+ except Exception:
+ _moduleLogger.exception("Shutting down %r" % (chan, ))
def channel_for_list(self, handle, suppress_handler=False):
try:
try:
chan = self._callChannels[handle]
except KeyError, e:
- if handle.get_type() != telepathy.HANDLE_TYPE_NONE:
- raise telepathy.errors.NotImplemented("Using deprecated means to create a call")
+ if handle.get_type() != telepathy.HANDLE_TYPE_CONTACT:
+ _moduleLogger.warning("Using deprecated means to create a call")
+ raise telepathy.errors.NotImplemented("Not implementing depcrecated means")
_moduleLogger.debug("Requesting new call channel")
chan = channel.call.CallChannel(self._connRef(), handle)