116 opened: recontext(this, this._stream_opened), |
116 opened: recontext(this, this._stream_opened), |
117 stanza: recontext(this, this._handle_stanza), |
117 stanza: recontext(this, this._handle_stanza), |
118 closed: recontext(this, this._stream_closed) |
118 closed: recontext(this, this._stream_closed) |
119 }); |
119 }); |
120 |
120 |
|
121 this._uniqueId = 0; |
|
122 |
121 return this; |
123 return this; |
122 }; |
124 }; |
123 |
125 |
124 exports.Connection.prototype = { |
126 exports.Connection.prototype = { |
125 connect: function (jid, pass, callback) |
127 connect: function (jid, pass, callback) |
141 |
143 |
142 send: function (data) |
144 send: function (data) |
143 { |
145 { |
144 this.debug("SND: "+data); |
146 this.debug("SND: "+data); |
145 this.socket.send(data.toString()); |
147 this.socket.send(data.toString()); |
|
148 }, |
|
149 |
|
150 |
|
151 getUniqueId: function (suffix) |
|
152 { |
|
153 return ++this._uniqueId + (suffix?(":"+suffix):""); |
146 }, |
154 }, |
147 |
155 |
148 // Update the status of the connection, call connect_callback |
156 // Update the status of the connection, call connect_callback |
149 _setStatus: function (status, condition) |
157 _setStatus: function (status, condition) |
150 { |
158 { |