Selaa lähdekoodia

fix(caps): features update event is not emitted.

dev1
Hristo Terezov 4 vuotta sitten
vanhempi
commit
1249681a0e
1 muutettua tiedostoa jossa 9 lisäystä ja 17 poistoa
  1. 9
    17
      JitsiConferenceEventManager.js

+ 9
- 17
JitsiConferenceEventManager.js Näytä tiedosto

76
         // else: there are no DataChannels in P2P session (at least for now)
76
         // else: there are no DataChannels in P2P session (at least for now)
77
     });
77
     });
78
 
78
 
79
+    chatRoom.addListener(XMPPEvents.PARTICIPANT_FEATURES_CHANGED, (from, features) => {
80
+        const participant = conference.getParticipantById(Strophe.getResourceFromJid(from));
81
+
82
+        if (participant) {
83
+            participant.setFeatures(features);
84
+            conference.eventEmitter.emit(JitsiConferenceEvents.PARTCIPANT_FEATURES_CHANGED, participant);
85
+        }
86
+    });
87
+
79
     chatRoom.addListener(
88
     chatRoom.addListener(
80
         XMPPEvents.ICE_RESTART_SUCCESS,
89
         XMPPEvents.ICE_RESTART_SUCCESS,
81
         (jingleSession, offerIq) => {
90
         (jingleSession, offerIq) => {
607
 JitsiConferenceEventManager.prototype.removeXMPPListeners = function() {
616
 JitsiConferenceEventManager.prototype.removeXMPPListeners = function() {
608
     const conference = this.conference;
617
     const conference = this.conference;
609
 
618
 
610
-    conference.xmpp.caps.removeListener(
611
-        XMPPEvents.PARTICIPANT_FEATURES_CHANGED,
612
-        this.xmppListeners[XMPPEvents.PARTICIPANT_FEATURES_CHANGED]);
613
-    delete this.xmppListeners[XMPPEvents.PARTICIPANT_FEATURES_CHANGED];
614
-
615
     Object.keys(this.xmppListeners).forEach(eventName => {
619
     Object.keys(this.xmppListeners).forEach(eventName => {
616
         conference.xmpp.removeListener(
620
         conference.xmpp.removeListener(
617
             eventName,
621
             eventName,
627
 JitsiConferenceEventManager.prototype.setupXMPPListeners = function() {
631
 JitsiConferenceEventManager.prototype.setupXMPPListeners = function() {
628
     const conference = this.conference;
632
     const conference = this.conference;
629
 
633
 
630
-    const featuresChangedListener = (from, features) => {
631
-        const participant = conference.getParticipantById(Strophe.getResourceFromJid(from));
632
-
633
-        if (participant) {
634
-            participant.setFeatures(features);
635
-            conference.eventEmitter.emit(JitsiConferenceEvents.PARTCIPANT_FEATURES_CHANGED, participant);
636
-        }
637
-    };
638
-
639
-    conference.xmpp.caps.addListener(XMPPEvents.PARTICIPANT_FEATURES_CHANGED, featuresChangedListener);
640
-    this.xmppListeners[XMPPEvents.PARTICIPANT_FEATURES_CHANGED] = featuresChangedListener;
641
-
642
     this._addConferenceXMPPListener(
634
     this._addConferenceXMPPListener(
643
         XMPPEvents.CALL_INCOMING,
635
         XMPPEvents.CALL_INCOMING,
644
         conference.onIncomingCall.bind(conference));
636
         conference.onIncomingCall.bind(conference));

Loading…
Peruuta
Tallenna