accept session as soon as one content is accepted

This commit is contained in:
Yann Leboulanger 2010-08-26 13:18:16 +02:00
parent 99981e57b8
commit ac2b2ac3a1
2 changed files with 7 additions and 1 deletions

View File

@ -223,6 +223,8 @@ class JingleFileTransfer(JingleContent):
# send error message, notify the user
elif not self.weinitiate and self.state == STATE_NOT_STARTED:
# session-accept iq-result
if not self.sent:
return
self.state = STATE_ACCEPTED
if not gajim.socks5queue.get_file_props(
self.session.connection.name, self.file_props['sid']):

View File

@ -247,6 +247,9 @@ class JingleSession(object):
"""
Return True when all codecs and candidates are ready (for all contents)
"""
for c in self.contents.itervalues():
if c.is_ready():
return True
return (all((content.is_ready() for content in self.contents.itervalues()))
and self.accepted)
@ -623,7 +626,8 @@ class JingleSession(object):
# TODO: integrate with __appendContent?
# TODO: parameters 'name', 'content'?
for content in self.contents.values():
self.__append_content(jingle, content)
if content.is_ready():
self.__append_content(jingle, content)
def __session_initiate(self):
assert self.state == JingleStates.ended