changeset 11:f4422eafb0f8

Make forms building actually working.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 02 Nov 2011 10:02:31 -0700
parents 360186772aa3
children d67380657687
files forms.js
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/forms.js
+++ b/forms.js
@@ -19,7 +19,7 @@
 
 'use strict';
 
-var xmpp = require('xmpp')
+var Element = require('ltx').Element;
 
 var parseBoolean = function(b) {
 	if (b == 'true' || b == 'True' || b == 'TRUE' || b == '1')
@@ -27,8 +27,10 @@ var parseBoolean = function(b) {
 	return false;
 }
 
-exports.build = function(type, desc, content, labels, title, instructions) {
-	var x = xmpp.stanza('x', {xmlns: 'jabber:x:data', type: type});
+var forms = exports || {};
+
+forms.build = function(type, desc, content, labels, title, instructions) {
+	var x = Element('x', {xmlns: 'jabber:x:data', type: type});
 
 	if (desc._TITLE)
 		x.c('title').t(desc._TITLE).up();
@@ -90,7 +92,7 @@ exports.build = function(type, desc, con
 	return x;
 }
 
-exports.parse = function(x, params) {
+forms.parse = function(x, params) {
 	var form = {};
 
 	x.constructor.prototype.getAttribute = function(a) {