Mercurial > eldonilo > lightstring
annotate plugins/disco.js @ 68:e1ccfb580228
Replaces that by Conn.
author | Sonny Piers <sonny.piers@gmail.com> |
---|---|
date | Thu, 02 Feb 2012 00:00:34 +0100 |
parents | bcb5b7c2c3d3 |
children | fdd1ae375067 |
rev | line source |
---|---|
30
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
1 'use strict'; |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
2 |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
3 /** |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
4 Copyright (c) 2011, Sonny Piers <sonny at fastmail dot net> |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
5 |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
6 Permission to use, copy, modify, and/or distribute this software for any |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
7 purpose with or without fee is hereby granted, provided that the above |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
8 copyright notice and this permission notice appear in all copies. |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
9 |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
13 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
17 */ |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
18 |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
19 ///////// |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
20 //Disco// |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
21 ///////// |
45
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
22 Lightstring.plugins['disco'] = { |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
23 namespaces: { |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
24 'disco#info': "http://jabber.org/protocol/disco#info", |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
25 'disco#items': "http://jabber.org/protocol/disco#items" |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
26 }, |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
27 stanzas: { |
55
aaad98b33f86
Fix syntax errors.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
45
diff
changeset
|
28 'disco#items': function(aTo, aNode) { |
45
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
29 if(aTo) |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
30 var iq = "<iq type='get' to='"+aTo+"'>"; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
31 else |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
32 var iq = "<iq type='get'>"; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
33 |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
34 if(aNode) |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
35 var query = "<query xmlns='"+Lightstring.NS['disco#items']+"' node='"+aNode+"'/>"; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
36 else |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
37 var query = "<query xmlns='"+Lightstring.NS['disco#items']+"'/>"; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
38 |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
39 return iq+query+"</iq>"; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
40 }, |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
41 'disco#info': function(aTo, aNode) { |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
42 if(aTo) |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
43 var iq = "<iq type='get' to='"+aTo+"'>"; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
44 else |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
45 var iq = "<iq type='get'>"; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
46 if(aNode) |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
47 var query = "<query xmlns='"+Lightstring.NS['disco#info']+"' node='"+aNode+"'/>"; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
48 else |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
49 var query = "<query xmlns='"+Lightstring.NS['disco#info']+"'/>"; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
50 |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
51 return iq+query+"</iq>"; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
52 } |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
53 }, |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
54 handlers: { |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
55 //TODO: fix that handler. |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
56 /*conn.on('iq/' + Lightstring.NS['disco#info'] + ':query', function(stanza) { |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
57 if (stanza.DOM.getAttributeNS(null, 'type') !== 'get') |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
58 return; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
59 |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
60 var query = stanza.DOM.firstChild; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
61 if (query.getAttributeNS(null, 'node')) { |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
62 var response = "<iq to='" + stanza.DOM.getAttributeNS(null, 'from') + "'" + |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
63 " id='" + stanza.DOM.getAttributeNS(null, 'id') + "'" + |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
64 " type='error'/>"; //TODO: precise the error. |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
65 conn.send(response); |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
66 return; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
67 } |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
68 |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
69 var features = [Lightstring.NS.sxe, Lightstring.NS.jingle.transports.sxe]; //TODO: put that elsewhere. |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
70 |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
71 var response = "<iq to='" + stanza.DOM.getAttributeNS(null, 'from') + "'" + |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
72 " id='" + stanza.DOM.getAttributeNS(null, 'id') + "'" + |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
73 " type='result'>" + |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
74 "<query xmlns='" + Lightstring.NS['disco#info'] + "'>" + |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
75 "<identity category='client' type='browser'/>"; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
76 features.forEach(function(f) { |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
77 response += "<feature var='" + f + "'/>"; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
78 }); |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
79 response += "</query>" + |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
80 "</iq>"; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
81 |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
82 conn.send(response); |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
83 });*/ |
30
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
84 }, |
45
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
85 methods: { |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
86 discoItems: function(aTo, aResult, aError) { |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
87 this.send(Lightstring.stanzas.disco.items(aTo), function (stanza) { |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
88 var items = []; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
89 |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
90 var children = stanza.DOM.firstChild.childNodes; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
91 var length = children.length; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
92 |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
93 for (var i = 0; i < length; i++) { |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
94 var node = children[i]; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
95 if (node.localName !== 'item') |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
96 continue; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
97 |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
98 var item = { |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
99 jid: node.getAttributeNS(null, 'jid'), |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
100 name: node.getAttributeNS(null, 'name'), |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
101 node: node.getAttributeNS(null, 'node') |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
102 }; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
103 items.push(item); |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
104 } |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
105 |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
106 stanza.items = items; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
107 |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
108 if (aResult) |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
109 aResult(stanza); |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
110 }, aError); |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
111 }, |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
112 discoInfo: function(aTo, aNode, aResult, aError) { |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
113 this.send(Lightstring.stanzas.disco.info(aTo, aNode), function(stanza){ |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
114 var identities = []; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
115 var features = []; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
116 var fields = {}; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
117 |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
118 var children = stanza.DOM.firstChild.childNodes; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
119 var length = children.length; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
120 |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
121 for (var i = 0; i < length; i++) { |
58
bcb5b7c2c3d3
Add a dataforms plugin and make disco#info use this one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
55
diff
changeset
|
122 var child = children[i]; |
bcb5b7c2c3d3
Add a dataforms plugin and make disco#info use this one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
55
diff
changeset
|
123 var ns = child.namespaceURI; |
bcb5b7c2c3d3
Add a dataforms plugin and make disco#info use this one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
55
diff
changeset
|
124 var name = child.localName; |
45
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
125 |
58
bcb5b7c2c3d3
Add a dataforms plugin and make disco#info use this one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
55
diff
changeset
|
126 if (ns === Lightstring.namespaces['disco#info'] && name === 'feature') |
bcb5b7c2c3d3
Add a dataforms plugin and make disco#info use this one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
55
diff
changeset
|
127 features.push(child.getAttributeNS(null, 'var')); |
45
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
128 |
58
bcb5b7c2c3d3
Add a dataforms plugin and make disco#info use this one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
55
diff
changeset
|
129 else if (ns === Lightstring.namespaces['disco#info'] && name === 'identity') { |
45
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
130 var identity = { |
58
bcb5b7c2c3d3
Add a dataforms plugin and make disco#info use this one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
55
diff
changeset
|
131 category: child.getAttributeNS(null, 'category'), |
bcb5b7c2c3d3
Add a dataforms plugin and make disco#info use this one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
55
diff
changeset
|
132 type: child.getAttributeNS(null, 'type') |
45
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
133 }; |
58
bcb5b7c2c3d3
Add a dataforms plugin and make disco#info use this one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
55
diff
changeset
|
134 var name = child.getAttributeNS(null, 'name'); |
45
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
135 if (name) |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
136 identity.name = name; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
137 identities.push(identity); |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
138 } |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
139 |
58
bcb5b7c2c3d3
Add a dataforms plugin and make disco#info use this one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
55
diff
changeset
|
140 else if (ns === Lightstring.namespaces['dataforms'] && name === 'x') |
bcb5b7c2c3d3
Add a dataforms plugin and make disco#info use this one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
55
diff
changeset
|
141 this.disco.parse(child); //TODO: check if that plugin is enabled. |
45
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
142 |
58
bcb5b7c2c3d3
Add a dataforms plugin and make disco#info use this one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
55
diff
changeset
|
143 else |
bcb5b7c2c3d3
Add a dataforms plugin and make disco#info use this one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
55
diff
changeset
|
144 ; //TODO: emit a warning. |
45
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
145 } |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
146 |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
147 stanza.identities = identities; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
148 stanza.features = features; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
149 stanza.fields = fields; |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
150 |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
151 if (aResult) |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
152 aResult(stanza); |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
153 }, aError); |
063e31247e71
Fix disco plugin.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
37
diff
changeset
|
154 } |
30
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
155 } |
1506992c33e2
Split plugins.js into multiple plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
156 }; |