Class: Vines::Stream::Server::Outbound::Authoritative
- Inherits:
-
Vines::Stream::State
- Object
- Vines::Stream::State
- Vines::Stream::Server::Outbound::Authoritative
- Defined in:
- lib/vines/stream/server/outbound/authoritative.rb
Constant Summary
Constants included from Node
Instance Attribute Summary
Attributes inherited from Vines::Stream::State
Instance Method Summary collapse
-
#initialize(stream, success = nil) ⇒ Authoritative
constructor
A new instance of Authoritative.
- #node(node) ⇒ Object
Methods inherited from Vines::Stream::State
Methods included from Node
body?, namespace, stream?, to_stanza
Methods included from Log
Constructor Details
#initialize(stream, success = nil) ⇒ Authoritative
Returns a new instance of Authoritative.
11 12 13 |
# File 'lib/vines/stream/server/outbound/authoritative.rb', line 11 def initialize(stream, success=nil) super end |
Instance Method Details
#node(node) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/vines/stream/server/outbound/authoritative.rb', line 15 def node(node) raise StreamErrors::NotAuthorized unless (node) case node[TYPE] when VALID @inbound.write("<db:result xmlns:db='#{NAMESPACES[:legacy_dialback]}' " \ "from='#{node[TO]}' to='#{node[FROM]}' type='#{node[TYPE]}'/>") @inbound.advance(Server::Ready.new(@inbound)) @inbound.notify_connected when INVALID @inbound.write("<db:result xmlns:db='#{NAMESPACES[:legacy_dialback]}' " \ "from='#{node[TO]}' to='#{node[FROM]}' type='#{node[TYPE]}'/>") @inbound.close_connection_after_writing else @inbound.write("<db:result xmlns:db='#{NAMESPACES[:legacy_dialback]}' " \ "from='#{node[TO]}' to='#{node[FROM]}' type='#{ERROR}'>" \ "<error type='cancel'><item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>" \ "</error></db:result>") @inbound.close_connection_after_writing end stream.close_connection end |