2013-01-23 10:18:27 +00:00
|
|
|
from sleekxmpp.jid import JID
|
2012-06-04 06:03:08 +00:00
|
|
|
from sleekxmpp.xmlstream import ElementBase, register_stanza_plugin
|
|
|
|
|
2012-06-03 17:56:56 +00:00
|
|
|
|
2013-01-23 10:18:27 +00:00
|
|
|
class Socks5(ElementBase):
|
|
|
|
name = 'query'
|
|
|
|
namespace = 'http://jabber.org/protocol/bytestreams'
|
|
|
|
plugin_attrib = 'socks'
|
|
|
|
interfaces = set(['sid', 'activate'])
|
|
|
|
sub_interfaces = set(['activate'])
|
2012-06-03 17:56:56 +00:00
|
|
|
|
2013-01-23 10:18:27 +00:00
|
|
|
def add_streamhost(self, jid, host, port):
|
|
|
|
sh = StreamHost(parent=self)
|
|
|
|
sh['jid'] = jid
|
|
|
|
sh['host'] = host
|
|
|
|
sh['port'] = port
|
2012-06-03 17:56:56 +00:00
|
|
|
|
|
|
|
|
2013-01-23 10:18:27 +00:00
|
|
|
class StreamHost(ElementBase):
|
2012-06-03 17:56:56 +00:00
|
|
|
name = 'streamhost'
|
2013-01-23 10:18:27 +00:00
|
|
|
namespace = 'http://jabber.org/protocol/bytestreams'
|
2012-06-03 17:56:56 +00:00
|
|
|
plugin_attrib = 'streamhost'
|
2013-01-23 10:18:27 +00:00
|
|
|
plugin_multi_attrib = 'streamhosts'
|
|
|
|
interfaces = set(['host', 'jid', 'port'])
|
2012-06-03 17:56:56 +00:00
|
|
|
|
2013-01-23 10:18:27 +00:00
|
|
|
def set_jid(self, value):
|
|
|
|
return self._set_attr('jid', str(value))
|
2012-06-03 17:56:56 +00:00
|
|
|
|
2013-01-23 10:18:27 +00:00
|
|
|
def get_jid(self):
|
|
|
|
return JID(self._get_attr('jid'))
|
2012-06-03 17:56:56 +00:00
|
|
|
|
2013-01-23 10:18:27 +00:00
|
|
|
|
|
|
|
class StreamHostUsed(ElementBase):
|
2012-06-03 17:56:56 +00:00
|
|
|
name = 'streamhost-used'
|
2013-01-23 10:18:27 +00:00
|
|
|
namespace = 'http://jabber.org/protocol/bytestreams'
|
|
|
|
plugin_attrib = 'streamhost_used'
|
|
|
|
interfaces = set(['jid'])
|
2012-06-03 17:56:56 +00:00
|
|
|
|
2013-01-23 10:18:27 +00:00
|
|
|
def set_jid(self, value):
|
|
|
|
return self._set_attr('jid', str(value))
|
2012-06-03 17:56:56 +00:00
|
|
|
|
2013-01-23 10:18:27 +00:00
|
|
|
def get_jid(self):
|
|
|
|
return JID(self._get_attr('jid'))
|
2012-06-03 17:56:56 +00:00
|
|
|
|
|
|
|
|
2013-01-23 10:18:27 +00:00
|
|
|
register_stanza_plugin(Socks5, StreamHost, iterable=True)
|
2012-06-07 17:14:37 +00:00
|
|
|
register_stanza_plugin(Socks5, StreamHostUsed)
|