浏览代码

Stores initial participant status and skips the status changed event.

master
damencho 7 年前
父节点
当前提交
365bd886ee
共有 3 个文件被更改,包括 13 次插入7 次删除
  1. 3
    2
      JitsiConference.js
  2. 3
    2
      JitsiParticipant.js
  3. 7
    3
      modules/xmpp/ChatRoom.js

+ 3
- 2
JitsiConference.js 查看文件

@@ -1160,16 +1160,17 @@ JitsiConference.prototype.muteParticipant = function(id) {
1160 1160
  * @param isHidden indicates if this is a hidden participant (system
1161 1161
  * participant for example a recorder).
1162 1162
  * @param statsID the participant statsID (optional)
1163
+ * @param status the initial status if any
1163 1164
  */
1164 1165
 JitsiConference.prototype.onMemberJoined = function(
1165
-        jid, nick, role, isHidden, statsID) {
1166
+        jid, nick, role, isHidden, statsID, status) {
1166 1167
     const id = Strophe.getResourceFromJid(jid);
1167 1168
 
1168 1169
     if (id === 'focus' || this.myUserId() === id) {
1169 1170
         return;
1170 1171
     }
1171 1172
     const participant
1172
-        = new JitsiParticipant(jid, this, nick, isHidden, statsID);
1173
+        = new JitsiParticipant(jid, this, nick, isHidden, statsID, status);
1173 1174
 
1174 1175
     participant._role = role;
1175 1176
     this.participants[id] = participant;

+ 3
- 2
JitsiParticipant.js 查看文件

@@ -23,8 +23,9 @@ export default class JitsiParticipant {
23 23
      * @param {Boolean} hidden - True if the new JitsiParticipant instance is to
24 24
      * represent a hidden participant; otherwise, false.
25 25
      * @param {string} statsID - optional participant statsID
26
+     * @param {string} status - the initial status if any.
26 27
      */
27
-    constructor(jid, conference, displayName, hidden, statsID) {
28
+    constructor(jid, conference, displayName, hidden, statsID, status) {
28 29
         this._jid = jid;
29 30
         this._id = Strophe.getResourceFromJid(jid);
30 31
         this._conference = conference;
@@ -32,7 +33,7 @@ export default class JitsiParticipant {
32 33
         this._supportsDTMF = false;
33 34
         this._tracks = [];
34 35
         this._role = 'none';
35
-        this._status = null;
36
+        this._status = status;
36 37
         this._availableDevices = {
37 38
             audio: undefined,
38 39
             video: undefined

+ 7
- 3
modules/xmpp/ChatRoom.js 查看文件

@@ -486,6 +486,7 @@ export default class ChatRoom extends Listenable {
486 486
             // new participant
487 487
             this.members[from] = member;
488 488
             logger.log('entered', from, member);
489
+            hasStatusUpdate = member.status !== undefined;
489 490
             if (member.isFocus) {
490 491
                 this._initFocus(from, jid);
491 492
             } else {
@@ -495,10 +496,13 @@ export default class ChatRoom extends Listenable {
495 496
                     member.nick,
496 497
                     member.role,
497 498
                     member.isHiddenDomain,
498
-                    member.statsID);
499
-            }
499
+                    member.statsID,
500
+                    member.status);
500 501
 
501
-            hasStatusUpdate = member.status !== undefined;
502
+                // we are reporting the status with the join
503
+                // so we do not want a second event about status update
504
+                hasStatusUpdate = false;
505
+            }
502 506
         } else {
503 507
             // Presence update for existing participant
504 508
             // Watch role change:

正在加载...
取消
保存