Class: Blather::Stream::Client

Inherits:
Blather::Stream show all
Defined in:
lib/blather/stream/client.rb

Constant Summary collapse

LANG =
'en'
VERSION =
'1.0'
NAMESPACE =
'jabber:client'

Constants inherited from Blather::Stream

STREAM_NS

Instance Attribute Summary

Attributes inherited from Blather::Stream

#jid, #password

Instance Method Summary collapse

Methods inherited from Blather::Stream

connect, #connection_completed, #initialize, #post_init, #receive, #receive_data, #ssl_verify_peer, start, #unbind

Constructor Details

This class inherits a constructor from Blather::Stream

Instance Method Details

#send(stanza) ⇒ Object



24
25
26
27
# File 'lib/blather/stream/client.rb', line 24

def send(stanza)
  stanza.from = self.jid if stanza.is_a?(Stanza) && !stanza.from.nil?
  super stanza
end

#startObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/blather/stream/client.rb', line 10

def start
  @parser = Parser.new self
  start_stream = <<-STREAM
    <stream:stream
      to='#{@to}'
      xmlns='#{NAMESPACE}'
      xmlns:stream='#{STREAM_NS}'
      version='#{VERSION}'
      xml:lang='#{LANG}'
    >
  STREAM
  send start_stream.gsub(/\s+/, ' ')
end