Mercurial > eldonilo > lightstring
comparison lightstring.js @ 78:4d0fc1c9ec88
Call iq-callbacks success/error with the right context.
author | Sonny Piers <sonny.piers@gmail.com> |
---|---|
date | Tue, 07 Feb 2012 18:36:14 +0100 |
parents | 7854e036a572 |
children | 2290321f5c8b |
comparison
equal
deleted
inserted
replaced
77:7854e036a572 | 78:4d0fc1c9ec88 |
---|---|
233 if (type !== 'result' && type !== 'error') | 233 if (type !== 'result' && type !== 'error') |
234 return; //TODO: warning | 234 return; //TODO: warning |
235 | 235 |
236 var callback = Conn.callbacks[id]; | 236 var callback = Conn.callbacks[id]; |
237 if (type === 'result' && callback.success) | 237 if (type === 'result' && callback.success) |
238 callback.success(stanza); | 238 callback.success.call(Conn, stanza); |
239 else if (type === 'error' && callback.error) | 239 else if (type === 'error' && callback.error) |
240 callback.error(stanza); | 240 callback.error.call(Conn, stanza); |
241 | 241 |
242 delete Conn.callbacks[id]; | 242 delete Conn.callbacks[id]; |
243 } | 243 } |
244 | 244 |
245 else if (name === 'presence' || name === 'message') { | 245 else if (name === 'presence' || name === 'message') { |
272 if (!id) | 272 if (!id) |
273 ; //TODO: warning | 273 ; //TODO: warning |
274 else | 274 else |
275 this.callbacks[id] = callback; | 275 this.callbacks[id] = callback; |
276 | 276 |
277 } else if (aSuccess || aError) | 277 this.callbacks[id] = callback; |
278 | |
279 } | |
280 else if (aSuccess || aError) | |
278 ; //TODO: warning (no callback without iq) | 281 ; //TODO: warning (no callback without iq) |
279 | 282 |
280 | 283 |
281 //FIXME this.socket.send(stanza.XML); (need some work on Lightstring.Stanza) | 284 //FIXME this.socket.send(stanza.XML); (need some work on Lightstring.Stanza) |
282 var fixme = Lightstring.DOM2XML(stanza.DOM); | 285 var fixme = Lightstring.DOM2XML(stanza.DOM); |