Diff

mod_service_directories/mod_service_directories.lua @ 927:a9dfa7232d88

Merge
author Matthew Wild <mwild1@gmail.com>
date Tue, 12 Mar 2013 12:10:25 +0000
parent 904:7648ee2d59d1
child 1280:42625801d15a
line wrap: on
line diff
--- a/mod_service_directories/mod_service_directories.lua	Thu Nov 22 18:59:10 2012 +0000
+++ b/mod_service_directories/mod_service_directories.lua	Tue Mar 12 12:10:25 2013 +0000
@@ -14,6 +14,7 @@
 local adhoc_new = module:require "adhoc".new;
 local to_ascii = require "util.encodings".idna.to_ascii;
 local nameprep = require "util.encodings".stringprep.nameprep;
+local dataforms_new = require "util.dataforms".new;
 local pairs, ipairs = pairs, ipairs;
 local module = module;
 local hosts = hosts;
@@ -79,7 +80,7 @@
 -- Admin ad-hoc command to subscribe
 
 local function add_contact_handler(self, data, state)
-	local layout = {
+	local layout = dataforms_new{
 		title = "Adding a Server Buddy";
 		instructions = "Fill out this form to add a \"server buddy\".";
 
@@ -92,7 +93,7 @@
 	elseif data.action == "canceled" then
 		return { status = "canceled" };
 	else
-		local fields = layout:data(data);
+		local fields = layout:data(data.form);
 		local peerjid = nameprep(fields.peerjid);
 		if not peerjid or peerjid == "" or #peerjid > 1023 or not to_ascii(peerjid) then
 			return { status = "completed", error = { message = "Invalid JID" } };