changeset 904:7648ee2d59d1

mod_service_directories: Use dataforms correctly
author Kim Alvefur <zash@zash.se>
date Mon, 04 Feb 2013 01:36:41 +0100
parents 8a1beff848c1
children eae665bc2122
files mod_service_directories/mod_service_directories.lua
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_service_directories/mod_service_directories.lua	Sun Jan 27 17:34:16 2013 +0100
+++ b/mod_service_directories/mod_service_directories.lua	Mon Feb 04 01:36:41 2013 +0100
@@ -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" } };