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).
This commit is contained in:
Goffi 2021-05-01 18:30:01 +02:00
commit 3ea9c6fdd9

View file

@ -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