Class: Jabber::Bytestreams::IBBInitiator

Inherits:
IBB
  • Object
show all
Defined in:
lib/xmpp4r/bytestreams/helper/ibb/initiator.rb

Overview

Implementation of IBB at the initiator side

Constant Summary

Constants inherited from IBB

Jabber::Bytestreams::IBB::NS_IBB

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from IBB

#active?, #close, #flush, #initialize, #read, #write

Constructor Details

This class inherits a constructor from Jabber::Bytestreams::IBB

Instance Attribute Details

#block_sizeObject

You may set the block-size before open


11
12
13
# File 'lib/xmpp4r/bytestreams/helper/ibb/initiator.rb', line 11

def block_size
  @block_size
end

Instance Method Details

#openObject

Open the stream to the peer, waits for successful result

May throw ErrorException


18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/xmpp4r/bytestreams/helper/ibb/initiator.rb', line 18

def open
  iq = Iq.new(:set, @peer_jid)
  open = iq.add REXML::Element.new('open')
  open.add_namespace IBB::NS_IBB
  open.attributes['sid'] = @session_id
  open.attributes['block-size'] = @block_size

  @stream.send_with_id(iq) { |answer|
    answer.type == :result
  }

  activate
end