Class: Blather::Stream::SASL
- Defined in:
- lib/blather/stream/features/sasl.rb
Defined Under Namespace
Modules: Anonymous, DigestMD5, Plain Classes: UnknownMechanism
Constant Summary collapse
- MECHANISMS =
%w[ digest-md5 plain anonymous ].freeze
- SASL_NS =
'urn:ietf:params:xml:ns:xmpp-sasl'.freeze
Instance Method Summary collapse
-
#initialize(stream, succeed, fail) ⇒ SASL
constructor
A new instance of SASL.
- #receive_data(stanza) ⇒ Object
Methods inherited from Features
#fail!, #feature?, from_namespace, register, #succeed!
Constructor Details
Instance Method Details
#receive_data(stanza) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/blather/stream/features/sasl.rb', line 26 def receive_data(stanza) @node = stanza case stanza.element_name when 'mechanisms' available_mechanisms = stanza.children.map { |m| m.content.downcase } @mechanisms = MECHANISMS.select { |m| available_mechanisms.include? m } next! when 'failure' next! when 'success' @stream.start else if self.respond_to?(stanza.element_name) self.__send__(stanza.element_name) else fail! UnknownResponse.new(stanza) end end end |