/version <jid> command

This commit is contained in:
Florent Le Coz 2011-03-15 23:40:54 +01:00
parent e06b8baa52
commit 6e14fce61f
2 changed files with 19 additions and 0 deletions

View file

@ -5,6 +5,7 @@ http://dev.louiz.org/project/poezio/roadmap
* Poezio 0.7.2 - dev
- Chatstate notifications (in private AND in MUCs)
- /message command to talk to any JID
- /version command to get the software version of an entity
- Multiline edition
* Poezio 0.7.1 - 2 Feb 2010

View file

@ -119,6 +119,7 @@ class Core(object):
'theme': (self.command_theme, _('Usage: /theme\nTheme: Reload the theme defined in the config file.'), None),
'list': (self.command_list, _('Usage: /list\nList: get the list of public chatrooms on the specified server'), self.completion_list),
'message': (self.command_message, _('Usage: /message <jid> [optional message]\nMessage: Open a conversation with the specified JID (even if it is not in our roster), and send a message to it, if specified'), None),
'version': (self.command_version, _('Usage: /version <jid>\nVersion: get the software version of the given JID (usually its XMPP client and Operating System)'), None),
}
self.key_func = {
@ -952,6 +953,23 @@ class Core(object):
if len(args) > 1:
tab.command_say(arg.strip()[len(jid):])
def command_version(self, arg):
"""
/version <jid>
"""
args = arg.split()
if len(args) < 1:
return self.command_help('version')
jid = args[0]
res = self.xmpp.plugin['xep_0092'].get_version(jid)
if not res:
return self.information('Could not get the software version from %s' % (jid,))
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 _('on an unknown platform'))
self.information(version)
def command_list(self, arg):
"""
/list <server>