1 from sleekxmpp
.jid
import JID
2 from sleekxmpp
.xmlstream
import ElementBase
, register_stanza_plugin
5 class Socks5(ElementBase
):
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
)
19 class StreamHost(ElementBase
):
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
))
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
))
43 return JID(self
._get
_attr
('jid'))
46 register_stanza_plugin(Socks5
, StreamHost
, iterable
=True)
47 register_stanza_plugin(Socks5
, StreamHostUsed
)