Class: Vines::Stream::Server::Ready

Inherits:
Vines::Stream::State show all
Defined in:
lib/vines/stream/server/ready.rb

Constant Summary

Constants inherited from Vines::Stream::State

Vines::Stream::State::BODY, Vines::Stream::State::STREAM

Instance Attribute Summary

Attributes inherited from Vines::Stream::State

#stream

Instance Method Summary collapse

Methods inherited from Vines::Stream::State

#==, #eql?, #hash, #initialize

Methods included from Log

#log

Constructor Details

This class inherits a constructor from Vines::Stream::State

Instance Method Details

#node(node) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/vines/stream/server/ready.rb', line 7

def node(node)
  stanza = to_stanza(node)
  raise StreamErrors::UnsupportedStanzaType unless stanza
  to, from = stanza.validate_to, stanza.validate_from
  raise StreamErrors::ImproperAddressing unless to && from
  raise StreamErrors::InvalidFrom unless from.domain == stream.remote_domain
  raise StreamErrors::HostUnknown unless to.domain == stream.domain
  stream.user = User.new(jid: from)
  if stanza.local? || stanza.to_pubsub_domain?
    stanza.process
  else
    stanza.route
  end
end