# HG changeset patch # User Matthew Wild # Date 1370711829 -3600 # Node ID 0d8fb22404c3d26f2964877e0fe20914d2ff4712 # Parent 7aed4bc4949c67d6bfea23bc4a5eedae3256e9a8 plugins.register: Support submitting email when registering an account diff -r 7aed4bc4949c -r 0d8fb22404c3 plugins/register.lua --- a/plugins/register.lua Sat Jun 08 17:43:41 2013 +0100 +++ b/plugins/register.lua Sat Jun 08 18:17:09 2013 +0100 @@ -5,11 +5,14 @@ function verse.plugins.register(stream) local function handle_features(features_stanza) if features_stanza:get_child("register", "http://jabber.org/features/iq-register") then - stream:send_iq(verse.iq({ to = stream.host_, type = "set" }) + local request = verse.iq({ to = stream.host_, type = "set" }) :tag("query", { xmlns = xmlns_register }) :tag("username"):text(stream.username):up() - :tag("password"):text(stream.password):up() - , function (result) + :tag("password"):text(stream.password):up(); + if stream.register_email then + request:tag("email"):text(stream.register_email):up(); + end + stream:send_iq(request, function (result) if result.attr.type == "result" then stream:event("registration-success"); else