diff options
author | Lance Stout <lancestout@gmail.com> | 2013-05-11 12:48:47 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2013-05-11 12:48:47 -0700 |
commit | 2e9ccd0623d253fbb3ddd2e3b8e8908cd349246d (patch) | |
tree | 6918a901d241e36d239ab7afb35e07eafc3227aa /sleekxmpp/plugins/xep_0047/stream.py | |
parent | 7b49c82210d6b27b18dffe36e6533024b8bee913 (diff) | |
parent | fae39e1ab4e516c7c7b6cef81188359e38fe0531 (diff) | |
download | slixmpp-2e9ccd0623d253fbb3ddd2e3b8e8908cd349246d.tar.gz slixmpp-2e9ccd0623d253fbb3ddd2e3b8e8908cd349246d.tar.bz2 slixmpp-2e9ccd0623d253fbb3ddd2e3b8e8908cd349246d.tar.xz slixmpp-2e9ccd0623d253fbb3ddd2e3b8e8908cd349246d.zip |
Merge branch 'si_file_transfer' into develop
Diffstat (limited to 'sleekxmpp/plugins/xep_0047/stream.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0047/stream.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/sleekxmpp/plugins/xep_0047/stream.py b/sleekxmpp/plugins/xep_0047/stream.py index adc86450..9651edf8 100644 --- a/sleekxmpp/plugins/xep_0047/stream.py +++ b/sleekxmpp/plugins/xep_0047/stream.py @@ -12,15 +12,17 @@ log = logging.getLogger(__name__) class IBBytestream(object): - def __init__(self, xmpp, sid, block_size, to, ifrom, window_size=1, use_messages=False): + def __init__(self, xmpp, sid, block_size, jid, peer, window_size=1, use_messages=False): self.xmpp = xmpp self.sid = sid self.block_size = block_size self.window_size = window_size self.use_messages = use_messages - self.receiver = to - self.sender = ifrom + if jid is None: + jid = xmpp.boundjid + self.self_jid = jid + self.peer_jid = peer self.send_seq = -1 self.recv_seq = -1 @@ -50,8 +52,8 @@ class IBBytestream(object): seq = self.send_seq if self.use_messages: msg = self.xmpp.Message() - msg['to'] = self.receiver - msg['from'] = self.sender + msg['to'] = self.peer_jid + msg['from'] = self.self_jid msg['id'] = self.xmpp.new_id() msg['ibb_data']['sid'] = self.sid msg['ibb_data']['seq'] = seq @@ -61,8 +63,8 @@ class IBBytestream(object): else: iq = self.xmpp.Iq() iq['type'] = 'set' - iq['to'] = self.receiver - iq['from'] = self.sender + iq['to'] = self.peer_jid + iq['from'] = self.self_jid iq['ibb_data']['sid'] = self.sid iq['ibb_data']['seq'] = seq iq['ibb_data']['data'] = data @@ -121,8 +123,8 @@ class IBBytestream(object): def close(self): iq = self.xmpp.Iq() iq['type'] = 'set' - iq['to'] = self.receiver - iq['from'] = self.sender + iq['to'] = self.peer_jid + iq['from'] = self.self_jid iq['ibb_close']['sid'] = self.sid self.stream_out_closed.set() iq.send(block=False, @@ -132,9 +134,6 @@ class IBBytestream(object): def _closed(self, iq): self.stream_in_closed.set() self.stream_out_closed.set() - while not self.window_empty.is_set(): - log.info('waiting for send window to empty') - self.window_empty.wait(timeout=1) iq.reply() iq.send() self.xmpp.event('ibb_stream_end', self) |