comparison modules/mod_configure.js @ 41:bc717575e66a

Much better handling of modules.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 20 Feb 2011 15:51:12 +0100
parents 6697f394301f
children 023f767662d3
comparison
equal deleted inserted replaced
40:741110cdcfcf 41:bc717575e66a
1 var config = require('../configuration');
2 var storage = require('../storage');
3 var forms = require('../forms');
4 var errors = require('../errors');
5 var makeError = errors.makeError;
6 var toBareJID = require('../fdsq').toBareJID;
7 var NS = require('../namespaces');
8
9 // SECTION 8.2: Configure a Node 1 // SECTION 8.2: Configure a Node
10 exports.getConfigure = { 2 exports.getConfigure = {
11 type: 'get', 3 type: 'get',
12 child: 'pubsub', 4 child: 'pubsub',
13 ns: NS.PUBSUB_OWNER, 5 ns: NS.PUBSUB_OWNER,
28 20
29 var conf = storage.getConfiguration(nodeID); 21 var conf = storage.getConfiguration(nodeID);
30 if (!conf) 22 if (!conf)
31 return makeError(response, 42); // FIXME 23 return makeError(response, 42); // FIXME
32 24
33 response.c('pubsub', {xmlns: NS.PUBSUB_OWNER}); 25 response.c('pubsub', {xmlns: NS.PUBSUB_OWNER})
34 response.c('configure', {node: nodeID}); 26 .c('configure', {node: nodeID});
35 27
36 var form = forms.build('form', 'node_config', conf, true); 28 var form = forms.build('form', 'node_config', conf, true);
37 response.cnode(form); 29 response.cnode(form);
38 30
39 return response; 31 return response;
48 child2: 'default', 40 child2: 'default',
49 func: function(response) { 41 func: function(response) {
50 if (!config.enabled('config-node')) 42 if (!config.enabled('config-node'))
51 return makeError(response, errors.owner.default_options.node_configuration_not_supported.n); 43 return makeError(response, errors.owner.default_options.node_configuration_not_supported.n);
52 44
53 response.c('pubsub', {xmlns: NS.PUBSUB_OWNER}); 45 response.c('pubsub', {xmlns: NS.PUBSUB_OWNER})
54 response.c('default'); 46 .c('default');
55 47
56 var form = forms.build('node_config', service_configuration.node_config, null, true); 48 var form = forms.build('node_config', service_configuration.node_config, null, true);
57 response.cnode(form); 49 response.cnode(form);
58 50
59 return response; 51 return response;