From 6e14fce61f12dc35d0f0a88f12f1cbf58fd58d7a Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Tue, 15 Mar 2011 23:40:54 +0100 Subject: /version command --- CHANGELOG | 1 + src/core.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 99e7caa0..15c34864 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/src/core.py b/src/core.py index 129b6e92..031c4127 100644 --- a/src/core.py +++ b/src/core.py @@ -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 [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 \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 + """ + 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 -- cgit v1.2.3