Mercurial > eldonilo > lightstring
comparison lightstring.js @ 37:6773e5bc2ca0
several fixes
author | Sonny Piers <sonny.piers@gmail.com> |
---|---|
date | Mon, 30 Jan 2012 23:46:55 +0100 |
parents | 6ce66fba0242 |
children | 5e32481b8a92 |
comparison
equal
deleted
inserted
replaced
36:b43ca01b9f6f | 37:6773e5bc2ca0 |
---|---|
326 return; | 326 return; |
327 | 327 |
328 if (stanza.DOM.tagName === 'iq') { | 328 if (stanza.DOM.tagName === 'iq') { |
329 var id = stanza.DOM.getAttribute('id'); | 329 var id = stanza.DOM.getAttribute('id'); |
330 //TODO: This should be done by a plugin | 330 //TODO: This should be done by a plugin |
331 if (!id) { | 331 if (!id) |
332 stanza.DOM.setAttribute('id', Lightstring.newId('sendiq:')); | 332 stanza.DOM.setAttribute('id', Lightstring.newId('sendiq:')); |
333 } | |
334 if (aCallback) | 333 if (aCallback) |
335 this.on(stanza.DOM.getAttribute('id'), aCallback); | 334 this.on(stanza.DOM.getAttribute('id'), aCallback); |
336 } | 335 } |
337 else if (aCallback) { | 336 else if (aCallback) { |
338 this.emit('warning', 'Callback can\'t be called with non-iq stanza.'); | 337 this.emit('warning', 'Callback can\'t be called with non-iq stanza.'); |
339 } | 338 } |
340 | 339 |
341 | 340 |
342 //TODO this.socket.send(stanza.XML); (need some work on Lightstring.Stanza) | 341 //TODO this.socket.send(stanza.XML); (need some work on Lightstring.Stanza) |
343 this.socket.send(Lightstring.DOM2XML(stanza.DOM)); | 342 var fixme = Lightstring.DOM2XML(stanza.DOM); |
343 stanza.XML = fixme; | |
344 this.socket.send(fixme); | |
344 this.emit('output', stanza); | 345 this.emit('output', stanza); |
345 }, | 346 }, |
346 /** | 347 /** |
347 * @function Closes the XMPP stream and the socket. | 348 * @function Closes the XMPP stream and the socket. |
348 */ | 349 */ |