tools/migration/prosody-migrator.lua: Refactor store handler loading to report errors...
[prosody.git] / plugins / mod_dialback.lua
index 9a1e28f95a5b88d76e22ed7806d978191cf1748d..8c80dce6a57e87cd3d6bf158ca889b1404b40ec2 100644 (file)
@@ -12,7 +12,6 @@ local send_s2s = require "core.s2smanager".send_to_host;
 local s2s_make_authenticated = require "core.s2smanager".make_authenticated;
 local s2s_initiate_dialback = require "core.s2smanager".initiate_dialback;
 local s2s_verify_dialback = require "core.s2smanager".verify_dialback;
-local s2s_destroy_session = require "core.s2smanager".destroy_session;
 
 local log = module._log;
 
@@ -126,18 +125,18 @@ module:hook("stanza/jabber:server:dialback:result", function(event)
                if stanza.attr.type == "valid" then
                        s2s_make_authenticated(origin, attr.from);
                else
-                       s2s_destroy_session(origin)
+                       origin:close("not-authorized", "dialback authentication failed");
                end
                return true;
        end
 end);
 
 module:hook_stanza(xmlns_stream, "features", function (origin, stanza)
-               s2s_initiate_dialback(origin);
-               return true;
-       end, 100);
+       s2s_initiate_dialback(origin);
+       return true;
+end, 100);
 
 -- Offer dialback to incoming hosts
 module:hook("s2s-stream-features", function (data)
-               data.features:tag("dialback", { xmlns='urn:xmpp:features:dialback' }):tag("optional"):up():up();
-       end);
+       data.features:tag("dialback", { xmlns='urn:xmpp:features:dialback' }):tag("optional"):up():up();
+end);