decline jingleFT correctly
This commit is contained in:
parent
c9fa13e458
commit
c412a6a55f
|
@ -149,6 +149,14 @@ class JingleSession(object):
|
||||||
reason.addChild('decline')
|
reason.addChild('decline')
|
||||||
self._session_terminate(reason)
|
self._session_terminate(reason)
|
||||||
|
|
||||||
|
def cancel_session(self):
|
||||||
|
"""
|
||||||
|
Called when user declines session in UI (when we aren't the initiator)
|
||||||
|
"""
|
||||||
|
reason = xmpp.Node('reason')
|
||||||
|
reason.addChild('cancel')
|
||||||
|
self._session_terminate(reason)
|
||||||
|
|
||||||
def approve_content(self, media, name=None):
|
def approve_content(self, media, name=None):
|
||||||
content = self.get_content(media, name)
|
content = self.get_content(media, name)
|
||||||
if content:
|
if content:
|
||||||
|
@ -730,7 +738,6 @@ class JingleSession(object):
|
||||||
self.__session_info(p)
|
self.__session_info(p)
|
||||||
|
|
||||||
def _session_terminate(self, reason=None):
|
def _session_terminate(self, reason=None):
|
||||||
assert self.state != JingleStates.ended
|
|
||||||
stanza, jingle = self.__make_jingle('session-terminate', reason=reason)
|
stanza, jingle = self.__make_jingle('session-terminate', reason=reason)
|
||||||
self.__broadcast_all(stanza, jingle, None, 'session-terminate-sent')
|
self.__broadcast_all(stanza, jingle, None, 'session-terminate-sent')
|
||||||
if self.connection.connection and self.connection.connected >= 2:
|
if self.connection.connection and self.connection.connected >= 2:
|
||||||
|
|
|
@ -195,6 +195,10 @@ class ConnectionBytestream:
|
||||||
# user response to ConfirmationDialog may come after we've disconneted
|
# user response to ConfirmationDialog may come after we've disconneted
|
||||||
if not self.connection or self.connected < 2:
|
if not self.connection or self.connected < 2:
|
||||||
return
|
return
|
||||||
|
if file_props['session-type'] == 'jingle':
|
||||||
|
jingle = self._sessions[file_props['session-sid']]
|
||||||
|
jingle.cancel_session()
|
||||||
|
return
|
||||||
iq = xmpp.Iq(to=unicode(file_props['sender']), typ='error')
|
iq = xmpp.Iq(to=unicode(file_props['sender']), typ='error')
|
||||||
iq.setAttr('id', file_props['request-id'])
|
iq.setAttr('id', file_props['request-id'])
|
||||||
if code == '400' and typ in ('stream', 'profile'):
|
if code == '400' and typ in ('stream', 'profile'):
|
||||||
|
|
Loading…
Reference in New Issue