Jingle: Check first if we have a content

Fixes #9094
This commit is contained in:
Philipp Hörist 2018-04-29 23:30:08 +02:00
parent bf8dcb5a3e
commit b8554e3e22
1 changed files with 11 additions and 8 deletions

View File

@ -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,