From d55ba9269edfe69b902ce9474e6ebbb7fb9c1f05 Mon Sep 17 00:00:00 2001 From: Zhenchao Li Date: Thu, 8 Jul 2010 16:05:19 +0800 Subject: [PATCH] fix bug: assign jingle session id as sid in file_props, so that file transfer window gets updated correctly for the sender. --- src/common/jingle.py | 4 +++- src/filetransfers_window.py | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/common/jingle.py b/src/common/jingle.py index b63273a7c..004760349 100644 --- a/src/common/jingle.py +++ b/src/common/jingle.py @@ -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 diff --git a/src/filetransfers_window.py b/src/filetransfers_window.py index 1036ebe97..4fd550418 100644 --- a/src/filetransfers_window.py +++ b/src/filetransfers_window.py @@ -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):