Class: Blather::Stream::TLS

Inherits:
Features show all
Defined in:
lib/blather/stream/features/tls.rb

Overview

:nodoc:

Defined Under Namespace

Classes: TLSFailure

Constant Summary collapse

TLS_NS =
'urn:ietf:params:xml:ns:xmpp-tls'.freeze

Instance Method Summary collapse

Methods inherited from Features

#fail!, from_namespace, #initialize, #next!, register, #succeed!

Constructor Details

This class inherits a constructor from Blather::Stream::Features

Instance Method Details

#receive_data(stanza) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/blather/stream/features/tls.rb', line 12

def receive_data(stanza)
  case stanza.element_name
  when 'starttls'
    @stream.send "<starttls xmlns='#{TLS_NS}'/>"
  when 'proceed'
    @stream.start_tls
    @stream.start
#        succeed!
  else
    fail! TLSFailure.new
  end
end