lib/vines/stream/server/auth_method.rb in diaspora-vines-0.2.0.develop.3 vs lib/vines/stream/server/auth_method.rb in diaspora-vines-0.2.0.develop.4
- old
+ new
@@ -38,24 +38,11 @@
stream.write(FAILURE)
stream.write('</stream:stream>')
stream.close_connection_after_writing
end
elsif dialback_result?(node)
- begin
- Vines::Stream::Server.start(stream.config, node[FROM], node[TO], true) do |authoritative|
- if authoritative
- # will be closed in outbound/authoritative.rb
- authoritative.write("<db:verify from='#{node[TO]}' id='#{stream.id}' to='#{node[FROM]}'>#{node.text}</db:verify>")
- end
- end
- # We need to be discoverable for the dialback connection
- stream.router << stream
- rescue StanzaErrors::RemoteServerNotFound => e
- stream.write("<db:result from='#{node[TO]}' to='#{node[FROM]}' " \
- "type='error'><error type='cancel'><item-not-found " \
- "xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></db:result>")
- stream.close_connection_after_writing
- end
+ # open a new connection and verify the dialback key
+ stream.authoritative_dialback(node)
else
raise StreamErrors::NotAuthorized
end
end