disco plugin: Add iq error reporting

Previously it behaved as if the response was empty, which was confusing.
This commit is contained in:
Kim Alvefur 2018-12-25 23:20:12 +01:00 committed by Maxime “pep” Buquet
parent f034f7d000
commit 25f15233e0

View file

@ -29,6 +29,10 @@ class Plugin(BasePlugin):
help='Get the disco#info of a JID') help='Get the disco#info of a JID')
def on_disco(self, iq): def on_disco(self, iq):
if iq['type'] == 'error':
self.api.information(iq['error']['text'] or iq['error']['condition'], 'Error')
return
info = iq['disco_info'] info = iq['disco_info']
identities = (str(identity) for identity in info['identities']) identities = (str(identity) for identity in info['identities'])
self.api.information('\n'.join(identities), 'Identities') self.api.information('\n'.join(identities), 'Identities')