Class: Vines::Stream::Client::AuthRestart
- Defined in:
- lib/vines/stream/client/auth_restart.rb
Direct Known Subclasses
Constant Summary
Constants inherited from State
Instance Attribute Summary
Attributes inherited from State
Instance Method Summary collapse
-
#initialize(stream, success = Auth) ⇒ AuthRestart
constructor
A new instance of AuthRestart.
- #node(node) ⇒ Object
Methods inherited from State
Methods included from Log
Constructor Details
#initialize(stream, success = Auth) ⇒ AuthRestart
Returns a new instance of AuthRestart.
7 8 9 |
# File 'lib/vines/stream/client/auth_restart.rb', line 7 def initialize(stream, success=Auth) super end |
Instance Method Details
#node(node) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/vines/stream/client/auth_restart.rb', line 11 def node(node) raise StreamErrors::NotAuthorized unless stream?(node) stream.start(node) doc = Document.new features = doc.create_element('stream:features') do |el| el << doc.create_element('mechanisms') do |parent| parent.default_namespace = NAMESPACES[:sasl] stream.authentication_mechanisms.each do |name| parent << doc.create_element('mechanism', name) end end end stream.write(features) advance end |