Przeglądaj źródła

Merge pull request #169 from jitsi/kick-fix

Kick fix
dev1
hristoterezov 9 lat temu
rodzic
commit
63d909d074
2 zmienionych plików z 14 dodań i 5 usunięć
  1. 13
    4
      modules/xmpp/ChatRoom.js
  2. 1
    1
      modules/xmpp/moderator.js

+ 13
- 4
modules/xmpp/ChatRoom.js Wyświetl plik

@@ -412,10 +412,19 @@ ChatRoom.prototype.setSubject = function (subject) {
412 412
     this.connection.send(msg);
413 413
 };
414 414
 
415
-
416
-ChatRoom.prototype.onParticipantLeft = function (jid) {
415
+/**
416
+ * Called when participant leaves.
417
+ * @param jid the jid of the participant that leaves
418
+ * @param skipEvents optional params to skip any events, including check
419
+ * whether this is the focus that left
420
+ */
421
+ChatRoom.prototype.onParticipantLeft = function (jid, skipEvents) {
417 422
 
418 423
     delete this.lastPresences[jid];
424
+
425
+    if(skipEvents)
426
+        return;
427
+
419 428
     this.eventEmitter.emit(XMPPEvents.MUC_MEMBER_LEFT, jid);
420 429
 
421 430
     this.moderator.onMucMemberLeft(jid);
@@ -443,7 +452,7 @@ ChatRoom.prototype.onPresenceUnavailable = function (pres, from) {
443 452
     // Status code 110 indicates that this notification is "self-presence".
444 453
     if (!$(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]').length) {
445 454
         delete this.members[from];
446
-        this.onParticipantLeft(from);
455
+        this.onParticipantLeft(from, false);
447 456
     }
448 457
     // If the status code is 110 this means we're leaving and we would like
449 458
     // to remove everyone else from our view, so we trigger the event.
@@ -451,7 +460,7 @@ ChatRoom.prototype.onPresenceUnavailable = function (pres, from) {
451 460
         for (var i in this.members) {
452 461
             var member = this.members[i];
453 462
             delete this.members[i];
454
-            this.onParticipantLeft(member);
463
+            this.onParticipantLeft(i, member.isFocus);
455 464
         }
456 465
     }
457 466
     if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="307"]').length) {

+ 1
- 1
modules/xmpp/moderator.js Wyświetl plik

@@ -74,7 +74,7 @@ Moderator.prototype.isSipGatewayEnabled =  function () {
74 74
 Moderator.prototype.onMucMemberLeft =  function (jid) {
75 75
     logger.info("Someone left is it focus ? " + jid);
76 76
     var resource = Strophe.getResourceFromJid(jid);
77
-    if (resource === 'focus' && !this.xmppService.sessionTerminated) {
77
+    if (resource === 'focus') {
78 78
         logger.info(
79 79
             "Focus has left the room - leaving conference");
80 80
         this.eventEmitter.emit(XMPPEvents.FOCUS_LEFT);

Ładowanie…
Anuluj
Zapisz