comparison lightstring.js @ 24:119ceb121908

Bind the correct JID received.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 26 Jan 2012 22:17:11 +0100
parents 99bf2bdcfd96
children b6e4bc19ff5a
comparison
equal deleted inserted replaced
23:99bf2bdcfd96 24:119ceb121908
117 } 117 }
118 //XMPP features 118 //XMPP features
119 else { 119 else {
120 that.emit('features', stanza); 120 that.emit('features', stanza);
121 //Bind http://xmpp.org/rfcs/rfc3920.html#bind 121 //Bind http://xmpp.org/rfcs/rfc3920.html#bind
122 var bind =
123 "<iq type='set' xmlns='jabber:client'>" +
124 "<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>" +
125 (that.jid.resource? "<resource>" + that.jid.resource + "</resource>": "") +
126 "</bind>" +
127 "</iq>";
122 that.send( 128 that.send(
123 "<iq type='set' xmlns='jabber:client'>" + 129 bind,
124 "<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>" + 130 function(stanza) {
125 "</iq>", 131 //Session http://xmpp.org/rfcs/rfc3921.html#session
126 function() { 132 that.jid = new Lightstring.JID(stanza.textContent);
127 //Session http://xmpp.org/rfcs/rfc3921.html#session 133 that.send(
128 that.send( 134 "<iq type='set' xmlns='jabber:client'>" +
129 "<iq type='set' xmlns='jabber:client'>" + 135 "<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>" +
130 "<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>" + 136 "</iq>",
131 "</iq>", 137 function() {
132 function() { 138 that.emit('connected');
133 that.emit('connected'); 139 }
134 } 140 );
135 ); 141 }
136 }); 142 );
137 } 143 }
138 }); 144 });
139 this.on('success', function(stanza, that) { 145 this.on('success', function(stanza, that) {
140 that.send( 146 that.send(
141 "<stream:stream to='" + that.jid.domain + "'" + 147 "<stream:stream to='" + that.jid.domain + "'" +