summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2013-05-11 12:48:47 -0700
committerLance Stout <lancestout@gmail.com>2013-05-11 12:48:47 -0700
commit2e9ccd0623d253fbb3ddd2e3b8e8908cd349246d (patch)
tree6918a901d241e36d239ab7afb35e07eafc3227aa /examples
parent7b49c82210d6b27b18dffe36e6533024b8bee913 (diff)
parentfae39e1ab4e516c7c7b6cef81188359e38fe0531 (diff)
downloadslixmpp-2e9ccd0623d253fbb3ddd2e3b8e8908cd349246d.tar.gz
slixmpp-2e9ccd0623d253fbb3ddd2e3b8e8908cd349246d.tar.bz2
slixmpp-2e9ccd0623d253fbb3ddd2e3b8e8908cd349246d.tar.xz
slixmpp-2e9ccd0623d253fbb3ddd2e3b8e8908cd349246d.zip
Merge branch 'si_file_transfer' into develop
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/ibb_transfer/ibb_receiver.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/examples/ibb_transfer/ibb_receiver.py b/examples/ibb_transfer/ibb_receiver.py
index 0169d63d..6aba98e3 100755
--- a/examples/ibb_transfer/ibb_receiver.py
+++ b/examples/ibb_transfer/ibb_receiver.py
@@ -38,7 +38,7 @@ class IBBReceiver(sleekxmpp.ClientXMPP):
self.register_plugin('xep_0030') # Service Discovery
self.register_plugin('xep_0047', {
- 'accept_stream': self.accept_stream
+ 'auto_accept': True
}) # In-band Bytestreams
# The session_start event will be triggered when
@@ -48,7 +48,7 @@ class IBBReceiver(sleekxmpp.ClientXMPP):
# our roster.
self.add_event_handler("session_start", self.start)
- self.add_event_handler("ibb_stream_start", self.stream_opened)
+ self.add_event_handler("ibb_stream_start", self.stream_opened, threaded=True)
self.add_event_handler("ibb_stream_data", self.stream_data)
def start(self, event):
@@ -69,7 +69,7 @@ class IBBReceiver(sleekxmpp.ClientXMPP):
def accept_stream(self, iq):
"""
- Check that it is ok to accept a stream request.
+ Check that it is ok to accept a stream request.
Controlling stream acceptance can be done via either:
- setting 'auto_accept' to False in the plugin
@@ -83,9 +83,7 @@ class IBBReceiver(sleekxmpp.ClientXMPP):
return True
def stream_opened(self, stream):
- # NOTE: IBB streams are bi-directional, so the original sender is
- # now the opened stream's receiver.
- print('Stream opened: %s from %s' % (stream.sid, stream.receiver))
+ print('Stream opened: %s from %s' % (stream.sid, stream.peer_jid))
# You could run a loop reading from the stream using stream.recv(),
# or use the ibb_stream_data event.