Sha256: e6bcbc96a93405826241bb5339d99fc6d2f26701ff599bd34dc0de54ab51262a

Contents?: true

Size: 804 Bytes

Versions: 8

Compression:

Stored size: 804 Bytes

Contents

module Blather
class Stream

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

    def receive(node) # :nodoc:
      if node.element_name == 'handshake'
        @client.post_init
      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

8 entries across 8 versions & 2 rubygems

Version Path
sprsquish-blather-0.3.1 lib/blather/stream/component.rb
sprsquish-blather-0.3.2 lib/blather/stream/component.rb
sprsquish-blather-0.3.3 lib/blather/stream/component.rb
sprsquish-blather-0.3.4 lib/blather/stream/component.rb
blather-0.3.1 lib/blather/stream/component.rb
blather-0.3.4 lib/blather/stream/component.rb
blather-0.3.3 lib/blather/stream/component.rb
blather-0.3.2 lib/blather/stream/component.rb