Sha256: c4be8b7320fb40ae565419cf07a4d2856f96b2454a86e03ceb8c51a882673568

Contents?: true

Size: 731 Bytes

Versions: 3

Compression:

Stored size: 731 Bytes

Contents

module Blather
class Stream

  class Component < Stream
    NAMESPACE = 'jabber:component:accept'

    def receive(node) # :nodoc:
      if node.element_name == 'handshake'
        @client.stream_started(self)
      else
        super
      end

      if node.element_name == 'stream:stream'
        send("<handshake>#{Digest::SHA1.hexdigest(@node['id']+@pass)}</handshake>")
      end
    end

  protected
    def start
      @parser = Parser.new self
      start_stream = <<-STREAM
        <stream:stream
          to='#{@jid}'
          xmlns='#{NAMESPACE}'
          xmlns:stream='http://etherx.jabber.org/streams'
        >
      STREAM
      send start_stream.gsub(/\s+/, ' ')
    end
  end #Client

end #Stream
end #Blather

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
sprsquish-blather-0.2.3 lib/blather/stream/component.rb
blather-0.2.2 lib/blather/stream/component.rb
blather-0.2.3 lib/blather/stream/component.rb