Sha256: 5b81514b2c63d451a5276d9a650f6eadb54c322fd2f7c0cd8ddbba00331ee969

Contents?: true

Size: 815 Bytes

Versions: 2

Compression:

Stored size: 815 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.namespaces.find_by_href('http://etherx.jabber.org/streams') && node.find_first('/stream:stream[not(stream:error)]')
        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

2 entries across 2 versions & 2 rubygems

Version Path
sprsquish-blather-0.3.0 lib/blather/stream/component.rb
blather-0.3.0 lib/blather/stream/component.rb