diff options
author | genofire <geno+dev@fireorbit.de> | 2020-06-26 08:24:45 +0200 |
---|---|---|
committer | genofire <geno+dev@fireorbit.de> | 2020-06-26 08:24:45 +0200 |
commit | 76b6be03ab500f82beca4b072a5c50bbed07f294 (patch) | |
tree | 4ff4c1a45d15de060fe1e1f7cb24ff96531e9fa9 | |
parent | bbf156057f04ff9b05a316e403ed4e090ae6fafc (diff) |
add call for nodename
-rw-r--r-- | calls.py | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -12,6 +12,24 @@ log = logging.getLogger(__name__) class EjabberdApiCalls(EjabberdApi): @property + def nodename(self): + if self._login is not None: + node_str = re.compile('The node \'(.*)\'') + status = self.cmd('status', {}) + + # matches + try: + tmp = node_str.findall(status)[0] + # raise SystemExit code 17 if no status message is received + except TypeError: + raise SystemExit(17) + + log.debug(f"fetched node string: {tmp}") + return tmp + + return None + + @property def verstring(self): if self._login is not None: ver_str = re.compile('([1-9][0-9.]+(?![.a-z]))\\b') |