Mercurial > psgxs
annotate modules/mod_disco.js @ 58:b98e545a94f7 default tip
Always use children instead of tags. Might break something.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Tue, 13 Sep 2011 00:54:55 +0200 |
parents | addbf6bbfaa8 |
children |
rev | line source |
---|---|
43
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
1 /* |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
2 * Copyright (C) 2010 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
3 * |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
4 * This file is part of PSĜS, a PubSub server written in JavaScript. |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
5 * |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
6 * PSĜS is free software: you can redistribute it and/or modify |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
7 * it under the terms of the GNU Affero General Public License as |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
8 * published by the Free Software Foundation, either version 3 of the |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
9 * License. |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
10 * |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
11 * PSĜS is distributed in the hope that it will be useful, |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
14 * GNU Affero General Public License for more details. |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
15 * |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
16 * You should have received a copy of the GNU Affero General Public License |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
17 * along with PSĜS. If not, see <http://www.gnu.org/licenses/>. |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
18 */ |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
19 |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
20 'use strict'; |
023f767662d3
Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
42
diff
changeset
|
21 |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
22 // SECTION 5.1: Discover Features |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
23 exports.disco_info = { |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
24 type: 'get', |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
25 child: 'query', |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
26 ns: NS.DISCO_INFO, |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
27 func: function(response, stanza, request) { |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
28 var nodeID = request.getAttribute('node'); |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
29 |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
30 // SECTION 5.3: Discover Node Information |
57
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
31 if (nodeID) { |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
32 if (!storage.existsNode(nodeID)) |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
33 return makeError(response, errors.node_does_not_exist.n); |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
34 |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
35 var conf = storage.getConfiguration(nodeID); |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
36 if (typeof conf == 'number') |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
37 return makeError(response, conf); |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
38 |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
39 var type = 'leaf' |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
40 if (conf['pubsub#node_type']) |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
41 type = conf['pubsub#node_type']; |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
42 |
57
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
43 var query = new Element('query', {xmlns: NS.DISCO_INFO, node: nodeID}) |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
44 .c('identity', {category: 'pubsub', type: type}).up() |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
45 .c('feature', {'var': NS.PUBSUB}).up(); |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
46 |
57
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
47 response.cnode(query); |
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
48 |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
49 // SECTION 5.4 |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
50 if (config.enabled('meta-data')) { |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
51 var x = forms.build('result', 'node_metadata', storage.getMetadata(nodeID), true); |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
52 if (x) |
57
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
53 query.cnode(x); |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
54 } |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
55 |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
56 // SECTION 5.1: Discover Features |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
57 } else { |
56
99bd1d1ac071
Migration to node-xmpp, done!
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
52
diff
changeset
|
58 var query = new Element('query', {xmlns: NS.DISCO_INFO}) |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
59 .c('identity', {category: 'pubsub', type: 'service', name: 'PubSub JavaScript Server'}).up() |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
60 .c('feature', {'var': NS.DISCO_INFO}).up() |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
61 .c('feature', {'var': NS.DISCO_ITEMS}).up() |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
62 .c('feature', {'var': NS.PUBSUB}).up() |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
63 .c('feature', {'var': 'jabber:iq:version'}).up() |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
64 .c('feature', {'var': NS.COMMANDS}).up(); |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
65 |
56
99bd1d1ac071
Migration to node-xmpp, done!
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
52
diff
changeset
|
66 response.cnode(query); |
99bd1d1ac071
Migration to node-xmpp, done!
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
52
diff
changeset
|
67 |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
68 for (var i in config.activated) |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
69 if (typeof i == 'string') |
56
99bd1d1ac071
Migration to node-xmpp, done!
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
52
diff
changeset
|
70 query.c('feature', {'var': 'http://jabber.org/protocol/pubsub#' + config.activated[i]}).up(); |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
71 } |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
72 |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
73 return response; |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
74 } |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
75 } |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
76 |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
77 // SECTION 5.2: Discover Nodes |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
78 exports.disco_items = { |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
79 type: 'get', |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
80 child: 'query', |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
81 ns: NS.DISCO_ITEMS, |
42
07ca0263a53f
Add an option to hide non-accessible nodes.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
41
diff
changeset
|
82 func: function(response, stanza, request, to) { |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
83 var children; |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
84 var nodeID = request.getAttribute('node'); |
57
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
85 if (nodeID && nodeID !== '') { |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
86 if (nodeID == NS.COMMANDS) { |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
87 // XEP-0050: Ad-Hoc Commands |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
88 |
57
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
89 var query = new Element('query', {xmlns: NS.DISCO_ITEMS, node: nodeID}) |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
90 .c('item', {jid: config.jid, node: 'ping', name: 'Ping'}).up() |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
91 .c('item', {jid: config.jid, node: 'reload', name: 'Reload'}).up(); |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
92 |
57
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
93 response.cnode(query); |
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
94 |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
95 return response; |
57
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
96 } |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
97 |
57
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
98 if (!storage.existsNode(nodeID)) |
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
99 return makeError(response, errors.node_does_not_exist.n); |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
100 |
57
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
101 var query = new Element('query', {xmlns: NS.DISCO_ITEMS, node: nodeID}); |
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
102 response.cnode(query); |
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
103 |
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
104 children = storage.getChildren(nodeID); |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
105 if (typeof children == 'number') |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
106 return makeError(response, children); |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
107 } |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
108 |
57
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
109 var query = new Element('query', {xmlns: NS.DISCO_ITEMS}); |
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
110 response.cnode(query); |
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
111 |
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
112 children = storage.getChildren(); |
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
113 if (typeof children == 'number') |
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
114 return makeError(response, children); |
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
115 |
42
07ca0263a53f
Add an option to hide non-accessible nodes.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
41
diff
changeset
|
116 for (var nodeID in children) { |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
117 var attr = {jid: config.jid}; |
42
07ca0263a53f
Add an option to hide non-accessible nodes.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
41
diff
changeset
|
118 if (children[nodeID] == 'node') { |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
119 if (config.enabled('meta-data')) { |
42
07ca0263a53f
Add an option to hide non-accessible nodes.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
41
diff
changeset
|
120 var metadata = storage.getMetadata(nodeID); |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
121 if (metadata['pubsub#title']) |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
122 attr.name = metadata['pubsub#title']; |
42
07ca0263a53f
Add an option to hide non-accessible nodes.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
41
diff
changeset
|
123 |
57
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
124 if (metadata['pubsub#creator']) |
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
125 attr.creator = metadata['pubsub#creator']; |
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
126 |
42
07ca0263a53f
Add an option to hide non-accessible nodes.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
41
diff
changeset
|
127 if (config.hideNonAccessibleNodes) { |
07ca0263a53f
Add an option to hide non-accessible nodes.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
41
diff
changeset
|
128 var configuration = storage.getConfiguration(nodeID); |
07ca0263a53f
Add an option to hide non-accessible nodes.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
41
diff
changeset
|
129 if (configuration['pubsub#access_model'] == 'whitelist') { |
07ca0263a53f
Add an option to hide non-accessible nodes.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
41
diff
changeset
|
130 var affils = storage.getAffiliationsFromNodeID(nodeID); |
47
0d3f18bb1d36
Remove usage of fdsq.js in modules.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
43
diff
changeset
|
131 var affil = affils[JID.toBare(to)]; |
42
07ca0263a53f
Add an option to hide non-accessible nodes.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
41
diff
changeset
|
132 if (!affil || affil == 'outcast') |
07ca0263a53f
Add an option to hide non-accessible nodes.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
41
diff
changeset
|
133 continue; |
07ca0263a53f
Add an option to hide non-accessible nodes.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
41
diff
changeset
|
134 } |
07ca0263a53f
Add an option to hide non-accessible nodes.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
41
diff
changeset
|
135 } |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
136 } |
42
07ca0263a53f
Add an option to hide non-accessible nodes.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
41
diff
changeset
|
137 attr.node = nodeID; |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
138 |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
139 // SECTION 5.5: Discover Items for a Node |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
140 } else |
42
07ca0263a53f
Add an option to hide non-accessible nodes.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
41
diff
changeset
|
141 attr.name = nodeID; |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
142 |
57
addbf6bbfaa8
Various fixes for the migration to ltx.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
56
diff
changeset
|
143 query.c('item', attr).up(); |
24
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
144 } |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
145 |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
146 return response; |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
147 } |
b80ab94da447
Add new modules files.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
148 } |