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:
parent
f8eeeeaa0c
commit
3ea9c6fdd9
1 changed files with 9 additions and 2 deletions
|
|
@ -38,7 +38,7 @@ PLUGIN_INFO = {
|
||||||
C.PI_NAME: "Jingle Message Initiation",
|
C.PI_NAME: "Jingle Message Initiation",
|
||||||
C.PI_IMPORT_NAME: "XEP-0353",
|
C.PI_IMPORT_NAME: "XEP-0353",
|
||||||
C.PI_TYPE: "XEP",
|
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_PROTOCOLS: ["XEP-0353"],
|
||||||
C.PI_DEPENDENCIES: ["XEP-0166"],
|
C.PI_DEPENDENCIES: ["XEP-0166"],
|
||||||
C.PI_MAIN: "XEP_0353",
|
C.PI_MAIN: "XEP_0353",
|
||||||
|
|
@ -47,7 +47,7 @@ PLUGIN_INFO = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class XEP_0353(object):
|
class XEP_0353:
|
||||||
|
|
||||||
def __init__(self, host):
|
def __init__(self, host):
|
||||||
log.info(_("plugin {name} initialization").format(name=PLUGIN_INFO[C.PI_NAME]))
|
log.info(_("plugin {name} initialization").format(name=PLUGIN_INFO[C.PI_NAME]))
|
||||||
|
|
@ -80,10 +80,17 @@ class XEP_0353(object):
|
||||||
return mess_data
|
return mess_data
|
||||||
|
|
||||||
async def _onInitiateTrigger(self, client, session, contents):
|
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']
|
peer_jid = session['peer_jid']
|
||||||
if peer_jid.resource:
|
if peer_jid.resource:
|
||||||
return True
|
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 peer_jid.userhostJID() not in client.roster:
|
||||||
# if the contact is not in our roster, we need to send a directed presence
|
# if the contact is not in our roster, we need to send a directed presence
|
||||||
# according to XEP-0353 §3.1
|
# according to XEP-0353 §3.1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue