# HG changeset patch # User Goffi # Date 1619886601 -7200 # Node ID 8508fab9bcc29417bc60dbffad49c0ddb4b307df # Parent e47aa1fb7b2491d188793529cb44da82ee2faf49 plugin XEP-0353: don't use Jingle Message Initiation for components: Jingle Message Initiation is currently not useful for components, and the message workflow is different in Libervia between clients and components (as a result, `messageReceived` trigger is never called, and the session proposal is never answered). diff -r e47aa1fb7b24 -r 8508fab9bcc2 sat/plugins/plugin_xep_0353.py --- a/sat/plugins/plugin_xep_0353.py Sat May 01 18:25:42 2021 +0200 +++ b/sat/plugins/plugin_xep_0353.py Sat May 01 18:30:01 2021 +0200 @@ -38,7 +38,7 @@ C.PI_NAME: "Jingle Message Initiation", C.PI_IMPORT_NAME: "XEP-0353", C.PI_TYPE: "XEP", - C.PI_MODES: C.PLUG_MODE_BOTH, + C.PI_MODES: C.PLUG_MODE_CLIENT, C.PI_PROTOCOLS: ["XEP-0353"], C.PI_DEPENDENCIES: ["XEP-0166"], C.PI_MAIN: "XEP_0353", @@ -47,7 +47,7 @@ } -class XEP_0353(object): +class XEP_0353: def __init__(self, host): log.info(_("plugin {name} initialization").format(name=PLUGIN_INFO[C.PI_NAME])) @@ -80,10 +80,17 @@ return mess_data async def _onInitiateTrigger(self, client, session, contents): + # FIXME: check that at least one resource of the peer_jid can handle the feature peer_jid = session['peer_jid'] if peer_jid.resource: return True + infos = await self.host.memory.disco.getInfos(client, peer_jid) + categories = {c for c, __ in infos.identities} + if "component" in categories: + # we don't use message initiation with components + return True + if peer_jid.userhostJID() not in client.roster: # if the contact is not in our roster, we need to send a directed presence # according to XEP-0353 ยง3.1