Software /
code /
verse
Comparison
plugins/sasl.lua @ 380:0891b4e27766
Discard trailing whitespace
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 01 May 2015 23:27:29 +0200 |
parent | 360:ac3940bad1bf |
child | 395:e86144a4eaa1 |
comparison
equal
deleted
inserted
replaced
379:d80d27234e38 | 380:0891b4e27766 |
---|---|
46 auth_stanza:text(base64(initial_data)); | 46 auth_stanza:text(base64(initial_data)); |
47 end | 47 end |
48 stream:send(auth_stanza); | 48 stream:send(auth_stanza); |
49 return true; | 49 return true; |
50 end | 50 end |
51 | 51 |
52 local function handle_sasl(sasl_stanza) | 52 local function handle_sasl(sasl_stanza) |
53 if sasl_stanza.name == "failure" then | 53 if sasl_stanza.name == "failure" then |
54 local err = sasl_stanza.tags[1]; | 54 local err = sasl_stanza.tags[1]; |
55 local text = sasl_stanza:get_child_text("text"); | 55 local text = sasl_stanza:get_child_text("text"); |
56 stream:event("authentication-failure", { condition = err.name, text = text }); | 56 stream:event("authentication-failure", { condition = err.name, text = text }); |
69 else | 69 else |
70 stream:send(verse.stanza("response", { xmlns = xmlns_sasl }):text(base64(ok))); | 70 stream:send(verse.stanza("response", { xmlns = xmlns_sasl }):text(base64(ok))); |
71 end | 71 end |
72 return true; | 72 return true; |
73 end | 73 end |
74 | 74 |
75 stream:hook("stream-features", handle_features, 300); | 75 stream:hook("stream-features", handle_features, 300); |
76 stream:hook("stream/"..xmlns_sasl, handle_sasl); | 76 stream:hook("stream/"..xmlns_sasl, handle_sasl); |
77 | 77 |
78 return true; | 78 return true; |
79 end | 79 end |
80 | 80 |