module Blather class Stream class Component < Stream NAMESPACE = 'jabber:component:accept' def receive(node) # :nodoc: if node.element_name == 'handshake' ready! else super end if node.document.find_first('/stream:stream[not(stream:error)]', :xmlns => NAMESPACE, :stream => STREAM_NS) send("#{Digest::SHA1.hexdigest(@node['id']+@password)}") end end def send(stanza) stanza.from ||= self.jid if stanza.respond_to?(:from) && stanza.respond_to?(:from=) super stanza end def start @parser = Parser.new self start_stream = <<-STREAM STREAM send start_stream.gsub(/\s+/, ' ') end end #Client end #Stream end #Blather