| Class | Jabber::Bytestreams::IBBTarget |
| In: |
lib/xmpp4r/bytestreams/helper/ibb/target.rb
|
| Parent: | IBB |
| block_size | [R] | You may read the block-size after accept |
# File lib/xmpp4r/bytestreams/helper/ibb/target.rb, line 13
13: def initialize(stream, session_id, initiator_jid, target_jid)
14: # Target and Initiator are swapped here, because we're the target
15: super(stream, session_id, target_jid, initiator_jid)
16: end
Wait for the initiator side to start the stream.
# File lib/xmpp4r/bytestreams/helper/ibb/target.rb, line 21
21: def accept
22: connect_sem = Semaphore.new
23:
24: @stream.add_iq_callback(200, self) { |iq|
25: open = iq.first_element('open')
26: if iq.type == :set and iq.from == @peer_jid and iq.to == @my_jid and open and open.attributes['sid'] == @session_id
27: @stream.delete_iq_callback(self)
28: activate
29: @block_size = (open.attributes['block-size'] || 4096).to_i
30:
31: reply = iq.answer(false)
32: reply.type = :result
33: @stream.send(reply)
34:
35: connect_sem.run
36: true
37: else
38: false
39: end
40: }
41:
42: connect_sem.wait
43: true
44: end