瀏覽代碼

feat: Adds to JitsiConferenceEvents CONFERENCE_JOIN_IN_PROGRESS. (#1754)

* feat: Adds to JitsiConferenceEvents CONFERENCE_JOIN_IN_PROGRESS.

* squash: Fixes tests.
release-8443
Дамян Минков 4 年之前
父節點
當前提交
75d3106544
No account linked to committer's email address
共有 5 個文件被更改,包括 44 次插入6 次删除
  1. 3
    0
      JitsiConferenceEventManager.js
  2. 5
    0
      JitsiConferenceEvents.js
  3. 12
    1
      modules/xmpp/ChatRoom.js
  4. 21
    5
      modules/xmpp/ChatRoom.spec.js
  5. 3
    0
      service/xmpp/XMPPEvents.js

+ 3
- 0
JitsiConferenceEventManager.js 查看文件

151
     this.chatRoomForwarder.forward(XMPPEvents.MUC_JOINED,
151
     this.chatRoomForwarder.forward(XMPPEvents.MUC_JOINED,
152
         JitsiConferenceEvents.CONFERENCE_JOINED);
152
         JitsiConferenceEvents.CONFERENCE_JOINED);
153
 
153
 
154
+    this.chatRoomForwarder.forward(XMPPEvents.MUC_JOIN_IN_PROGRESS,
155
+        JitsiConferenceEvents.CONFERENCE_JOIN_IN_PROGRESS);
156
+
154
     this.chatRoomForwarder.forward(XMPPEvents.MEETING_ID_SET,
157
     this.chatRoomForwarder.forward(XMPPEvents.MEETING_ID_SET,
155
         JitsiConferenceEvents.CONFERENCE_UNIQUE_ID_SET);
158
         JitsiConferenceEvents.CONFERENCE_UNIQUE_ID_SET);
156
 
159
 

+ 5
- 0
JitsiConferenceEvents.js 查看文件

30
  */
30
  */
31
 export const CONFERENCE_FAILED = 'conference.failed';
31
 export const CONFERENCE_FAILED = 'conference.failed';
32
 
32
 
33
+/**
34
+ * Indicates that conference is in progress of joining.
35
+ */
36
+export const CONFERENCE_JOIN_IN_PROGRESS = 'conference.join_in_progress';
37
+
33
 /**
38
 /**
34
  * Indicates that conference has been joined. The event does NOT provide any
39
  * Indicates that conference has been joined. The event does NOT provide any
35
  * parameters to its listeners.
40
  * parameters to its listeners.

+ 12
- 1
modules/xmpp/ChatRoom.js 查看文件

123
         this.presHandlers = {};
123
         this.presHandlers = {};
124
         this._removeConnListeners = [];
124
         this._removeConnListeners = [];
125
         this.joined = false;
125
         this.joined = false;
126
+        this.inProgressEmitted = false;
126
         this.role = null;
127
         this.role = null;
127
         this.focusMucJid = null;
128
         this.focusMucJid = null;
128
         this.noBridgeAvailable = false;
129
         this.noBridgeAvailable = false;
546
             }
547
             }
547
         }
548
         }
548
 
549
 
550
+        if (!this.joined && !this.inProgressEmitted) {
551
+            const now = this.connectionTimes['muc.join.started'] = window.performance.now();
552
+
553
+            logger.log('(TIME) MUC join started:\t', now);
554
+
555
+            this.eventEmitter.emit(XMPPEvents.MUC_JOIN_IN_PROGRESS);
556
+            this.inProgressEmitted = true;
557
+        }
558
+
549
         if (from === this.myroomjid) {
559
         if (from === this.myroomjid) {
550
             const newRole
560
             const newRole
551
                 = member.affiliation === 'owner' ? member.role : 'none';
561
                 = member.affiliation === 'owner' ? member.role : 'none';
1721
      * @param mediaType
1731
      * @param mediaType
1722
      */
1732
      */
1723
     muteParticipant(jid, mute, mediaType) {
1733
     muteParticipant(jid, mute, mediaType) {
1724
-        logger.info('set mute', mute);
1734
+        logger.info('set mute', mute, jid);
1725
         const iqToFocus = $iq(
1735
         const iqToFocus = $iq(
1726
             { to: this.focusMucJid,
1736
             { to: this.focusMucJid,
1727
                 type: 'set' })
1737
                 type: 'set' })
1796
         this._removeConnListeners = [];
1806
         this._removeConnListeners = [];
1797
 
1807
 
1798
         this.joined = false;
1808
         this.joined = false;
1809
+        this.inProgressEmitted = false;
1799
     }
1810
     }
1800
 
1811
 
1801
     /**
1812
     /**

+ 21
- 5
modules/xmpp/ChatRoom.spec.js 查看文件

161
             const pres = new DOMParser().parseFromString(presStr, 'text/xml').documentElement;
161
             const pres = new DOMParser().parseFromString(presStr, 'text/xml').documentElement;
162
 
162
 
163
             room.onPresence(pres);
163
             room.onPresence(pres);
164
-            expect(emitterSpy.calls.count()).toEqual(2);
164
+            expect(emitterSpy.calls.count()).toEqual(3);
165
             expect(emitterSpy.calls.argsFor(0)).toEqual([
165
             expect(emitterSpy.calls.argsFor(0)).toEqual([
166
                 XMPPEvents.PRESENCE_RECEIVED,
166
                 XMPPEvents.PRESENCE_RECEIVED,
167
                 jasmine.any(Object)
167
                 jasmine.any(Object)
168
             ]);
168
             ]);
169
             expect(emitterSpy.calls.argsFor(1)).toEqual([
169
             expect(emitterSpy.calls.argsFor(1)).toEqual([
170
+                XMPPEvents.MUC_JOIN_IN_PROGRESS
171
+            ]);
172
+            expect(emitterSpy.calls.argsFor(2)).toEqual([
170
                 XMPPEvents.MUC_MEMBER_JOINED,
173
                 XMPPEvents.MUC_MEMBER_JOINED,
171
                 'fromjid',
174
                 'fromjid',
172
                 undefined, // nick
175
                 undefined, // nick
192
             const pres = new DOMParser().parseFromString(presStr, 'text/xml').documentElement;
195
             const pres = new DOMParser().parseFromString(presStr, 'text/xml').documentElement;
193
 
196
 
194
             room.onPresence(pres);
197
             room.onPresence(pres);
195
-            expect(emitterSpy.calls.count()).toEqual(2);
198
+            expect(emitterSpy.calls.count()).toEqual(3);
196
             expect(emitterSpy.calls.argsFor(0)).toEqual([
199
             expect(emitterSpy.calls.argsFor(0)).toEqual([
197
                 XMPPEvents.PRESENCE_RECEIVED,
200
                 XMPPEvents.PRESENCE_RECEIVED,
198
                 jasmine.any(Object)
201
                 jasmine.any(Object)
199
             ]);
202
             ]);
203
+            expect(emitterSpy.calls.argsFor(1)).toEqual([
204
+                XMPPEvents.MUC_JOIN_IN_PROGRESS
205
+            ]);
206
+
200
             expect(emitterSpy).toHaveBeenCalledWith(
207
             expect(emitterSpy).toHaveBeenCalledWith(
201
                 XMPPEvents.MUC_MEMBER_JOINED,
208
                 XMPPEvents.MUC_MEMBER_JOINED,
202
                 'fromjid',
209
                 'fromjid',
223
             const pres = new DOMParser().parseFromString(presStr, 'text/xml').documentElement;
230
             const pres = new DOMParser().parseFromString(presStr, 'text/xml').documentElement;
224
 
231
 
225
             room.onPresence(pres);
232
             room.onPresence(pres);
226
-            expect(emitterSpy.calls.count()).toEqual(2);
233
+            expect(emitterSpy.calls.count()).toEqual(3);
227
             expect(emitterSpy.calls.argsFor(0)).toEqual([
234
             expect(emitterSpy.calls.argsFor(0)).toEqual([
228
                 XMPPEvents.PRESENCE_RECEIVED,
235
                 XMPPEvents.PRESENCE_RECEIVED,
229
                 jasmine.any(Object)
236
                 jasmine.any(Object)
230
             ]);
237
             ]);
238
+            expect(emitterSpy.calls.argsFor(1)).toEqual([
239
+                XMPPEvents.MUC_JOIN_IN_PROGRESS
240
+            ]);
231
             expect(emitterSpy).toHaveBeenCalledWith(
241
             expect(emitterSpy).toHaveBeenCalledWith(
232
               XMPPEvents.MUC_MEMBER_JOINED,
242
               XMPPEvents.MUC_MEMBER_JOINED,
233
               'fromjid',
243
               'fromjid',
271
             };
281
             };
272
 
282
 
273
             room.onPresence(pres);
283
             room.onPresence(pres);
274
-            expect(emitterSpy.calls.count()).toEqual(2);
284
+            expect(emitterSpy.calls.count()).toEqual(3);
275
             expect(emitterSpy.calls.argsFor(0)).toEqual([
285
             expect(emitterSpy.calls.argsFor(0)).toEqual([
276
                 XMPPEvents.PRESENCE_RECEIVED,
286
                 XMPPEvents.PRESENCE_RECEIVED,
277
                 jasmine.any(Object)
287
                 jasmine.any(Object)
278
             ]);
288
             ]);
279
             expect(emitterSpy.calls.argsFor(1)).toEqual([
289
             expect(emitterSpy.calls.argsFor(1)).toEqual([
290
+                XMPPEvents.MUC_JOIN_IN_PROGRESS
291
+            ]);
292
+            expect(emitterSpy.calls.argsFor(2)).toEqual([
280
                 XMPPEvents.MUC_MEMBER_JOINED,
293
                 XMPPEvents.MUC_MEMBER_JOINED,
281
                 'fromjid',
294
                 'fromjid',
282
                 undefined, // nick
295
                 undefined, // nick
305
             const pres = new DOMParser().parseFromString(presStr, 'text/xml').documentElement;
318
             const pres = new DOMParser().parseFromString(presStr, 'text/xml').documentElement;
306
 
319
 
307
             room.onPresence(pres);
320
             room.onPresence(pres);
308
-            expect(emitterSpy.calls.count()).toEqual(2);
321
+            expect(emitterSpy.calls.count()).toEqual(3);
309
             expect(emitterSpy.calls.argsFor(0)).toEqual([
322
             expect(emitterSpy.calls.argsFor(0)).toEqual([
310
                 XMPPEvents.PRESENCE_RECEIVED,
323
                 XMPPEvents.PRESENCE_RECEIVED,
311
                 jasmine.any(Object)
324
                 jasmine.any(Object)
312
             ]);
325
             ]);
313
             expect(emitterSpy.calls.argsFor(1)).toEqual([
326
             expect(emitterSpy.calls.argsFor(1)).toEqual([
327
+                XMPPEvents.MUC_JOIN_IN_PROGRESS
328
+            ]);
329
+            expect(emitterSpy.calls.argsFor(2)).toEqual([
314
                 XMPPEvents.MUC_MEMBER_JOINED,
330
                 XMPPEvents.MUC_MEMBER_JOINED,
315
                 'fromjid',
331
                 'fromjid',
316
                 undefined, // nick
332
                 undefined, // nick

+ 3
- 0
service/xmpp/XMPPEvents.js 查看文件

130
     // Designates an event indicating that the XMPP MUC was destroyed.
130
     // Designates an event indicating that the XMPP MUC was destroyed.
131
     MUC_DESTROYED: 'xmpp.muc_destroyed',
131
     MUC_DESTROYED: 'xmpp.muc_destroyed',
132
 
132
 
133
+    // Designates an event indicating that we are currently in process of joining the XMPP MUC.
134
+    MUC_JOIN_IN_PROGRESS: 'xmpp.muc_join_in_progress',
135
+
133
     // Designates an event indicating that we have joined the XMPP MUC.
136
     // Designates an event indicating that we have joined the XMPP MUC.
134
     MUC_JOINED: 'xmpp.muc_joined',
137
     MUC_JOINED: 'xmpp.muc_joined',
135
 
138
 

Loading…
取消
儲存