diff options
author | Lance Stout <lancestout@gmail.com> | 2013-02-10 11:29:57 -0800 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2013-02-10 11:29:57 -0800 |
commit | da3223ac92f15e15ae03cece00ff487d81913c77 (patch) | |
tree | 3380d162b278f328c9c83afa1ca4272ed1f2f203 /sleekxmpp/plugins/xep_0065/stanza.py | |
parent | 75a792eb6f8df68d47db8014852425d9ee36d6a9 (diff) | |
parent | b0fed5a48dc6543a1eedf3ff2cc96f671fbfef0c (diff) | |
download | slixmpp-da3223ac92f15e15ae03cece00ff487d81913c77.tar.gz slixmpp-da3223ac92f15e15ae03cece00ff487d81913c77.tar.bz2 slixmpp-da3223ac92f15e15ae03cece00ff487d81913c77.tar.xz slixmpp-da3223ac92f15e15ae03cece00ff487d81913c77.zip |
Merge branch 'develop'
Diffstat (limited to 'sleekxmpp/plugins/xep_0065/stanza.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0065/stanza.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/sleekxmpp/plugins/xep_0065/stanza.py b/sleekxmpp/plugins/xep_0065/stanza.py new file mode 100644 index 00000000..e48bf1b5 --- /dev/null +++ b/sleekxmpp/plugins/xep_0065/stanza.py @@ -0,0 +1,47 @@ +from sleekxmpp.jid import JID +from sleekxmpp.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) |