plugins/legacy.lua

changeset 381
65533afab352
parent 380
0891b4e27766
child 457
73d4eb93657b
equal deleted inserted replaced
380:0891b4e27766 381:65533afab352
2 local uuid = require "util.uuid".generate; 2 local uuid = require "util.uuid".generate;
3 3
4 local xmlns_auth = "jabber:iq:auth"; 4 local xmlns_auth = "jabber:iq:auth";
5 5
6 function verse.plugins.legacy(stream) 6 function verse.plugins.legacy(stream)
7 function handle_auth_form(result) 7 local function handle_auth_form(result)
8 local query = result:get_child("query", xmlns_auth); 8 local query = result:get_child("query", xmlns_auth);
9 if result.attr.type ~= "result" or not query then 9 if result.attr.type ~= "result" or not query then
10 local type, cond, text = result:get_error(); 10 local type, cond, text = result:get_error();
11 stream:debug("warn", "%s %s: %s", type, cond, text); 11 stream:debug("warn", "%s %s: %s", type, cond, text);
12 --stream:event("authentication-failure", { condition = cond }); 12 --stream:event("authentication-failure", { condition = cond });
50 stream:event("authentication-failure", { condition = cond }); 50 stream:event("authentication-failure", { condition = cond });
51 end 51 end
52 end); 52 end);
53 end 53 end
54 54
55 function handle_opened(attr) 55 local function handle_opened(attr)
56 if not attr.version then 56 if not attr.version then
57 stream:send_iq(verse.iq({type="get"}) 57 stream:send_iq(verse.iq({type="get"})
58 :tag("query", { xmlns = "jabber:iq:auth" }) 58 :tag("query", { xmlns = "jabber:iq:auth" })
59 :tag("username"):text(stream.username), 59 :tag("username"):text(stream.username),
60 handle_auth_form); 60 handle_auth_form);
61
62 end 61 end
63 end 62 end
64 stream:hook("opened", handle_opened); 63 stream:hook("opened", handle_opened);
65 end 64 end

mercurial