plugins.register: Support submitting email when registering an account

Sat, 08 Jun 2013 18:17:09 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 08 Jun 2013 18:17:09 +0100
changeset 343
0d8fb22404c3
parent 342
7aed4bc4949c
child 344
ea668c47e1bd

plugins.register: Support submitting email when registering an account

plugins/register.lua file | annotate | diff | comparison | revisions
--- 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

mercurial