|
|
@@ -173,7 +173,10 @@ ChatRoom.prototype.sendPresence = function (fromJoin) {
|
|
173
|
173
|
}
|
|
174
|
174
|
};
|
|
175
|
175
|
|
|
176
|
|
-
|
|
|
176
|
+/**
|
|
|
177
|
+ * Sends the presence unavailable, signaling the server
|
|
|
178
|
+ * we want to leave the room.
|
|
|
179
|
+ */
|
|
177
|
180
|
ChatRoom.prototype.doLeave = function () {
|
|
178
|
181
|
logger.log("do leave", this.myroomjid);
|
|
179
|
182
|
var pres = $pres({to: this.myroomjid, type: 'unavailable' });
|
|
|
@@ -490,10 +493,10 @@ ChatRoom.prototype.onPresenceUnavailable = function (pres, from) {
|
|
490
|
493
|
reason = reasonSelect.text();
|
|
491
|
494
|
}
|
|
492
|
495
|
|
|
493
|
|
- this.leave();
|
|
|
496
|
+ this._dispose();
|
|
494
|
497
|
|
|
495
|
498
|
this.eventEmitter.emit(XMPPEvents.MUC_DESTROYED, reason);
|
|
496
|
|
- delete this.connection.emuc.rooms[Strophe.getBareJidFromJid(from)];
|
|
|
499
|
+ this.connection.emuc.doLeave(this.roomjid);
|
|
497
|
500
|
return true;
|
|
498
|
501
|
}
|
|
499
|
502
|
|
|
|
@@ -510,10 +513,14 @@ ChatRoom.prototype.onPresenceUnavailable = function (pres, from) {
|
|
510
|
513
|
delete this.members[i];
|
|
511
|
514
|
this.onParticipantLeft(i, member.isFocus);
|
|
512
|
515
|
}
|
|
|
516
|
+ this.connection.emuc.doLeave(this.roomjid);
|
|
|
517
|
+ this.eventEmitter.emit(XMPPEvents.MUC_LEFT);
|
|
513
|
518
|
}
|
|
|
519
|
+
|
|
514
|
520
|
if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="307"]').length) {
|
|
515
|
521
|
if (this.myroomjid === from) {
|
|
516
|
|
- this.leave(true);
|
|
|
522
|
+ this._dispose();
|
|
|
523
|
+ this.connection.emuc.doLeave(this.roomjid);
|
|
517
|
524
|
this.eventEmitter.emit(XMPPEvents.KICKED);
|
|
518
|
525
|
}
|
|
519
|
526
|
}
|
|
|
@@ -946,16 +953,20 @@ ChatRoom.prototype.onMute = function (iq) {
|
|
946
|
953
|
|
|
947
|
954
|
/**
|
|
948
|
955
|
* Leaves the room. Closes the jingle session.
|
|
949
|
|
- * @parama voidSendingPresence avoids sending the presence when leaving
|
|
950
|
956
|
*/
|
|
951
|
|
-ChatRoom.prototype.leave = function (avoidSendingPresence) {
|
|
|
957
|
+ChatRoom.prototype.leave = function () {
|
|
|
958
|
+ this._dispose();
|
|
|
959
|
+ this.doLeave();
|
|
|
960
|
+};
|
|
|
961
|
+
|
|
|
962
|
+/**
|
|
|
963
|
+ * Disposes the conference, closes the jingle session.
|
|
|
964
|
+ */
|
|
|
965
|
+ChatRoom.prototype._dispose = function () {
|
|
952
|
966
|
if (this.session) {
|
|
953
|
967
|
this.session.close();
|
|
954
|
968
|
}
|
|
955
|
969
|
this.eventEmitter.emit(XMPPEvents.DISPOSE_CONFERENCE);
|
|
956
|
|
- if(!avoidSendingPresence)
|
|
957
|
|
- this.doLeave();
|
|
958
|
|
- this.connection.emuc.doLeave(this.roomjid);
|
|
959
|
970
|
};
|
|
960
|
971
|
|
|
961
|
972
|
module.exports = ChatRoom;
|