Class: Vines::Stream::Component::Ready

Inherits:
State
  • Object
show all
Defined in:
lib/vines/stream/component/ready.rb

Constant Summary

Constants inherited from State

State::BODY, State::STREAM

Instance Attribute Summary

Attributes inherited from State

#stream

Instance Method Summary collapse

Methods inherited from 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
# File 'lib/vines/stream/component/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
  stream.user = User.new(jid: from)
  if stanza.local? || stanza.to_pubsub_domain?
    stanza.process
  else
    stanza.route
  end
end