diff src/plugins/plugin_xep_0261.py @ 2489:e2a7bb875957

plugin pipe/stream, file transfert: refactoring and improvments: this is a big patch as things had to be changed at the same time. - changed methods using profile argument to use client instead - move SatFile in a new tools.stream module, has it should be part of core, not a plugin - new IStreamProducer interface, to handler starting a pull producer - new FileStreamObject which create a stream producer/consumer from a SatFile - plugin pipe is no more using unix named pipe, as it complicate the thing, special care need to be taken to not block, and it's generally not necessary. Instead a socket is now used, so the plugin has been renomed to jingle stream. - bad connection/error should be better handler in jingle stream plugin, and code should not block anymore - jp pipe commands have been updated accordingly fix bug 237
author Goffi <goffi@goffi.org>
date Thu, 08 Feb 2018 00:37:42 +0100
parents 0046283a285d
children 67cc54b01a12
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0261.py	Thu Feb 01 07:24:34 2018 +0100
+++ b/src/plugins/plugin_xep_0261.py	Thu Feb 08 00:37:42 2018 +0100
@@ -59,7 +59,7 @@
     def getHandler(self, client):
         return XEP_0261_handler()
 
-    def jingleSessionInit(self, session, content_name, profile):
+    def jingleSessionInit(self, client, session, content_name):
         transport_elt = domish.Element((NS_JINGLE_IBB, "transport"))
         content_data = session['contents'][content_name]
         transport_data = content_data['transport_data']
@@ -68,7 +68,7 @@
         transport_elt['sid'] = transport_data['sid'] = unicode(uuid.uuid4())
         return transport_elt
 
-    def jingleHandler(self, action, session, content_name, transport_elt, profile):
+    def jingleHandler(self, client, action, session, content_name, transport_elt):
         content_data = session['contents'][content_name]
         transport_data = content_data['transport_data']
         if action in (self._j.A_SESSION_ACCEPT,
@@ -80,13 +80,13 @@
         elif action in (self._j.A_START, self._j.A_PREPARE_RESPONDER):
             peer_jid = session['peer_jid']
             sid = transport_data['sid']
-            file_obj = content_data['file_obj']
+            stream_object = content_data['stream_object']
             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 = self._ibb.startStream(client, stream_object, peer_jid, sid, block_size)
                 d.chainDeferred(content_data['finished_d'])
             else:
-                d = self._ibb.createSession(file_obj, peer_jid, sid, profile)
+                d = self._ibb.createSession(client, stream_object, peer_jid, sid)
                 d.chainDeferred(content_data['finished_d'])
         else:
             log.warning(u"FIXME: unmanaged action {}".format(action))