fix bug: assign jingle session id as sid in file_props, so that file transfer window gets updated correctly for the sender.

This commit is contained in:
Zhenchao Li 2010-07-08 16:05:19 +08:00
parent 6f5b6f2612
commit d55ba9269e
2 changed files with 9 additions and 3 deletions

View File

@ -138,13 +138,15 @@ class ConnectionJingle(object):
return jingle.sid
def start_file_transfer(self, jid, file_props):
logger.info("start file transfer with file: %s", str(file_props))
logger.info("start file transfer with file: %s" % file_props)
jingle = self.get_jingle_session(jid, media='file')
if jingle:
file_props['sid'] = jingle.sid
jingle.add_content('file', JingleFileTransfer(jingle, file_props))
else:
jingle = JingleSession(self, weinitiate=True, jid=jid)
self.__sessions[jingle.sid] = jingle
file_props['sid'] = jingle.sid
jingle.add_content('file', JingleFileTransfer(jingle, file_props=file_props))
jingle.start_session()
return jingle.sid

View File

@ -302,13 +302,17 @@ class FileTransfersWindow:
file_path, file_name, file_desc)
if file_props is None:
return False
self.add_transfer(account, contact, file_props)
if contact.supports(NS_JINGLE_FILE_TRANSFER):
log.info("contact %s supports jingle file transfer"%(contact.get_full_jid()))
gajim.connections[account].start_file_transfer(contact.get_full_jid(), file_props)
# this call has the side effect of setting file_props['sid'] to the jingle sid, but for the sake of clarity
# make it explicit here
sid = gajim.connections[account].start_file_transfer(contact.get_full_jid(), file_props)
file_props['sid'] = sid
self.add_transfer(account, contact, file_props)
else:
log.info("contact does not support jingle file transfer")
gajim.connections[account].send_file_request(file_props)
self.add_transfer(account, contact, file_props)
return True
def _start_receive(self, file_path, account, contact, file_props):