diff --git a/sat/plugins/plugin_xep_0353.py b/sat/plugins/plugin_xep_0353.py index e3e9e426..6dea3783 100644 --- a/sat/plugins/plugin_xep_0353.py +++ b/sat/plugins/plugin_xep_0353.py @@ -38,7 +38,7 @@ PLUGIN_INFO = { 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 @@ PLUGIN_INFO = { } -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 @@ class XEP_0353(object): 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