Mercurial > libervia-backend
comparison sat/plugins/plugin_xep_0261.py @ 2927:69e4716d6268
plugins (jingle) file transfer: use initial "from" attribute as local jid instead of client.jid:
while client.jid is fine in a client context, for components it's not the right jid to use: it is the jid of the component itself while the file transfer/jingle session entity may be established with this jid + a local part (e.g. if client is files.example.net, session may be established with louise@files.example.net, in which case "from" is louise@files.example.net, while client.jid will be files.example.net).
As a consequence, using client.jid was causing trouble with components.
This patch fixes it for jingle and plugins linked to file transfer by keeping a "local_jid" variable in the session, where the jid from the original "from" attribute is used.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 28 Apr 2019 08:55:13 +0200 |
parents | 003b8b4b56a7 |
children | ab2696e34d29 |
comparison
equal
deleted
inserted
replaced
2926:4cd7545c4ebb | 2927:69e4716d6268 |
---|---|
82 ): | 82 ): |
83 pass | 83 pass |
84 elif action in (self._j.A_SESSION_INITIATE, self._j.A_TRANSPORT_REPLACE): | 84 elif action in (self._j.A_SESSION_INITIATE, self._j.A_TRANSPORT_REPLACE): |
85 transport_data["sid"] = transport_elt["sid"] | 85 transport_data["sid"] = transport_elt["sid"] |
86 elif action in (self._j.A_START, self._j.A_PREPARE_RESPONDER): | 86 elif action in (self._j.A_START, self._j.A_PREPARE_RESPONDER): |
87 local_jid = session["local_jid"] | |
87 peer_jid = session["peer_jid"] | 88 peer_jid = session["peer_jid"] |
88 sid = transport_data["sid"] | 89 sid = transport_data["sid"] |
89 stream_object = content_data["stream_object"] | 90 stream_object = content_data["stream_object"] |
90 if action == self._j.A_START: | 91 if action == self._j.A_START: |
91 block_size = transport_data["block_size"] | 92 block_size = transport_data["block_size"] |
92 d = self._ibb.startStream( | 93 d = self._ibb.startStream( |
93 client, stream_object, peer_jid, sid, block_size | 94 client, stream_object, local_jid, peer_jid, sid, block_size |
94 ) | 95 ) |
95 d.chainDeferred(content_data["finished_d"]) | 96 d.chainDeferred(content_data["finished_d"]) |
96 else: | 97 else: |
97 d = self._ibb.createSession(client, stream_object, peer_jid, sid) | 98 d = self._ibb.createSession( |
99 client, stream_object, local_jid, peer_jid, sid) | |
98 d.chainDeferred(content_data["finished_d"]) | 100 d.chainDeferred(content_data["finished_d"]) |
99 else: | 101 else: |
100 log.warning(u"FIXME: unmanaged action {}".format(action)) | 102 log.warning(u"FIXME: unmanaged action {}".format(action)) |
101 return transport_elt | 103 return transport_elt |
102 | 104 |