plugin XEP-0176: Add non standard <tickle> element:

Add the non standard <trickle> element found with Jingle negociation with Conversations.
This commit is contained in:
Goffi 2025-10-29 12:12:51 +01:00
commit 47564ec828

View file

@ -95,7 +95,7 @@ class XEP_0176(BaseTransportHandler):
)
)
def build_transport(self, ice_data: dict) -> domish.Element:
def build_transport(self, ice_data: dict, add_trickle: bool = False) -> domish.Element:
"""Generate <transport> element from ICE data
@param ice_data: a dict containing the following keys:
@ -153,6 +153,11 @@ class XEP_0176(BaseTransportHandler):
candidate_elt["rel-addr"] = candidate["rel_addr"]
candidate_elt["rel-port"] = str(candidate["rel_port"])
if add_trickle:
transport_elt.addElement(
("http://gultsch.de/xmpp/drafts/jingle/transports/ice-udp/option", "trickle")
)
self.host.trigger.point("XEP-0176_build_transport", transport_elt, ice_data)
return transport_elt
@ -228,7 +233,7 @@ class XEP_0176(BaseTransportHandler):
content_data = session["contents"][content_name]
transport_data = content_data["transport_data"]
ice_data = transport_data["local_ice_data"]
return self.build_transport(ice_data)
return self.build_transport(ice_data, add_trickle=True)
async def _send_ice_buffer(
self,
@ -320,8 +325,11 @@ class XEP_0176(BaseTransportHandler):
elif action == self._j.A_SESSION_INITIATE:
# responder side, we give our candidates
transport_elt = self.build_transport(transport_data["local_ice_data"])
transport_elt = self.build_transport(
transport_data["local_ice_data"], add_trickle=True
)
elif action == self._j.A_TRANSPORT_INFO:
if session["state"] == self._j.STATE_PENDING:
# Session is not yet active; we buffer the arguments to replay them
# when the session becomes active. This makes the frontend's life easier.