Mercurial > psgxs
changeset 44:3e0ca96d2dce
Fix an error in strict mode.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Tue, 08 Mar 2011 00:22:27 +0100 |
parents | 023f767662d3 |
children | 8b20f2efb939 |
files | psgxs.js |
diffstat | 1 files changed, 18 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/psgxs.js +++ b/psgxs.js @@ -79,7 +79,7 @@ function onIq(stanza) { else response = xmpp.iq({to: to, from: from, type: 'result'}); - var send = false; + var send = {}; for (var i in stanza.tags) { var child1 = stanza.tags[i]; @@ -105,11 +105,11 @@ function onIq(stanza) { if (module.number && (module.number != j)) continue; - var toSend = module.func(response, stanza, child2, to, from); - if (toSend) { - response = toSend; - send = true; - delete toSend; + send.response = module.func(response, stanza, child2, to, from); + if (send.response) { + response = send.response; + send.good = true; + delete send.response; } } } @@ -132,17 +132,17 @@ function onIq(stanza) { if (module.number && (module.number != k)) continue; - var toSend = module.func(response, stanza, child1, to, from); - if (toSend) { - response = toSend; - send = true; - delete toSend; + send.response = module.func(response, stanza, child1, to, from); + if (send.response) { + response = send.response; + send.good = true; + delete send.response; } } } } - conn.send(send? response: makeError(response, errors.feature_not_implemented.n)); + conn.send(send.good? response: makeError(response, errors.feature_not_implemented.n)); } function onMessage(stanza) { @@ -178,16 +178,17 @@ function onMessage(stanza) { if (module.number && (module.number != k)) continue; - var toSend = module.func(response, stanza, child, to, from); - if (toSend) { - response = toSend; - send = true; - delete toSend; + send.response = module.func(response, stanza, child, to, from); + if (send.response) { + response = send.response; + send.good = true; + delete send.response; } } } conn.send(send? response: makeError(response, errors.feature_not_implemented.n)); + return; var x = stanza.getChild('x', 'jabber:x:data'); if (x) {