# HG changeset patch # User Emmanuel Gil Peyrot # Date 1327612631 -3600 # Node ID 119ceb121908f943cedab89e473f9d2dae6a3988 # Parent 99bf2bdcfd96d0e57cda931f5635e93b05a22568 Bind the correct JID received. diff --git a/lightstring.js b/lightstring.js --- a/lightstring.js +++ b/lightstring.js @@ -119,21 +119,27 @@ Lightstring.Connection = function(aServi else { that.emit('features', stanza); //Bind http://xmpp.org/rfcs/rfc3920.html#bind - that.send( + var bind = "" + - "" + - "", - function() { - //Session http://xmpp.org/rfcs/rfc3921.html#session - that.send( - "" + - "" + - "", - function() { - that.emit('connected'); - } - ); - }); + "" + + (that.jid.resource? "" + that.jid.resource + "": "") + + "" + + ""; + that.send( + bind, + function(stanza) { + //Session http://xmpp.org/rfcs/rfc3921.html#session + that.jid = new Lightstring.JID(stanza.textContent); + that.send( + "" + + "" + + "", + function() { + that.emit('connected'); + } + ); + } + ); } }); this.on('success', function(stanza, that) {