27
27
from butterfly.util.decorator import async
28
28
from butterfly.handle import ButterflyHandleFactory
29
29
from butterfly.media import ButterflySessionHandler
30
from butterfly.channel import ButterflyChannel
31
32
from telepathy.interfaces import CHANNEL_INTERFACE, CHANNEL_INTERFACE_GROUP,\
32
33
CHANNEL_TYPE_STREAMED_MEDIA
40
41
class ButterflyMediaChannel(
41
43
telepathy.server.ChannelTypeStreamedMedia,
42
44
telepathy.server.ChannelInterfaceCallState,
43
45
telepathy.server.ChannelInterfaceGroup,
55
57
papyon.event.CallEventInterface.__init__(self, call)
56
58
papyon.event.ContactEventInterface.__init__(self, conn.msn_client)
57
59
papyon.event.MediaSessionEventInterface.__init__(self, call.media_session)
60
ButterflyChannel.__init__(self, conn, props)
60
63
self._handle = handle
62
self._implement_property_get(CHANNEL_INTERFACE, {
63
'InitiatorHandle': lambda: dbus.UInt32(self._initiator.id),
64
'InitiatorID': lambda: self._initiator.name
67
65
self._implement_property_get(CHANNEL_INTERFACE_GROUP,
68
66
{'LocalPendingMembers': lambda: self.GetLocalPendingMembersWithInfo() })
70
self._add_immutables({
71
'InitiatorHandle': CHANNEL_INTERFACE,
72
'InitiatorID': CHANNEL_INTERFACE,
75
if CHANNEL_INTERFACE + '.InitiatorHandle' in props:
76
self._initiator = conn.handle(telepathy.HANDLE_TYPE_CONTACT,
77
props[CHANNEL_INTERFACE + '.InitiatorHandle'])
78
elif CHANNEL_INTERFACE + '.InitiatorID' in props:
79
self._initiator = ButterflyHandleFactory(conn, 'contact',
80
id=props[CHANNEL_INTERFACE + '.InitiatorHandle'])
82
logger.warning('InitiatorID or InitiatorHandle not set on new channel')
83
self._initiator = None
85
68
self._session_handler = ButterflySessionHandler(self._conn, self, call.media_session)
87
70
flags = (telepathy.CHANNEL_GROUP_FLAG_CAN_REMOVE |