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:
parent
6f5b6f2612
commit
d55ba9269e
2 changed files with 9 additions and 3 deletions
|
@ -138,13 +138,15 @@ class ConnectionJingle(object):
|
||||||
return jingle.sid
|
return jingle.sid
|
||||||
|
|
||||||
def start_file_transfer(self, jid, file_props):
|
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')
|
jingle = self.get_jingle_session(jid, media='file')
|
||||||
if jingle:
|
if jingle:
|
||||||
|
file_props['sid'] = jingle.sid
|
||||||
jingle.add_content('file', JingleFileTransfer(jingle, file_props))
|
jingle.add_content('file', JingleFileTransfer(jingle, file_props))
|
||||||
else:
|
else:
|
||||||
jingle = JingleSession(self, weinitiate=True, jid=jid)
|
jingle = JingleSession(self, weinitiate=True, jid=jid)
|
||||||
self.__sessions[jingle.sid] = jingle
|
self.__sessions[jingle.sid] = jingle
|
||||||
|
file_props['sid'] = jingle.sid
|
||||||
jingle.add_content('file', JingleFileTransfer(jingle, file_props=file_props))
|
jingle.add_content('file', JingleFileTransfer(jingle, file_props=file_props))
|
||||||
jingle.start_session()
|
jingle.start_session()
|
||||||
return jingle.sid
|
return jingle.sid
|
||||||
|
|
|
@ -302,13 +302,17 @@ class FileTransfersWindow:
|
||||||
file_path, file_name, file_desc)
|
file_path, file_name, file_desc)
|
||||||
if file_props is None:
|
if file_props is None:
|
||||||
return False
|
return False
|
||||||
self.add_transfer(account, contact, file_props)
|
|
||||||
if contact.supports(NS_JINGLE_FILE_TRANSFER):
|
if contact.supports(NS_JINGLE_FILE_TRANSFER):
|
||||||
log.info("contact %s supports jingle file transfer"%(contact.get_full_jid()))
|
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:
|
else:
|
||||||
log.info("contact does not support jingle file transfer")
|
log.info("contact does not support jingle file transfer")
|
||||||
gajim.connections[account].send_file_request(file_props)
|
gajim.connections[account].send_file_request(file_props)
|
||||||
|
self.add_transfer(account, contact, file_props)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _start_receive(self, file_path, account, contact, file_props):
|
def _start_receive(self, file_path, account, contact, file_props):
|
||||||
|
|
Loading…
Add table
Reference in a new issue