diff options
author | lovetox <philipp@hoerist.com> | 2020-04-04 19:24:07 +0300 |
---|---|---|
committer | lovetox <philipp@hoerist.com> | 2020-04-04 19:24:07 +0300 |
commit | 0100dc908360d9b58a1396fab55c9bedb41e25c9 (patch) | |
tree | 2ccb3f6bf36b9d69c462eb6b032bc5d31be6bc66 | |
parent | 2a59559f942600acb2fac499c716dc9396dbd042 (diff) |
DiscoInfo: Add propertys for gateways
-rw-r--r-- | nbxmpp/structs.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/nbxmpp/structs.py b/nbxmpp/structs.py index 9537d70..ea0c58e 100644 --- a/nbxmpp/structs.py +++ b/nbxmpp/structs.py @@ -352,6 +352,27 @@ class DiscoInfo(namedtuple('DiscoInfo', 'stanza identities features dataforms ti return 'muc_unsecured' in self.features @property + def is_gateway(self): + for identity in self.identities: + if identity.category == 'gateway': + return True + return False + + @property + def gateway_name(self): + for identity in self.identities: + if identity.category == 'gateway': + return identity.name + return None + + @property + def gateway_type(self): + for identity in self.identities: + if identity.category == 'gateway': + return identity.type + return None + + @property def httpupload_max_file_size(self): size = self.get_field_value(NS_HTTPUPLOAD_0, 'max-file-size') try: |