summaryrefslogtreecommitdiffstats
path: root/classes/version.py
diff options
context:
space:
mode:
Diffstat (limited to 'classes/version.py')
-rw-r--r--classes/version.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/classes/version.py b/classes/version.py
index 1e9ef7e..42b3e61 100644
--- a/classes/version.py
+++ b/classes/version.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-
+from common.misc import arg_abbr
# XEP-0072: Server Version
class Version:
@@ -10,17 +10,18 @@ class Version:
# init all necessary variables
self.software_version = None
self.target, self.opt_arg = None, None
+ self.possible_vars = ["version", "os", "name"]
def format_result(self):
- # list of all possible opt_arg
- possible_opt_args = ["version", "os", "name"]
-
name = self.software_version['name']
version = self.software_version['version']
os = self.software_version['os']
+ # check for possible abbreviations to the optional argument
+ self.opt_arg = arg_abbr(self.opt_arg, self.possible_vars)
+
# if opt_arg is given member of possible_opt_args list return that element
- if self.opt_arg in possible_opt_args:
+ if self.opt_arg in self.possible_vars:
text = "%s: %s" % (self.opt_arg, self.software_version[self.opt_arg])
# otherwise return full version string