summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis-Francis Ratté-Boulianne <louis-francis.ratte-boulianne@collabora.co.uk>2010-08-12 18:27:07 (GMT)
committerLouis-Francis Ratté-Boulianne <louis-francis.ratte-boulianne@collabora.co.uk>2010-08-13 04:30:24 (GMT)
commitdb1ae2589e3fa1418d45f6b20f798cbbc3531e36 (patch)
tree9fdcc0422b421f325d91125c83087d76b07428a1
parent6add32222bd7e2534c524e3711710e91afd3295c (diff)
downloadtelepathy-butterfly-db1ae2589e3fa1418d45f6b20f798cbbc3531e36.tar.gz
telepathy-butterfly-db1ae2589e3fa1418d45f6b20f798cbbc3531e36.tar.xz
media: re-enable streamed media channels and capabilities
-rw-r--r--butterfly/capabilities.py41
-rw-r--r--butterfly/channel_manager.py18
-rw-r--r--butterfly/connection.py32
3 files changed, 43 insertions, 48 deletions
diff --git a/butterfly/capabilities.py b/butterfly/capabilities.py
index 1c876e5..0a0f9de 100644
--- a/butterfly/capabilities.py
+++ b/butterfly/capabilities.py
@@ -89,14 +89,14 @@ class ButterflyCapabilities(
self._update_capabilities_calls = []
def AdvertiseCapabilities(self, add, remove):
- #for caps, specs in add:
- #if caps == telepathy.CHANNEL_TYPE_STREAMED_MEDIA:
- #if specs & telepathy.CHANNEL_MEDIA_CAPABILITY_VIDEO:
- #self._self_handle.profile.client_id.has_webcam = True
- #self._self_handle.profile.client_id.supports_rtc_video = True
- #for caps in remove:
- #if caps == telepathy.CHANNEL_TYPE_STREAMED_MEDIA:
- #self._self_handle.profile.client_id.has_webcam = False
+ for caps, specs in add:
+ if caps == telepathy.CHANNEL_TYPE_STREAMED_MEDIA:
+ if specs & telepathy.CHANNEL_MEDIA_CAPABILITY_VIDEO:
+ self._self_handle.profile.client_id.has_webcam = True
+ self._self_handle.profile.client_id.supports_rtc_video = True
+ for caps in remove:
+ if caps == telepathy.CHANNEL_TYPE_STREAMED_MEDIA:
+ self._self_handle.profile.client_id.has_webcam = False
return telepathy.server.ConnectionInterfaceCapabilities.\
AdvertiseCapabilities(self, add, remove)
@@ -123,9 +123,6 @@ class ButterflyCapabilities(
self._update_capabilities_calls.append(caps)
return
- # butterfly voip is disabled, so
- return
-
# We only care about voip.
for client, classes, capabilities in caps:
video = False
@@ -257,17 +254,17 @@ class ButterflyCapabilities(
rcc = None
caps = contact.client_capabilities
- #if caps.supports_sip_invite:
- #gen_caps |= telepathy.CONNECTION_CAPABILITY_FLAG_CREATE
- #gen_caps |= telepathy.CONNECTION_CAPABILITY_FLAG_INVITE
- #spec_caps |= telepathy.CHANNEL_MEDIA_CAPABILITY_AUDIO
- #spec_caps |= telepathy.CHANNEL_MEDIA_CAPABILITY_NAT_TRAVERSAL_STUN
-
- #if caps.has_webcam:
- #spec_caps |= telepathy.CHANNEL_MEDIA_CAPABILITY_VIDEO
- #rcc = self.av_chat_class
- #else:
- #rcc = self.audio_chat_class
+ if caps.supports_sip_invite:
+ gen_caps |= telepathy.CONNECTION_CAPABILITY_FLAG_CREATE
+ gen_caps |= telepathy.CONNECTION_CAPABILITY_FLAG_INVITE
+ spec_caps |= telepathy.CHANNEL_MEDIA_CAPABILITY_AUDIO
+ spec_caps |= telepathy.CHANNEL_MEDIA_CAPABILITY_NAT_TRAVERSAL_STUN
+
+ if caps.has_webcam:
+ spec_caps |= telepathy.CHANNEL_MEDIA_CAPABILITY_VIDEO
+ rcc = self.av_chat_class
+ else:
+ rcc = self.audio_chat_class
return gen_caps, spec_caps, rcc
diff --git a/butterfly/channel_manager.py b/butterfly/channel_manager.py
index 396a1fb..44f4f85 100644
--- a/butterfly/channel_manager.py
+++ b/butterfly/channel_manager.py
@@ -116,15 +116,15 @@ class ButterflyChannelManager(telepathy.server.ChannelManager):
]
self.implement_channel_classes(telepathy.CHANNEL_TYPE_CONTACT_LIST, self._get_list_channel, classes)
-# classes = [
-# ({telepathy.CHANNEL_INTERFACE + '.ChannelType': telepathy.CHANNEL_TYPE_STREAMED_MEDIA,
-# telepathy.CHANNEL_INTERFACE + '.TargetHandleType': dbus.UInt32(telepathy.HANDLE_TYPE_CONTACT)},
-# [telepathy.CHANNEL_INTERFACE + '.TargetHandle',
-# telepathy.CHANNEL_INTERFACE + '.TargetID',
-# telepathy.CHANNEL_TYPE_STREAMED_MEDIA + '.InitialAudio',
-# telepathy.CHANNEL_TYPE_STREAMED_MEDIA + '.InitialVideo'])
-# ]
-# self.implement_channel_classes(telepathy.CHANNEL_TYPE_STREAMED_MEDIA, self._get_media_channel, classes)
+ classes = [
+ ({telepathy.CHANNEL_INTERFACE + '.ChannelType': telepathy.CHANNEL_TYPE_STREAMED_MEDIA,
+ telepathy.CHANNEL_INTERFACE + '.TargetHandleType': dbus.UInt32(telepathy.HANDLE_TYPE_CONTACT)},
+ [telepathy.CHANNEL_INTERFACE + '.TargetHandle',
+ telepathy.CHANNEL_INTERFACE + '.TargetID',
+ telepathy.CHANNEL_TYPE_STREAMED_MEDIA + '.InitialAudio',
+ telepathy.CHANNEL_TYPE_STREAMED_MEDIA + '.InitialVideo'])
+ ]
+ self.implement_channel_classes(telepathy.CHANNEL_TYPE_STREAMED_MEDIA, self._get_media_channel, classes)
classes = [
({telepathy.CHANNEL_INTERFACE + '.ChannelType': telepathy.CHANNEL_TYPE_FILE_TRANSFER,
diff --git a/butterfly/connection.py b/butterfly/connection.py
index 044790f..3f0d18f 100644
--- a/butterfly/connection.py
+++ b/butterfly/connection.py
@@ -420,29 +420,27 @@ class ButterflyConnection(telepathy.server.Connection,
# papyon.event.InviteEventInterface
def on_invite_conference(self, call):
- logger.debug("Call invite, ignoring it")
- #logger.debug("Call invite")
- #handle = ButterflyHandleFactory(self, 'contact', call.peer.account,
- #call.peer.network_id)
+ logger.debug("Call invite")
+ handle = ButterflyHandleFactory(self, 'contact', call.peer.account,
+ call.peer.network_id)
- #props = self._generate_props(telepathy.CHANNEL_TYPE_STREAMED_MEDIA,
- #handle, False, initiator_handle=handle)
+ props = self._generate_props(telepathy.CHANNEL_TYPE_STREAMED_MEDIA,
+ handle, False, initiator_handle=handle)
- #channel = self._channel_manager.channel_for_props(props,
- #signal=True, call=call)
+ channel = self._channel_manager.channel_for_props(props,
+ signal=True, call=call)
# papyon.event.InviteEventInterface
def on_invite_webcam(self, session, producer):
direction = (producer and "send") or "receive"
- logger.debug("Invitation to %s webcam, ignoring it" % direction)
- #logger.debug("Invitation to %s webcam" % direction)
-
- #handle = ButterflyHandleFactory(self, 'contact', session.peer.account,
- #session.peer.network_id)
- #props = self._generate_props(telepathy.CHANNEL_TYPE_STREAMED_MEDIA,
- #handle, False, initiator_handle=handle)
- #channel = self._channel_manager.channel_for_props(props, signal=True,
- #call=session)
+ logger.debug("Invitation to %s webcam" % direction)
+
+ handle = ButterflyHandleFactory(self, 'contact', session.peer.account,
+ session.peer.network_id)
+ props = self._generate_props(telepathy.CHANNEL_TYPE_STREAMED_MEDIA,
+ handle, False, initiator_handle=handle)
+ channel = self._channel_manager.channel_for_props(props, signal=True,
+ call=session)
# papyon.event.OfflineMessagesEventInterface
def on_oim_messages_received(self, messages):