diff src/plugins/plugin_xep_0261.py @ 1556:cbfbe028d099

plugin XEP-0166, XEP-0234, XEP-0261: - transport and application data are now managed in separate dictionaries - new client.IQ method is used - new buildAction helper method for applications and transports - "role" is now stored in session_data - "senders" is now stored in content_data - plugin XEP-0166: "transport-info" action is now managed - plugin XEP-0166: application namespace and handler are now managed in a namedtuple - plugin XEP-0234: <range/> element is added by responder if not already present
author Goffi <goffi@goffi.org>
date Mon, 02 Nov 2015 22:02:41 +0100
parents bfef1934a8f3
children 268fda4236ca
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0261.py	Mon Nov 02 22:02:41 2015 +0100
+++ b/src/plugins/plugin_xep_0261.py	Mon Nov 02 22:02:41 2015 +0100
@@ -60,24 +60,26 @@
     def jingleSessionInit(self, session, content_name, profile):
         transport_elt = domish.Element((NS_JINGLE_IBB, "transport"))
         content_data = session['contents'][content_name]
-        content_data['ibb_block_size'] = self._ibb.BLOCK_SIZE
-        transport_elt['block-size'] = unicode(content_data['ibb_block_size'])
-        transport_elt['sid'] = content_data['ibb_sid'] = unicode(uuid.uuid4())
+        transport_data = content_data['transport_data']
+        transport_data['block_size'] = self._ibb.BLOCK_SIZE
+        transport_elt['block-size'] = unicode(transport_data['block_size'])
+        transport_elt['sid'] = transport_data['sid'] = unicode(uuid.uuid4())
         return transport_elt
 
     def jingleHandler(self, action, session, content_name, transport_elt, profile):
         content_data = session['contents'][content_name]
+        transport_data = content_data['transport_data']
         if action in (self._j.A_SESSION_ACCEPT, self._j.A_ACCEPTED_ACK):
             pass
         elif action == self._j.A_SESSION_INITIATE:
-            content_data['ibb_sid'] = transport_elt['sid']
+            transport_data['sid'] = transport_elt['sid']
         elif action in (self._j.A_START, self._j.A_PREPARE_RESPONDER):
             to_jid = session['to_jid']
-            sid = content_data['ibb_sid']
+            sid = transport_data['sid']
             file_obj = content_data['file_obj']
             args = [session, content_name, profile]
             if action == self._j.A_START:
-                block_size = content_data['ibb_block_size']
+                block_size = transport_data['block_size']
                 d = self._ibb.startStream(file_obj, to_jid, sid, block_size, profile)
                 d.addErrback(self._streamEb, *args)
             else: