Sha256: d60df612bb856b1583f0819377de61fd0ac2eeae977e85542ae8c5daf37f31d4
Contents?: true
Size: 1001 Bytes
Versions: 21
Compression:
Stored size: 1001 Bytes
Contents
module Blather class Stream class Register < Features REGISTER_NS = "http://jabber.org/features/iq-register".freeze register REGISTER_NS def initialize(stream, succeed, fail) super @jid = @stream.jid @pass = @stream.password end def receive_data(stanza) error_node = stanza.xpath("//error").first if error_node fail!(BlatherError.new(stanza)) elsif stanza['type'] == 'result' && (stanza.content.empty? || stanza.children.find { |v| v.element_name == "query" }) succeed! else @stream.send register_query end end def register_query node = Blather::Stanza::Iq::Query.new(:set) query_node = node.xpath('//query').first query_node['xmlns'] = 'jabber:iq:register' Nokogiri::XML::Builder.with(query_node) do |xml| xml.username @jid.node xml.password @pass end node end end end end
Version data entries
21 entries across 21 versions & 2 rubygems