Просмотр исходного кода

Stores initial participant status and skips the status changed event.

master
damencho 7 лет назад
Родитель
Сommit
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
  * @param isHidden indicates if this is a hidden participant (system
1160
  * @param isHidden indicates if this is a hidden participant (system
1161
  * participant for example a recorder).
1161
  * participant for example a recorder).
1162
  * @param statsID the participant statsID (optional)
1162
  * @param statsID the participant statsID (optional)
1163
+ * @param status the initial status if any
1163
  */
1164
  */
1164
 JitsiConference.prototype.onMemberJoined = function(
1165
 JitsiConference.prototype.onMemberJoined = function(
1165
-        jid, nick, role, isHidden, statsID) {
1166
+        jid, nick, role, isHidden, statsID, status) {
1166
     const id = Strophe.getResourceFromJid(jid);
1167
     const id = Strophe.getResourceFromJid(jid);
1167
 
1168
 
1168
     if (id === 'focus' || this.myUserId() === id) {
1169
     if (id === 'focus' || this.myUserId() === id) {
1169
         return;
1170
         return;
1170
     }
1171
     }
1171
     const participant
1172
     const participant
1172
-        = new JitsiParticipant(jid, this, nick, isHidden, statsID);
1173
+        = new JitsiParticipant(jid, this, nick, isHidden, statsID, status);
1173
 
1174
 
1174
     participant._role = role;
1175
     participant._role = role;
1175
     this.participants[id] = participant;
1176
     this.participants[id] = participant;

+ 3
- 2
JitsiParticipant.js Просмотреть файл

23
      * @param {Boolean} hidden - True if the new JitsiParticipant instance is to
23
      * @param {Boolean} hidden - True if the new JitsiParticipant instance is to
24
      * represent a hidden participant; otherwise, false.
24
      * represent a hidden participant; otherwise, false.
25
      * @param {string} statsID - optional participant statsID
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
         this._jid = jid;
29
         this._jid = jid;
29
         this._id = Strophe.getResourceFromJid(jid);
30
         this._id = Strophe.getResourceFromJid(jid);
30
         this._conference = conference;
31
         this._conference = conference;
32
         this._supportsDTMF = false;
33
         this._supportsDTMF = false;
33
         this._tracks = [];
34
         this._tracks = [];
34
         this._role = 'none';
35
         this._role = 'none';
35
-        this._status = null;
36
+        this._status = status;
36
         this._availableDevices = {
37
         this._availableDevices = {
37
             audio: undefined,
38
             audio: undefined,
38
             video: undefined
39
             video: undefined

+ 7
- 3
modules/xmpp/ChatRoom.js Просмотреть файл

486
             // new participant
486
             // new participant
487
             this.members[from] = member;
487
             this.members[from] = member;
488
             logger.log('entered', from, member);
488
             logger.log('entered', from, member);
489
+            hasStatusUpdate = member.status !== undefined;
489
             if (member.isFocus) {
490
             if (member.isFocus) {
490
                 this._initFocus(from, jid);
491
                 this._initFocus(from, jid);
491
             } else {
492
             } else {
495
                     member.nick,
496
                     member.nick,
496
                     member.role,
497
                     member.role,
497
                     member.isHiddenDomain,
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
         } else {
506
         } else {
503
             // Presence update for existing participant
507
             // Presence update for existing participant
504
             // Watch role change:
508
             // Watch role change:

Загрузка…
Отмена
Сохранить