瀏覽代碼

Handles unique Id for a meeting.

dev1
damencho 5 年之前
父節點
當前提交
24a05989dd
共有 2 個檔案被更改,包括 39 行新增0 行删除
  1. 11
    0
      JitsiConference.js
  2. 28
    0
      modules/xmpp/ChatRoom.js

+ 11
- 0
JitsiConference.js 查看文件

@@ -2122,6 +2122,17 @@ JitsiConference.prototype.getPhonePin = function() {
2122 2122
     return null;
2123 2123
 };
2124 2124
 
2125
+/**
2126
+ * Returns the meeting unique Id if any.
2127
+ */
2128
+JitsiConference.prototype.getMeetingUniqueId = function() {
2129
+    if (this.room) {
2130
+        return this.room.getMeetingId();
2131
+    }
2132
+
2133
+    return null;
2134
+};
2135
+
2125 2136
 /**
2126 2137
  * Will return P2P or JVB <tt>TraceablePeerConnection</tt> depending on
2127 2138
  * which connection is currently active.

+ 28
- 0
modules/xmpp/ChatRoom.js 查看文件

@@ -127,6 +127,7 @@ export default class ChatRoom extends Listenable {
127 127
 
128 128
         this.locked = false;
129 129
         this.transcriptionStatus = JitsiTranscriptionStatus.OFF;
130
+        this.meetingId = null;
130 131
     }
131 132
 
132 133
     /* eslint-enable max-params */
@@ -277,6 +278,22 @@ export default class ChatRoom extends Listenable {
277 278
                 this.eventEmitter.emit(XMPPEvents.MUC_LOCK_CHANGED, locked);
278 279
                 this.locked = locked;
279 280
             }
281
+
282
+            const meetingIdValEl
283
+                = $(result).find('>query>x[type="result"]>field[var="muc#roominfo_meetingId"]>value');
284
+
285
+            if (meetingIdValEl.length) {
286
+                const meetingId = meetingIdValEl.text();
287
+
288
+                if (this.meetingId !== meetingId) {
289
+                    if (this.meetingId) {
290
+                        logger.warn(`Meeting Id changed from:${this.meetingId} to:${meetingId}`);
291
+                    }
292
+                    this.meetingId = meetingId;
293
+                }
294
+            } else {
295
+                logger.trace('No meeting id from backend');
296
+            }
280 297
         }, error => {
281 298
             GlobalOnErrorHandler.callErrorHandler(error);
282 299
             logger.error('Error getting room info: ', error);
@@ -478,6 +495,10 @@ export default class ChatRoom extends Listenable {
478 495
                 this.sendPresence();
479 496
 
480 497
                 this.eventEmitter.emit(XMPPEvents.MUC_JOINED);
498
+
499
+                // Now let's check the disco-info to retrieve the
500
+                // meeting Id if any
501
+                this.discoRoomInfo();
481 502
             }
482 503
         } else if (jid === undefined) {
483 504
             logger.info('Ignoring member with undefined JID');
@@ -1363,6 +1384,13 @@ export default class ChatRoom extends Listenable {
1363 1384
         return this.phonePin;
1364 1385
     }
1365 1386
 
1387
+    /**
1388
+     * Returns the meeting unique Id if any came from backend.
1389
+     */
1390
+    getMeetingId() {
1391
+        return this.meetingId;
1392
+    }
1393
+
1366 1394
     /**
1367 1395
      * Mutes remote participant.
1368 1396
      * @param jid of the participant

Loading…
取消
儲存