Class: Vines::Stream::Server::Start
- Inherits:
-
Vines::Stream::State
- Object
- Vines::Stream::State
- Vines::Stream::Server::Start
- Defined in:
- lib/vines/stream/server/start.rb
Constant Summary collapse
- FROM =
"from".freeze
Constants included from Node
Instance Attribute Summary
Attributes inherited from Vines::Stream::State
Instance Method Summary collapse
-
#initialize(stream, success = AuthMethod) ⇒ Start
constructor
A new instance of Start.
- #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 = AuthMethod) ⇒ Start
Returns a new instance of Start.
9 10 11 |
# File 'lib/vines/stream/server/start.rb', line 9 def initialize(stream, success=AuthMethod) super end |
Instance Method Details
#node(node) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/vines/stream/server/start.rb', line 13 def node(node) raise StreamErrors::NotAuthorized unless stream?(node) stream.start(node) doc = Document.new features = doc.create_element('stream:features', 'xmlns:stream' => NAMESPACES[:stream]) do |el| unless stream.dialback_retry? el << doc.create_element('starttls') do |tls| tls.default_namespace = NAMESPACES[:tls] tls << doc.create_element('required') if force_s2s_encryption? end end el << doc.create_element('dialback') do |db| db.default_namespace = NAMESPACES[:dialback] end end stream.write(features) advance end |