summaryrefslogtreecommitdiffstats
path: root/classes/version.py
diff options
context:
space:
mode:
authornico <nico@magicbroccoli.de>2019-01-09 19:38:04 +0100
committernico <nico@magicbroccoli.de>2019-01-09 19:38:04 +0100
commit134a674228b3d2b42cb7fe2a12f215a225e7544b (patch)
tree0643df4b2c3e0d0368eab6a2c01625fcb04d801f /classes/version.py
parent9c3f6761e5f7749125a0d4939cd1809aabdfd2be (diff)
initial rework of the implemented functionsdev
+ added __init__ import file for all functions + added new helper function + added strings.json file * some logic fixups * validator fixup * arg abbreviation moved to misc
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