Mercurial > eldonilo > lightstring
comparison plugins/disco.js @ 76:0b8e7ca19f83
Plugins init functions are now called with Lightstring.Connection scope.
author | Sonny Piers <sonny.piers@gmail.com> |
---|---|
date | Mon, 06 Feb 2012 18:02:02 +0100 |
parents | 5dbf93cef55d |
children | 50d36b093e3a |
comparison
equal
deleted
inserted
replaced
75:619f3ffa125a | 76:0b8e7ca19f83 |
---|---|
129 for (var i = 0; i < arguments.length; i++) | 129 for (var i = 0; i < arguments.length; i++) |
130 features.push(arguments[i]); | 130 features.push(arguments[i]); |
131 } | 131 } |
132 }, | 132 }, |
133 init: function() { | 133 init: function() { |
134 conn.on('iq/' + Lightstring.ns['disco#info'] + ':query', function(stanza) { | 134 this.on('iq/' + Lightstring.ns['disco#info'] + ':query', function(stanza) { |
135 if (stanza.DOM.getAttributeNS(null, 'type') !== 'get') | 135 if (stanza.DOM.getAttributeNS(null, 'type') !== 'get') |
136 return false; | 136 return false; |
137 | 137 |
138 var query = stanza.DOM.firstChild; | 138 var query = stanza.DOM.firstChild; |
139 if (query.getAttributeNS(null, 'node')) { | 139 if (query.getAttributeNS(null, 'node')) { |
140 var response = "<iq to='" + stanza.DOM.getAttributeNS(null, 'from') + "'" + | 140 var response = "<iq to='" + stanza.DOM.getAttributeNS(null, 'from') + "'" + |
141 " id='" + stanza.DOM.getAttributeNS(null, 'id') + "'" + | 141 " id='" + stanza.DOM.getAttributeNS(null, 'id') + "'" + |
142 " type='error'/>"; //TODO: precise the error. | 142 " type='error'/>"; //TODO: precise the error. |
143 conn.send(response); | 143 this.send(response); |
144 return true; | 144 return true; |
145 } | 145 } |
146 | 146 |
147 var res = "<iq to='" + stanza.DOM.getAttributeNS(null, 'from') + "'" + | 147 var res = "<iq to='" + stanza.DOM.getAttributeNS(null, 'from') + "'" + |
148 " id='" + stanza.DOM.getAttributeNS(null, 'id') + "'" + | 148 " id='" + stanza.DOM.getAttributeNS(null, 'id') + "'" + |
165 }); | 165 }); |
166 | 166 |
167 res += "</query>" + | 167 res += "</query>" + |
168 "</iq>"; | 168 "</iq>"; |
169 | 169 |
170 conn.send(res); | 170 this.send(res); |
171 return true; | 171 return true; |
172 }); | 172 }); |
173 } | 173 } |
174 }; | 174 }; |
175 })(); | 175 })(); |