comparison src/plugins/plugin_xep_0261.py @ 1631:25906c0dbc63

plugin XEP-0260, XEP-0261: fallback from S5B to IBB is implemented
author Goffi <goffi@goffi.org>
date Thu, 19 Nov 2015 18:15:35 +0100
parents c668081eba1c
children d17772b0fe22
comparison
equal deleted inserted replaced
1630:c25f63215632 1631:25906c0dbc63
44 "description": _("""Implementation of Jingle In-Band Bytestreams""") 44 "description": _("""Implementation of Jingle In-Band Bytestreams""")
45 } 45 }
46 46
47 47
48 class XEP_0261(object): 48 class XEP_0261(object):
49 NAMESPACE = NS_JINGLE_IBB # used by XEP-0260 plugin for transport-replace
49 50
50 def __init__(self, host): 51 def __init__(self, host):
51 log.info(_("plugin Jingle In-Band Bytestreams")) 52 log.info(_("plugin Jingle In-Band Bytestreams"))
52 self.host = host 53 self.host = host
53 self._j = host.plugins["XEP-0166"] # shortcut to access jingle 54 self._j = host.plugins["XEP-0166"] # shortcut to access jingle
67 return transport_elt 68 return transport_elt
68 69
69 def jingleHandler(self, action, session, content_name, transport_elt, profile): 70 def jingleHandler(self, action, session, content_name, transport_elt, profile):
70 content_data = session['contents'][content_name] 71 content_data = session['contents'][content_name]
71 transport_data = content_data['transport_data'] 72 transport_data = content_data['transport_data']
72 if action in (self._j.A_SESSION_ACCEPT, self._j.A_ACCEPTED_ACK): 73 if action in (self._j.A_SESSION_ACCEPT,
74 self._j.A_ACCEPTED_ACK,
75 self._j.A_TRANSPORT_ACCEPT):
73 pass 76 pass
74 elif action == self._j.A_SESSION_INITIATE: 77 elif action in (self._j.A_SESSION_INITIATE, self._j.A_TRANSPORT_REPLACE):
75 transport_data['sid'] = transport_elt['sid'] 78 transport_data['sid'] = transport_elt['sid']
76 elif action in (self._j.A_START, self._j.A_PREPARE_RESPONDER): 79 elif action in (self._j.A_START, self._j.A_PREPARE_RESPONDER):
77 peer_jid = session['peer_jid'] 80 peer_jid = session['peer_jid']
78 sid = transport_data['sid'] 81 sid = transport_data['sid']
79 file_obj = content_data['file_obj'] 82 file_obj = content_data['file_obj']