Pārlūkot izejas kodu

Fixes few issues with kicking participant.

If in the presence there is 110 and 307 status codes there was an error in processing. When kicked the other participants were not cleared from the conference. Firing an event for focus leaving the conference when we are kicked.
master
damencho 9 gadus atpakaļ
vecāks
revīzija
339c472dcd
1 mainītis faili ar 13 papildinājumiem un 4 dzēšanām
  1. 13
    4
      modules/xmpp/ChatRoom.js

+ 13
- 4
modules/xmpp/ChatRoom.js Parādīt failu

@@ -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) {

Notiek ielāde…
Atcelt
Saglabāt