summaryrefslogtreecommitdiff
path: root/src/tabs.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/tabs.py')
-rw-r--r--src/tabs.py37
1 files changed, 29 insertions, 8 deletions
diff --git a/src/tabs.py b/src/tabs.py
index 3a93f541..5c141f51 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -13,9 +13,6 @@ Each Tab object has different refresh() and resize() methods, defining how its
Windows are displayed, resized, etc
"""
-MIN_WIDTH = 50
-MIN_HEIGHT = 22
-
import logging
log = logging.getLogger(__name__)
@@ -89,10 +86,7 @@ class Tab(object):
@staticmethod
def resize(scr):
Tab.size = (Tab.height, Tab.width) = scr.getmaxyx()
- if Tab.height < MIN_HEIGHT or Tab.width < MIN_WIDTH:
- Tab.visible = False
- else:
- Tab.visible = True
+ Tab.visible = True
def complete_commands(self, the_input):
"""
@@ -999,10 +993,12 @@ class PrivateTab(ChatTab):
# keys
self.key_func['^I'] = self.completion
# commands
- #self.commands['info'] = (self.command_info, _('Usage: /info\nInfo: Display some information about the user in the MUC: '), None)
+ 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.parent_muc = self.core.get_tab_by_name(JID(room.name).bare, MucTab)
self.on = True
def completion(self):
@@ -1033,6 +1029,31 @@ 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 command_info(self, arg):
+ """
+ /info
+ """
+ if arg:
+ self.parent_muc.command_info(arg)
+ else:
+ user = JID(self.get_room().name).resource
+ self.parent_muc.command_info(user)
+
def resize(self):
if self.core.information_win_size >= self.height-3 or not self.visible:
return