From a3b8452358067796588cb073b586c5e010aff938 Mon Sep 17 00:00:00 2001
From: mathieui <mathieui@mathieui.net>
Date: Tue, 20 Sep 2011 00:53:49 +0200
Subject: Fixes #2245

---
 src/tabs.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/tabs.py b/src/tabs.py
index 3a93f541..7e535682 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -1002,6 +1002,7 @@ class PrivateTab(ChatTab):
         #self.commands['info'] = (self.command_info, _('Usage: /info\nInfo: Display some information about the user in the MUC: '), None)
         self.commands['unquery'] = (self.command_unquery, _("Usage: /unquery\nUnquery: close the tab"), None)
         self.commands['part'] = (self.command_unquery, _("Usage: /part\nPart: close the tab"), None)
+        self.commands['version'] = (self.command_version, _('Usage: /version\nVersion: get the software version of the current interlocutor (usually its XMPP client and Operating System)'), None)
         self.resize()
         self.on = True
 
@@ -1033,6 +1034,21 @@ class PrivateTab(ChatTab):
         """
         self.core.close_tab()
 
+    def command_version(self, arg):
+        """
+        /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 _('on an unknown platform'))
+            self.core.information(version, 'Info')
+        jid = self.get_room().name
+        self.core.xmpp.plugin['xep_0092'].get_version(jid, callback=callback)
+
     def resize(self):
         if self.core.information_win_size >= self.height-3 or not self.visible:
             return
-- 
cgit v1.2.3