# HG changeset patch # User Emmanuel Gil Peyrot # Date 1328144382 -3600 # Node ID f12c759e4097aa75f9994bed54f07819b229b64c # Parent fdd1ae375067fda37fab22d68922e2074e05f342 Fix service-unavailable handler and errors stanzas. diff --git a/lightstring.js b/lightstring.js --- a/lightstring.js +++ b/lightstring.js @@ -43,12 +43,12 @@ var Lightstring = { } }, errors: { - iq: function(type, error) { - return "" + "" + - "<" + error + " xmlns='" + Lightstring.namespaces['xmpp_stanzas'] + "'/>" + //TODO: allow text content. + "<" + error + " xmlns='" + Lightstring.ns['xmpp_stanzas'] + "'/>" + //TODO: allow text content. //TODO: allow text and payload. "" + ""; @@ -346,7 +346,11 @@ Lightstring.Connection.prototype = { return; } - conn.send(Lightstring.stanzas.errors.iq('cancel', 'service-unavailable')); + if (aData && aData.DOM) { + var from = aData.DOM.getAttributeNS(null, 'from'); + var id = aData.DOM.getAttributeNS(null, 'id'); + this.send(Lightstring.stanzas.errors.iq(from, id, 'cancel', 'service-unavailable')); + } }, /** * @function Register an event handler.