Fix 'from' attribute missing for ComponentXMPP Disco IQ

Fixes #3455

This reuses the 'to' attribute of the received presence as a 'from' for
the Disco IQ. I don't know if this is the best way to do it, but in
testing with a simple component it fixed the error.

Also I'm not sure whether pres['to'] would also be valid when
is_component is False.
This commit is contained in:
aearil 2020-08-05 20:35:30 -04:00
parent 9b9ace97f4
commit f90713cb9e

View file

@ -157,10 +157,12 @@ class XEP_0115(BasePlugin):
self.assign_verstring(pres['from'], ver)
return
ifrom = pres['to'] if self.xmpp.is_component else None
if pres['caps']['hash'] not in self.hashes:
try:
log.debug("Unknown caps hash: %s", pres['caps']['hash'])
self.xmpp['xep_0030'].get_info(jid=pres['from'])
self.xmpp['xep_0030'].get_info(jid=pres['from'], ifrom=ifrom)
return
except XMPPError:
return
@ -169,7 +171,8 @@ class XEP_0115(BasePlugin):
try:
node = '%s#%s' % (pres['caps']['node'], ver)
caps = await self.xmpp['xep_0030'].get_info(pres['from'], node,
coroutine=True)
coroutine=True,
ifrom=ifrom)
if isinstance(caps, Iq):
caps = caps['disco_info']