49 local type, cond, text = response:get_error(); |
49 local type, cond, text = response:get_error(); |
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 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 |
61 |
62 end |
62 end |
63 end |
63 end |
64 stream:hook("opened", handle_opened); |
64 stream:hook("opened", handle_opened); |
65 end |
65 end |