class Vines::Stream::Server::AuthRestart

Public Class Methods

new(stream, success=Auth) click to toggle source
Calls superclass method
# File lib/vines/stream/server/auth_restart.rb, line 7
def initialize(stream, success=Auth)
  super
end

Public Instance Methods

node(node) click to toggle source
# File lib/vines/stream/server/auth_restart.rb, line 11
def node(node)
  raise StreamErrors::NotAuthorized unless stream?(node)
  stream.start(node)
  doc = Document.new
  features = doc.create_element('stream:features')
  if stream.dialback_retry?
    if stream.vhost.force_s2s_encryption?
      stream.close_connection
      return
    end
    @success = AuthMethod
    features << doc.create_element('dialback') do |db|
      db.default_namespace = NAMESPACES[:dialback]
    end
  else
    features << doc.create_element('mechanisms') do |parent|
      parent.default_namespace = NAMESPACES[:sasl]
      stream.authentication_mechanisms.each do |name|
        parent << doc.create_element('mechanism', name)
      end
    end
  end
  stream.write(features)
  advance
end