diff options
author | Florent Le Coz <louiz@louiz.org> | 2014-07-17 14:19:04 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2014-07-17 14:19:04 +0200 |
commit | 5ab77c745270d7d5c016c1dc7ef2a82533a4b16e (patch) | |
tree | 259377cc666f8b9c7954fc4e7b8f7a912bcfe101 /slixmpp/plugins/xep_0065/stanza.py | |
parent | e5582694c07236e6830c20361840360a1dde37f3 (diff) | |
download | slixmpp-5ab77c745270d7d5c016c1dc7ef2a82533a4b16e.tar.gz slixmpp-5ab77c745270d7d5c016c1dc7ef2a82533a4b16e.tar.bz2 slixmpp-5ab77c745270d7d5c016c1dc7ef2a82533a4b16e.tar.xz slixmpp-5ab77c745270d7d5c016c1dc7ef2a82533a4b16e.zip |
Rename to slixmpp
Diffstat (limited to 'slixmpp/plugins/xep_0065/stanza.py')
-rw-r--r-- | slixmpp/plugins/xep_0065/stanza.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/slixmpp/plugins/xep_0065/stanza.py b/slixmpp/plugins/xep_0065/stanza.py new file mode 100644 index 00000000..5ba15b32 --- /dev/null +++ b/slixmpp/plugins/xep_0065/stanza.py @@ -0,0 +1,47 @@ +from slixmpp.jid import JID +from slixmpp.xmlstream import ElementBase, register_stanza_plugin + + +class Socks5(ElementBase): + name = 'query' + namespace = 'http://jabber.org/protocol/bytestreams' + plugin_attrib = 'socks' + interfaces = set(['sid', 'activate']) + sub_interfaces = set(['activate']) + + def add_streamhost(self, jid, host, port): + sh = StreamHost(parent=self) + sh['jid'] = jid + sh['host'] = host + sh['port'] = port + + +class StreamHost(ElementBase): + name = 'streamhost' + namespace = 'http://jabber.org/protocol/bytestreams' + plugin_attrib = 'streamhost' + plugin_multi_attrib = 'streamhosts' + interfaces = set(['host', 'jid', 'port']) + + def set_jid(self, value): + return self._set_attr('jid', str(value)) + + def get_jid(self): + return JID(self._get_attr('jid')) + + +class StreamHostUsed(ElementBase): + name = 'streamhost-used' + namespace = 'http://jabber.org/protocol/bytestreams' + plugin_attrib = 'streamhost_used' + interfaces = set(['jid']) + + def set_jid(self, value): + return self._set_attr('jid', str(value)) + + def get_jid(self): + return JID(self._get_attr('jid')) + + +register_stanza_plugin(Socks5, StreamHost, iterable=True) +register_stanza_plugin(Socks5, StreamHostUsed) |