Commit 7b88c0e0 authored by Philipp Hörist's avatar Philipp Hörist
Browse files

[httpupload] Discover max-file-size reliably

parent 3140045e
......@@ -91,13 +91,20 @@ class HTTPUploadPlugin(GajimPlugin):
interface.component = event.jid
for form in
tmp = form.getField("max-file-size").getValue()
interface.max_file_size = int(tmp)
except AttributeError:
interface.max_file_size = None
log.warning("%s does not provide maximum file size" % account)
for form in
form_dict = form.asDict()
if form_dict.get('FORM_TYPE', None) != NS_HTTPUPLOAD:
size = form_dict.get('max-file-size', None)
if size is not None:
interface.max_file_size = int(size)
if interface.max_file_size is None:
log.warning('%s does not provide maximum file size', account)
else:'%s has a maximum file size of: %s',
account, interface.max_file_size)
def handle_outgoing_stanza(self, event):
message = event.msg_iq.getTagData('body')
......@@ -145,6 +152,7 @@ class Base(object):
self.encrypted_upload = False
self.enabled = False
self.component = None
self.max_file_size = None
self.controls = {}
def add_button(self, chat_control):
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