From 326de0f16155dc8a5729bffe0057282c3232141b Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 14 Mar 2018 17:18:46 +0100 Subject: Factorise the /version callback and make it handle errors Fixes #3376. --- poezio/tabs/muctab.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'poezio/tabs/muctab.py') diff --git a/poezio/tabs/muctab.py b/poezio/tabs/muctab.py index afe62188..59ef9054 100644 --- a/poezio/tabs/muctab.py +++ b/poezio/tabs/muctab.py @@ -1340,18 +1340,6 @@ class MucTab(ChatTab): """ /version """ - - def callback(res): - if not res: - return self.core.information('Could not get the software ' - 'version from %s' % (jid, ), - 'Warning') - version = '%s is running %s version %s on %s' % ( - jid, res.get('name') or 'an unknown software', - res.get('version') or 'unknown', - res.get('os') or 'an unknown platform') - self.core.information(version, 'Info') - if args is None: return self.core.command.help('version') nick = args[0] @@ -1360,7 +1348,8 @@ class MucTab(ChatTab): jid = safeJID(jid + '/' + nick) else: jid = safeJID(nick) - fixes.get_version(self.core.xmpp, jid, callback=callback) + self.core.xmpp.plugin['xep_0092'].get_version( + jid, callback=self.core.handler.on_version_result) @command_args_parser.quoted(1) def command_nick(self, args): -- cgit v1.2.3