summaryrefslogtreecommitdiff
path: root/slixmpp/plugins/xep_0363/stanza.py
blob: b9fc7fed63e8965e041329bcca838da7697a9547 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

# slixmpp: The Slick XMPP Library
# Copyright (C) 2018 Emmanuel Gil Peyrot
# This file is part of slixmpp.
# See the file LICENSE for copying permission.
from slixmpp.xmlstream import ElementBase

class Request(ElementBase):
    plugin_attrib = 'http_upload_request'
    name = 'request'
    namespace = 'urn:xmpp:http:upload:0'
    interfaces = {'filename', 'size', 'content-type'}

class Slot(ElementBase):
    plugin_attrib = 'http_upload_slot'
    name = 'slot'
    namespace = 'urn:xmpp:http:upload:0'

class Put(ElementBase):
    plugin_attrib = 'put'
    name = 'put'
    namespace = 'urn:xmpp:http:upload:0'
    interfaces = {'url'}

class Get(ElementBase):
    plugin_attrib = 'get'
    name = 'get'
    namespace = 'urn:xmpp:http:upload:0'
    interfaces = {'url'}

class Header(ElementBase):
    plugin_attrib = 'header'
    name = 'header'
    namespace = 'urn:xmpp:http:upload:0'
    plugin_multi_attrib = 'headers'
    interfaces = {'name', 'value'}

    def get_value(self):
        return self.xml.text

    def set_value(self, value):
        self.xml.text = value

    def del_value(self):
        self.xml.text = ''