6 import util.misc as misc_utils
9 _moduleLogger = logging.getLogger(__name__)
12 class CapabilitiesMixin(tp.ConnectionInterfaceCapabilities):
15 telepathy.CHANNEL_TYPE_TEXT: (
16 telepathy.CONNECTION_CAPABILITY_FLAG_CREATE,
19 telepathy.CHANNEL_TYPE_STREAMED_MEDIA: (
20 telepathy.CONNECTION_CAPABILITY_FLAG_CREATE |
21 telepathy.CONNECTION_CAPABILITY_FLAG_INVITE,
22 telepathy.CHANNEL_MEDIA_CAPABILITY_AUDIO,
27 tp.ConnectionInterfaceCapabilities.__init__(self)
29 def get_handle_by_id(self, handleType, handleId):
33 raise NotImplementedError("Abstract function called")
35 @misc_utils.log_exception(_moduleLogger)
36 def GetCapabilities(self, handleIds):
38 for handleId in handleIds:
39 if handleId != 0 and (telepathy.HANDLE_TYPE_CONTACT, handleId) not in self._handles:
40 raise telepathy.errors.InvalidHandle
42 h = self.get_handle_by_id(telepathy.HANDLE_TYPE_CONTACT, handleId)
43 for type, (gen, spec) in self._CAPABILITIES.iteritems():
44 ret.append([handleId, type, gen, spec])