[Jingle] Fix a minor bug that showed incorrect states when adding a content to a session

This commit is contained in:
Thibaut GIRKA 2010-01-13 18:40:48 +01:00
parent a393b36a3f
commit 600b433296
4 changed files with 12 additions and 4 deletions

View File

@ -46,6 +46,7 @@ class JingleContent(object):
#self.name = None
self.accepted = False
self.sent = False
self.negotiated = False
self.media = None
@ -82,6 +83,11 @@ class JingleContent(object):
def is_ready(self):
return self.accepted and not self.sent
def on_negotiated(self):
if self.accepted:
self.negotiated = True
self.session.content_negotiated(self.media)
def add_remote_candidates(self, candidates):
"""
Add a list of candidates to the list of remote candidates

View File

@ -200,7 +200,7 @@ class JingleRTPContent(JingleContent):
self.transport.remote_candidates = []
# TODO: farsight.DIRECTION_BOTH only if senders='both'
self.p2pstream.set_property('direction', farsight.DIRECTION_BOTH)
self.session.content_negociated(self.media)
self.on_negotiated()
def __on_remote_codecs(self, stanza, content, error, action):
"""

View File

@ -649,7 +649,7 @@ class JingleSession(object):
self.connection.dispatch('JINGLE_DISCONNECTED',
(self.peerjid, self.sid, content.media, 'removed'))
def content_negociated(self, media):
def content_negotiated(self, media):
self.connection.dispatch('JINGLE_CONNECTED', (self.peerjid, self.sid,
media))

View File

@ -4793,9 +4793,11 @@ class VoIPCallReceivedDialog(object):
return
ctrl = gajim.interface.new_chat(contact, self.account, resource)
# Chat control opened, update content's status
if session.get_content('audio'):
audio = session.get_content('audio')
video = session.get_content('video')
if audio and not audio.negotiated:
ctrl.set_audio_state('connecting', self.sid)
if session.get_content('video'):
if video and not video.negotiated:
ctrl.set_video_state('connecting', self.sid)
# Now, accept the content/sessions.
# This should be done after the chat control is running