diff src/plugins/plugin_xep_0261.py @ 1571:c668081eba1c

plugins XEP-0234, XEP-0260, XEP-0261: jingle session termination is managed by application (XEP-0234) instead of transport
author Goffi <goffi@goffi.org>
date Sun, 08 Nov 2015 14:48:04 +0100
parents 268fda4236ca
children 25906c0dbc63
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0261.py	Sun Nov 08 14:44:33 2015 +0100
+++ b/src/plugins/plugin_xep_0261.py	Sun Nov 08 14:48:04 2015 +0100
@@ -77,24 +77,17 @@
             peer_jid = session['peer_jid']
             sid = transport_data['sid']
             file_obj = content_data['file_obj']
-            args = [session, content_name, profile]
             if action == self._j.A_START:
                 block_size = transport_data['block_size']
                 d = self._ibb.startStream(file_obj, peer_jid, sid, block_size, profile)
-                d.addErrback(self._streamEb, *args)
+                d.chainDeferred(content_data['finished_d'])
             else:
                 d = self._ibb.createSession(file_obj, peer_jid, sid, profile)
-                d.addCallbacks(self._streamCb, self._streamEb, args, None, args)
+                d.chainDeferred(content_data['finished_d'])
         else:
             log.warning(u"FIXME: unmanaged action {}".format(action))
         return transport_elt
 
-    def _streamCb(self, dummy, session, content_name, profile):
-        self._j.contentTerminate(session, content_name, profile=profile)
-
-    def _streamEb(self, failure, session, content_name, profile):
-        log.warning(u"Error while streaming in-band: {}".format(failure))
-        self._j.contentTerminate(session, content_name, reason=self._j.REASON_FAILED_TRANSPORT, profile=profile)
 
 class XEP_0261_handler(XMPPHandler):
     implements(iwokkel.IDisco)