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 9 9: def initialize(stream, session_id, initiator_jid, target_jid) 10: # Target and Initiator are swapped here, because we're the target 11: super(stream, session_id, target_jid, initiator_jid) 12: end
Wait for the initiator side to start the stream.
# File lib/xmpp4r/bytestreams/helper/ibb/target.rb, line 17 17: def accept 18: connect_lock = Mutex.new 19: connect_lock.lock 20: 21: @stream.add_iq_callback(200, self) { |iq| 22: open = iq.first_element('open') 23: if iq.type == :set and iq.from == @peer_jid and iq.to == @my_jid and open and open.attributes['sid'] == @session_id 24: @stream.delete_iq_callback(self) 25: activate 26: @block_size = (open.attributes['block-size'] || 4096).to_i 27: 28: reply = iq.answer(false) 29: reply.type = :result 30: @stream.send(reply) 31: 32: connect_lock.unlock 33: true 34: else 35: false 36: end 37: } 38: 39: connect_lock.lock 40: connect_lock.unlock 41: true 42: end