Commit c328063f authored by Philipp Hörist's avatar Philipp Hörist

DiscoInfo: Add propertys for http upload

parent 0f2fa095
Pipeline #4784 passed with stages
in 13 seconds
......@@ -27,6 +27,7 @@ from nbxmpp.protocol import NS_MUC
from nbxmpp.protocol import NS_MUC_INFO
from nbxmpp.protocol import NS_CLIENT
from nbxmpp.protocol import NS_XHTML
from nbxmpp.protocol import NS_HTTPUPLOAD_0
from nbxmpp.protocol import Protocol
from nbxmpp.const import MessageType
from nbxmpp.const import AvatarState
......@@ -224,6 +225,10 @@ class DiscoInfo(namedtuple('DiscoInfo', 'stanza identities features dataforms ti
def has_mam(self):
return self.has_mam_1 or self.has_mam_2
@property
def has_httpupload(self):
return NS_HTTPUPLOAD_0 in self.features
@property
def is_muc(self):
for identity in self.identities:
......@@ -332,6 +337,14 @@ class DiscoInfo(namedtuple('DiscoInfo', 'stanza identities features dataforms ti
def muc_is_unsecured(self):
return 'muc_unsecured' in self.features
@property
def httpupload_max_file_size(self):
size = self.get_field_value(NS_HTTPUPLOAD_0, 'max-file-size')
try:
return float(size)
except Exception:
return None
class DiscoIdentity(namedtuple('DiscoIdentity', 'category type name lang')):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment