Commit 3d7f3467 authored by Saul Ibarra's avatar Saul Ibarra

Adapt to changes in streams API

parent 13ea1fc0
...@@ -700,6 +700,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin): ...@@ -700,6 +700,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
notification_center.add_observer(self, name='ChatStreamDidDeliverMessage') notification_center.add_observer(self, name='ChatStreamDidDeliverMessage')
notification_center.add_observer(self, name='ChatStreamDidNotDeliverMessage') notification_center.add_observer(self, name='ChatStreamDidNotDeliverMessage')
notification_center.add_observer(self, name='MediaStreamDidInitialize') notification_center.add_observer(self, name='MediaStreamDidInitialize')
notification_center.add_observer(self, name='MediaStreamDidNotInitialize')
notification_center.add_observer(self, name='MediaStreamDidStart') notification_center.add_observer(self, name='MediaStreamDidStart')
notification_center.add_observer(self, name='MediaStreamDidFail') notification_center.add_observer(self, name='MediaStreamDidFail')
notification_center.add_observer(self, name='MediaStreamDidEnd') notification_center.add_observer(self, name='MediaStreamDidEnd')
...@@ -1292,6 +1293,14 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin): ...@@ -1292,6 +1293,14 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
notification.sender._blink_fail_reason = None notification.sender._blink_fail_reason = None
#session.chat_widget.add_message(ChatStatus('Connecting...')) # disable it until we can replace it in the DOM -Dan #session.chat_widget.add_message(ChatStatus('Connecting...')) # disable it until we can replace it in the DOM -Dan
def _NH_MediaStreamDidNotInitialize(self, notification):
if notification.sender.type != 'chat':
return
session = notification.sender.blink_session.items.chat
if session is None:
return
session.chat_widget.add_message(ChatStatus('Failed to initialize chat: %s' % notification.data.reason))
def _NH_MediaStreamDidStart(self, notification): def _NH_MediaStreamDidStart(self, notification):
if notification.sender.type != 'chat': if notification.sender.type != 'chat':
return return
......
...@@ -3711,8 +3711,9 @@ class FileTransfer(object): ...@@ -3711,8 +3711,9 @@ class FileTransfer(object):
self._terminate() self._terminate()
def _NH_MediaStreamDidFail(self, notification): def _NH_MediaStreamDidFail(self, notification):
if self.state == 'connected': # In principle the Session will end itself because this is the only stream,
self.end() # but lets be explicit about it -Saul
self.end()
def _NH_MediaStreamDidEnd(self, notification): def _NH_MediaStreamDidEnd(self, notification):
if self.direction == 'incoming': if self.direction == 'incoming':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment