# HG changeset patch # User Emmanuel Gil Peyrot # Date 1299540147 -3600 # Node ID 3e0ca96d2dcef0aea7e2d0863413127f96da508d # Parent 023f767662d3c4cee0ffb5a48f370d45b747974f Fix an error in strict mode. diff --git a/psgxs.js b/psgxs.js --- 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) {