plugin XEP-0353: fix jingle initiation on disco "Service Unavailable" error:
When requesting disco info on a bare jid which is not in our roster, server may return "Service Unavailable" (to avoid leaking valid JIDs). In this case, the initiation was failing, this is now fixed by using empty categories in this case.
This commit is contained in:
parent
6bf40afe6a
commit
0c3910bafd
1 changed files with 10 additions and 3 deletions
|
|
@ -19,7 +19,7 @@
|
|||
from zope.interface import implementer
|
||||
from twisted.internet import defer
|
||||
from twisted.internet import reactor
|
||||
from twisted.words.protocols.jabber import xmlstream, jid
|
||||
from twisted.words.protocols.jabber import xmlstream, jid, error
|
||||
from twisted.words.xish import domish
|
||||
from wokkel import disco, iwokkel
|
||||
from sat.core.i18n import _, D_
|
||||
|
|
@ -85,8 +85,15 @@ class XEP_0353:
|
|||
if peer_jid.resource:
|
||||
return True
|
||||
|
||||
infos = await self.host.memory.disco.getInfos(client, peer_jid)
|
||||
categories = {c for c, __ in infos.identities}
|
||||
try:
|
||||
infos = await self.host.memory.disco.getInfos(client, peer_jid)
|
||||
except error.StanzaError as e:
|
||||
if e.condition == "service-unavailable":
|
||||
categories = {}
|
||||
else:
|
||||
raise e
|
||||
else:
|
||||
categories = {c for c, __ in infos.identities}
|
||||
if "component" in categories:
|
||||
# we don't use message initiation with components
|
||||
return True
|
||||
|
|
|
|||
Loading…
Reference in a new issue