# HG changeset patch # User Emmanuel Gil Peyrot # Date 1327590097 -3600 # Node ID b7d52bf259e0130e51eaa37f8b2754255321064d # Parent 7fcccf59e6ec3aa23d32a698a64766518265bd27 Coding style: always use "" for XML strings. diff --git a/lightstring.js b/lightstring.js --- a/lightstring.js +++ b/lightstring.js @@ -35,13 +35,13 @@ var Lightstring = { stream: { open: function(aService) { //FIXME no ending "/" - node-xmpp-bosh bug - return ""; + return ""; }, close: function() { - return ''; + return ""; } } }, @@ -98,8 +98,8 @@ Lightstring.Connection = function(aServi //FIXME support SCRAM-SHA1 && allow specify method preferences if ('DIGEST-MD5' in mechanisms) that.send( - "" + "" ); else if ('PLAIN' in mechanisms) { var token = btoa( @@ -110,8 +110,8 @@ Lightstring.Connection = function(aServi that.password ); that.send( - "" + token + '' + "" + token + "" ); } } @@ -120,15 +120,15 @@ Lightstring.Connection = function(aServi that.emit('features', stanza); //Bind http://xmpp.org/rfcs/rfc3920.html#bind that.send( - "\ - \ - ", + "" + + "" + + "", function() { //Session http://xmpp.org/rfcs/rfc3921.html#session that.send( - "\ - \ - ", + "" + + "" + + "", function() { that.emit('connected'); } @@ -138,10 +138,10 @@ Lightstring.Connection = function(aServi }); this.on('success', function(stanza, that) { that.send( - "" + "" ); }); this.on('failure', function(stanza, that) { @@ -186,9 +186,8 @@ Lightstring.Connection = function(aServi } var digest_uri = 'xmpp/' + that.host; - if (host !== null) { + if (host !== null) digest_uri = digest_uri + '/' + host; - } var A1 = MD5.hash(that.node + ':' + realm + ':' + that.password) + ':' + nonce + ':' + cnonce; @@ -209,9 +208,9 @@ Lightstring.Connection = function(aServi MD5.hexdigest(A2))) + ','; responseText += 'charset="utf-8"'; that.send( - "" - + btoa(responseText) + - ''); + "" + + btoa(responseText) + + ""); }); }; Lightstring.Connection.prototype = { @@ -303,9 +302,8 @@ Lightstring.Connection.prototype = { if (aCallback) this.on(elm.getAttribute('id'), aCallback); } - else if (aCallback) { + else if (aCallback) this.emit('warning', 'Callback can\'t be called with non-iq stanza.'); - } this.socket.send(str);