Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/python-nbxmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hörist <philipp@hoerist.com>2019-12-21 12:55:51 +0300
committerPhilipp Hörist <philipp@hoerist.com>2019-12-21 12:55:51 +0300
commit0f2fa095283bd467ecfc54877fc27f7cefb65db8 (patch)
tree94c0385f1af4a69fc32dfbce5977d7b3af349890 /nbxmpp/structs.py
parent3d6df88c348a57a96a3ca957464f238dc177d597 (diff)
Add HTTP Upload (XEP-0363) support
Diffstat (limited to 'nbxmpp/structs.py')
-rw-r--r--nbxmpp/structs.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/nbxmpp/structs.py b/nbxmpp/structs.py
index 347d4b1..252ef3f 100644
--- a/nbxmpp/structs.py
+++ b/nbxmpp/structs.py
@@ -136,6 +136,10 @@ RegisterData = namedtuple('RegisterData', 'instructions form fields_form oob_url
ChangePasswordResult = namedtuple('ChangePasswordResult', 'successful form')
ChangePasswordResult.__new__.__defaults__ = (None,)
+HTTPUploadData = namedtuple('HTTPUploadData', 'put_uri get_uri headers')
+HTTPUploadData.__new__.__defaults__ = (None,)
+
+
class DiscoInfo(namedtuple('DiscoInfo', 'stanza identities features dataforms timestamp')):
__slots__ = []
@@ -449,6 +453,25 @@ class CommonError:
payload=self._error_node))
+class HTTPUploadError(CommonError):
+ def __init__(self, stanza):
+ CommonError.__init__(self, stanza)
+
+ def get_max_file_size(self):
+ if not self.app_condition == 'file-too-large':
+ return None
+ node = self._error_node.getTag(self.app_condition)
+ try:
+ return float(node.getTagData('max-file-size'))
+ except Exception:
+ return None
+
+ def get_retry_date(self):
+ if not self.app_condition == 'retry':
+ return None
+ return self._error_node.getTagAttr('stamp')
+
+
class StanzaMalformedError(CommonError):
def __init__(self, stanza, text):
self._error_node = None