Mercurial > eldonilo > lightstring
diff 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 |
line wrap: on
line diff
--- a/lightstring.js +++ b/lightstring.js @@ -235,9 +235,9 @@ Lightstring.Connection.prototype = { var callback = Conn.callbacks[id]; if (type === 'result' && callback.success) - callback.success(stanza); + callback.success.call(Conn, stanza); else if (type === 'error' && callback.error) - callback.error(stanza); + callback.error.call(Conn, stanza); delete Conn.callbacks[id]; } @@ -274,7 +274,10 @@ Lightstring.Connection.prototype = { else this.callbacks[id] = callback; - } else if (aSuccess || aError) + this.callbacks[id] = callback; + + } + else if (aSuccess || aError) ; //TODO: warning (no callback without iq)