Skip to content
Snippets Groups Projects
Commit 48524a60 authored by zimio's avatar zimio
Browse files

fix handling file transfer cancel properly

parent c5ebac3f
No related branches found
No related tags found
No related merge requests found
......@@ -149,6 +149,8 @@ class ConnectionJingle(object):
return
use_security = contact.supports(xmpp.NS_JINGLE_XTLS)
jingle = JingleSession(self, weinitiate=True, jid=jid)
# this is a file transfer
jingle.session_type_FT = True
self._sessions[jingle.sid] = jingle
file_props['sid'] = jingle.sid
if contact.supports(xmpp.NS_JINGLE_BYTESTREAM):
......
......@@ -102,6 +102,8 @@ class JingleSession(object):
# file. Could be 'md5', 'sha-1', etc...
self.hash_algo = None
self.file_hash = None
# Tells whether this session is a file transfer or not
self.session_type_FT = False
# callbacks to call on proper contents
# use .prepend() to add new callbacks, especially when you're going
# to send error instead of ack
......@@ -585,9 +587,11 @@ class JingleSession(object):
else:
# TODO
text = reason
gajim.nec.push_incoming_event(JingleTransferCancelledEvent(None,
conn=self.connection, jingle_session=self, media=None,
reason=text))
if reason == 'cancel' and self.session_type_FT:
gajim.nec.push_incoming_event(JingleTransferCancelledEvent(None,
conn=self.connection, jingle_session=self, media=None,
reason=text))
def __broadcast_all(self, stanza, jingle, error, action):
"""
......
......@@ -1166,7 +1166,6 @@ class Interface:
ft.show_stopped(obj.jid, file_props, 'Peer cancelled ' +
'the transfer')
obj.conn.delete_jingle_session(obj.sid)
def handle_event_jingle_incoming(self, obj):
# ('JINGLE_INCOMING', account, peer jid, sid, tuple-of-contents==(type,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment