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_lock = Mutex.new 23: connect_lock.lock 24: 25: @stream.add_iq_callback(200, self) { |iq| 26: open = iq.first_element('open') 27: if iq.type == :set and iq.from == @peer_jid and iq.to == @my_jid and open and open.attributes['sid'] == @session_id 28: @stream.delete_iq_callback(self) 29: activate 30: @block_size = (open.attributes['block-size'] || 4096).to_i 31: 32: reply = iq.answer(false) 33: reply.type = :result 34: @stream.send(reply) 35: 36: connect_lock.unlock 37: true 38: else 39: false 40: end 41: } 42: 43: connect_lock.lock 44: connect_lock.unlock 45: true 46: end