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
20
# File 'lib/vines/stream/component/ready.rb', line 7

def node(node)
  stanza = to_stanza(node)
  raise StreamErrors::UnsupportedStanzaType unless stanza
  to = (node['to'] || '').strip
  from = JID.new(node['from'] || '')
  raise StreamErrors::ImproperAddressing if to.empty? || from.domain != stream.remote_domain
  if stanza.local?
    stream.router.connected_resources(to).each do |recipient|
      recipient.write(node)
    end
  else
    stanza.route
  end
end