|
|
@@ -123,12 +123,13 @@ ChatRoom.prototype.join = function (password) {
|
|
123
|
123
|
};
|
|
124
|
124
|
|
|
125
|
125
|
ChatRoom.prototype.sendPresence = function (fromJoin) {
|
|
126
|
|
- if (!this.presMap['to'] || (!this.joined && !fromJoin)) {
|
|
|
126
|
+ var to = this.presMap['to'];
|
|
|
127
|
+ if (!to || (!this.joined && !fromJoin)) {
|
|
127
|
128
|
// Too early to send presence - not initialized
|
|
128
|
129
|
return;
|
|
129
|
130
|
}
|
|
130
|
131
|
|
|
131
|
|
- var pres = $pres({to: this.presMap['to'] });
|
|
|
132
|
+ var pres = $pres({to: to });
|
|
132
|
133
|
pres.c('x', {xmlns: this.presMap['xns']});
|
|
133
|
134
|
|
|
134
|
135
|
if (this.password) {
|
|
|
@@ -138,13 +139,22 @@ ChatRoom.prototype.sendPresence = function (fromJoin) {
|
|
138
|
139
|
pres.up();
|
|
139
|
140
|
|
|
140
|
141
|
// Send XEP-0115 'c' stanza that contains our capabilities info
|
|
141
|
|
- if (this.connection.caps) {
|
|
142
|
|
- this.connection.caps.node = this.xmpp.options.clientNode;
|
|
143
|
|
- pres.c('c', this.connection.caps.generateCapsAttrs()).up();
|
|
|
142
|
+ var connection = this.connection;
|
|
|
143
|
+ var caps = connection.caps;
|
|
|
144
|
+ if (caps) {
|
|
|
145
|
+ caps.node = this.xmpp.options.clientNode;
|
|
|
146
|
+ pres.c('c', caps.generateCapsAttrs()).up();
|
|
144
|
147
|
}
|
|
145
|
148
|
|
|
146
|
149
|
parser.JSON2packet(this.presMap.nodes, pres);
|
|
147
|
|
- this.connection.send(pres);
|
|
|
150
|
+ connection.send(pres);
|
|
|
151
|
+ if (fromJoin) {
|
|
|
152
|
+ // XXX We're pressed for time here because we're beginning a complex
|
|
|
153
|
+ // and/or lengthy conference-establishment process which supposedly
|
|
|
154
|
+ // involves multiple RTTs. We don't have the time to wait for Strophe to
|
|
|
155
|
+ // decide to send our IQ.
|
|
|
156
|
+ connection.flush();
|
|
|
157
|
+ }
|
|
148
|
158
|
};
|
|
149
|
159
|
|
|
150
|
160
|
|