def command_version(self, args): """ /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: return self.core.command_version(args[0]) jid = safeJID(self.name) fixes.get_version(self.core.xmpp, jid, callback=callback)
def command_version(self, args): """ /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: return self.core.command_version(args[0]) jid = safeJID(self.name) fixes.get_version(self.core.xmpp, jid, callback=callback)
def command_version(self, args): """ /version [jid] """ 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: return self.core.command_version(args[0]) jid = safeJID(self.name) if not jid.resource: if jid in roster: resource = roster[jid].get_highest_priority_resource() jid = resource.jid if resource else jid fixes.get_version(self.core.xmpp, jid, callback=callback)
def command_version(self, args): """ /version <jid> """ def callback(res): "Callback for /version" if not res: return self.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.information(version, 'Info') if args is None: return self.command_help('version') jid = safeJID(args[0]) if jid.resource or jid not in roster: fixes.get_version(self.xmpp, jid, callback=callback) elif jid in roster: for resource in roster[jid].resources: fixes.get_version(self.xmpp, resource.jid, callback=callback) else: fixes.get_version(self.xmpp, jid, callback=callback)
def command_version(self, args): """ /version <jid> """ def callback(res): "Callback for /version" if not res: return self.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.information(version, 'Info') if args is None: return self.command_help('version') jid = safeJID(args[0]) if jid.resource or jid not in roster: fixes.get_version(self.xmpp, jid, callback=callback) elif jid in roster: for resource in roster[jid].resources: fixes.get_version(self.xmpp, resource.jid, callback=callback) else: fixes.get_version(self.xmpp, jid, callback=callback)