Class: Blather::Stream::TLS

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

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!, #feature?, from_namespace, #initialize, #next!, register, #succeed!

Constructor Details

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

Instance Method Details

#receive_data(stanza) ⇒ Object



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

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