Mercurial > eldonilo > lightstring
comparison lightstring.js @ 23:99bf2bdcfd96
Emit an iq/namespace:tag event for each iq containing a payload.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Thu, 26 Jan 2012 22:16:26 +0100 |
parents | 6a6bb8ded046 |
children | 119ceb121908 |
comparison
equal
deleted
inserted
replaced
22:6a6bb8ded046 | 23:99bf2bdcfd96 |
---|---|
261 that.emit('XMLInput', e.data); | 261 that.emit('XMLInput', e.data); |
262 var elm = Lightstring.xml2dom(e.data); | 262 var elm = Lightstring.xml2dom(e.data); |
263 that.emit('DOMInput', elm); | 263 that.emit('DOMInput', elm); |
264 that.emit(elm.tagName, elm); | 264 that.emit(elm.tagName, elm); |
265 | 265 |
266 if (elm.tagName === 'iq') | 266 if (elm.tagName === 'iq') { |
267 var payload = elm.firstChild; | |
268 if (payload) | |
269 that.emit('iq/' + payload.namespaceURI + ':' + payload.localName, elm); | |
267 that.emit(elm.getAttribute('id'), elm); //FIXME: possible attack vector. | 270 that.emit(elm.getAttribute('id'), elm); //FIXME: possible attack vector. |
271 } | |
268 }); | 272 }); |
269 }, | 273 }, |
270 /** | 274 /** |
271 * @function Send a message. | 275 * @function Send a message. |
272 * @param {String|Object} aStanza The message to send. | 276 * @param {String|Object} aStanza The message to send. |