From b8554e3e223c8e48c900521faa30a3d4836c767b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Sun, 29 Apr 2018 23:30:08 +0200 Subject: [PATCH] Jingle: Check first if we have a content Fixes #9094 --- gajim/common/jingle_session.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/gajim/common/jingle_session.py b/gajim/common/jingle_session.py index 85d8dfce9..c306a5967 100644 --- a/gajim/common/jingle_session.py +++ b/gajim/common/jingle_session.py @@ -523,6 +523,16 @@ class JingleSession: # error. # Lets check what kind of jingle session does the peer want contents, contents_rejected, reason_txt = self.__parse_contents(jingle) + + # If there's no content we understand... + if not contents: + # TODO: http://xmpp.org/extensions/xep-0166.html#session-terminate + reason = nbxmpp.Node('reason') + reason.setTag(reason_txt) + self.__ack(stanza, jingle, error, action) + self._session_terminate(reason) + raise nbxmpp.NodeProcessed + # If we are not receivin a file # Check if there's already a session with this user: if contents[0].media != 'file': @@ -553,14 +563,7 @@ class JingleSession: 'it is not allowed to request', pjid) self.decline_session() raise nbxmpp.NodeProcessed - # If there's no content we understand... - if not contents: - # TODO: http://xmpp.org/extensions/xep-0166.html#session-terminate - reason = nbxmpp.Node('reason') - reason.setTag(reason_txt) - self.__ack(stanza, jingle, error, action) - self._session_terminate(reason) - raise nbxmpp.NodeProcessed + self.state = JingleStates.PENDING # Send event about starting a session app.nec.push_incoming_event(JingleRequestReceivedEvent(None,