fix handling file transfer cancel properly
This commit is contained in:
parent
c5ebac3f77
commit
48524a60c0
3 changed files with 9 additions and 4 deletions
|
@ -149,6 +149,8 @@ class ConnectionJingle(object):
|
||||||
return
|
return
|
||||||
use_security = contact.supports(xmpp.NS_JINGLE_XTLS)
|
use_security = contact.supports(xmpp.NS_JINGLE_XTLS)
|
||||||
jingle = JingleSession(self, weinitiate=True, jid=jid)
|
jingle = JingleSession(self, weinitiate=True, jid=jid)
|
||||||
|
# this is a file transfer
|
||||||
|
jingle.session_type_FT = True
|
||||||
self._sessions[jingle.sid] = jingle
|
self._sessions[jingle.sid] = jingle
|
||||||
file_props['sid'] = jingle.sid
|
file_props['sid'] = jingle.sid
|
||||||
if contact.supports(xmpp.NS_JINGLE_BYTESTREAM):
|
if contact.supports(xmpp.NS_JINGLE_BYTESTREAM):
|
||||||
|
|
|
@ -102,6 +102,8 @@ class JingleSession(object):
|
||||||
# file. Could be 'md5', 'sha-1', etc...
|
# file. Could be 'md5', 'sha-1', etc...
|
||||||
self.hash_algo = None
|
self.hash_algo = None
|
||||||
self.file_hash = 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
|
# callbacks to call on proper contents
|
||||||
# use .prepend() to add new callbacks, especially when you're going
|
# use .prepend() to add new callbacks, especially when you're going
|
||||||
# to send error instead of ack
|
# to send error instead of ack
|
||||||
|
@ -585,6 +587,8 @@ class JingleSession(object):
|
||||||
else:
|
else:
|
||||||
# TODO
|
# TODO
|
||||||
text = reason
|
text = reason
|
||||||
|
|
||||||
|
if reason == 'cancel' and self.session_type_FT:
|
||||||
gajim.nec.push_incoming_event(JingleTransferCancelledEvent(None,
|
gajim.nec.push_incoming_event(JingleTransferCancelledEvent(None,
|
||||||
conn=self.connection, jingle_session=self, media=None,
|
conn=self.connection, jingle_session=self, media=None,
|
||||||
reason=text))
|
reason=text))
|
||||||
|
|
|
@ -1166,7 +1166,6 @@ class Interface:
|
||||||
|
|
||||||
ft.show_stopped(obj.jid, file_props, 'Peer cancelled ' +
|
ft.show_stopped(obj.jid, file_props, 'Peer cancelled ' +
|
||||||
'the transfer')
|
'the transfer')
|
||||||
obj.conn.delete_jingle_session(obj.sid)
|
|
||||||
|
|
||||||
def handle_event_jingle_incoming(self, obj):
|
def handle_event_jingle_incoming(self, obj):
|
||||||
# ('JINGLE_INCOMING', account, peer jid, sid, tuple-of-contents==(type,
|
# ('JINGLE_INCOMING', account, peer jid, sid, tuple-of-contents==(type,
|
||||||
|
|
Loading…
Add table
Reference in a new issue