Bump to 1.3.1
[slixmpp.git] / sleekxmpp / plugins / xep_0065 / stanza.py
blobe48bf1b541d24c4266f5d2801cc710c81ba1af15
1 from sleekxmpp.jid import JID
2 from sleekxmpp.xmlstream import ElementBase, register_stanza_plugin
5 class Socks5(ElementBase):
6 name = 'query'
7 namespace = 'http://jabber.org/protocol/bytestreams'
8 plugin_attrib = 'socks'
9 interfaces = set(['sid', 'activate'])
10 sub_interfaces = set(['activate'])
12 def add_streamhost(self, jid, host, port):
13 sh = StreamHost(parent=self)
14 sh['jid'] = jid
15 sh['host'] = host
16 sh['port'] = port
19 class StreamHost(ElementBase):
20 name = 'streamhost'
21 namespace = 'http://jabber.org/protocol/bytestreams'
22 plugin_attrib = 'streamhost'
23 plugin_multi_attrib = 'streamhosts'
24 interfaces = set(['host', 'jid', 'port'])
26 def set_jid(self, value):
27 return self._set_attr('jid', str(value))
29 def get_jid(self):
30 return JID(self._get_attr('jid'))
33 class StreamHostUsed(ElementBase):
34 name = 'streamhost-used'
35 namespace = 'http://jabber.org/protocol/bytestreams'
36 plugin_attrib = 'streamhost_used'
37 interfaces = set(['jid'])
39 def set_jid(self, value):
40 return self._set_attr('jid', str(value))
42 def get_jid(self):
43 return JID(self._get_attr('jid'))
46 register_stanza_plugin(Socks5, StreamHost, iterable=True)
47 register_stanza_plugin(Socks5, StreamHostUsed)