Class: Blather::Stream::Component
Constant Summary
collapse
- NAMESPACE =
'jabber:component:accept'
STREAM_NS
Instance Attribute Summary
#authcid, #jid, #password
Instance Method Summary
collapse
connect, #connection_completed, #initialize, #post_init, #receive_data, #ssl_verify_peer, start, #unbind
Instance Method Details
#cleanup ⇒ Object
30
31
32
33
|
# File 'lib/blather/stream/component.rb', line 30
def cleanup
@parser.finish if @parser
super
end
|
#receive(node) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/blather/stream/component.rb', line 8
def receive(node)
if node.element_name == 'handshake'
ready!
else
super
end
if node.document.find_first('/stream:stream[not(stream:error)]', :xmlns => NAMESPACE, :stream => STREAM_NS)
send "<handshake>#{Digest::SHA1.hexdigest(node['id']+@password)}</handshake>"
end
end
|
#send(stanza) ⇒ Object
20
21
22
23
|
# File 'lib/blather/stream/component.rb', line 20
def send(stanza)
stanza.from ||= self.jid if stanza.respond_to?(:from) && stanza.respond_to?(:from=)
super stanza
end
|
#start ⇒ Object
25
26
27
28
|
# File 'lib/blather/stream/component.rb', line 25
def start
@parser = Parser.new self
send "<stream:stream to='#{@jid}' xmlns='#{NAMESPACE}' xmlns:stream='#{STREAM_NS}'>"
end
|