Browse Source

Add hidden participant support

master
yanas 9 years ago
parent
commit
02c46a19fb
3 changed files with 33 additions and 4 deletions
  1. 12
    2
      JitsiConference.js
  2. 15
    1
      JitsiParticipant.js
  3. 6
    1
      modules/xmpp/ChatRoom.js

+ 12
- 2
JitsiConference.js View File

540
     this.room.muteParticipant(participant.getJid(), true);
540
     this.room.muteParticipant(participant.getJid(), true);
541
 };
541
 };
542
 
542
 
543
-JitsiConference.prototype.onMemberJoined = function (jid, nick, role) {
543
+/**
544
+ * Indicates that a participant has joined the conference.
545
+ *
546
+ * @param jid the jid of the participant in the MUC
547
+ * @param nick the display name of the participant
548
+ * @param role the role of the participant in the MUC
549
+ * @param isHidden indicates if this is a hidden participant (sysem participant,
550
+ * for example a recorder).
551
+ */
552
+JitsiConference.prototype.onMemberJoined
553
+    = function (jid, nick, role, isHidden) {
544
     var id = Strophe.getResourceFromJid(jid);
554
     var id = Strophe.getResourceFromJid(jid);
545
     if (id === 'focus' || this.myUserId() === id) {
555
     if (id === 'focus' || this.myUserId() === id) {
546
        return;
556
        return;
547
     }
557
     }
548
-    var participant = new JitsiParticipant(jid, this, nick);
558
+    var participant = new JitsiParticipant(jid, this, nick, isHidden);
549
     participant._role = role;
559
     participant._role = role;
550
     this.participants[id] = participant;
560
     this.participants[id] = participant;
551
     this.eventEmitter.emit(JitsiConferenceEvents.USER_JOINED, id, participant);
561
     this.eventEmitter.emit(JitsiConferenceEvents.USER_JOINED, id, participant);

+ 15
- 1
JitsiParticipant.js View File

2
 
2
 
3
 /**
3
 /**
4
  * Represents a participant in (a member of) a conference.
4
  * Represents a participant in (a member of) a conference.
5
+ * @param jid the conference XMPP jid
6
+ * @param conference
7
+ * @param displayName
8
+ * @param isHidden indicates if this participant is a hidden participant
5
  */
9
  */
6
-function JitsiParticipant(jid, conference, displayName){
10
+function JitsiParticipant(jid, conference, displayName, isHidden){
7
     this._jid = jid;
11
     this._jid = jid;
8
     this._id = Strophe.getResourceFromJid(jid);
12
     this._id = Strophe.getResourceFromJid(jid);
9
     this._conference = conference;
13
     this._conference = conference;
16
         audio: undefined,
20
         audio: undefined,
17
         video: undefined
21
         video: undefined
18
     };
22
     };
23
+    this._isHidden = isHidden;
19
 }
24
 }
20
 
25
 
21
 /**
26
 /**
67
     return this._role === 'moderator';
72
     return this._role === 'moderator';
68
 };
73
 };
69
 
74
 
75
+/**
76
+ * @returns {Boolean} Whether this participant is a hidden participant. Some
77
+ * special system participants may want to join hidden (like for example the
78
+ * recorder).
79
+ */
80
+JitsiParticipant.prototype.isHidden = function() {
81
+    return this._isHidden;
82
+};
83
+
70
 // Gets a link to an etherpad instance advertised by the participant?
84
 // Gets a link to an etherpad instance advertised by the participant?
71
 //JitsiParticipant.prototype.getEtherpad = function() {
85
 //JitsiParticipant.prototype.getEtherpad = function() {
72
 //
86
 //

+ 6
- 1
modules/xmpp/ChatRoom.js View File

235
     member.jid = jid;
235
     member.jid = jid;
236
     member.isFocus
236
     member.isFocus
237
         = !!jid && jid.indexOf(this.moderator.getFocusUserJid() + "/") === 0;
237
         = !!jid && jid.indexOf(this.moderator.getFocusUserJid() + "/") === 0;
238
+    member.isHiddenDomain
239
+        = !!jid && jid.indexOf("@") > 0
240
+            && this.options.hosts.hidden
241
+                === jid.substring(jid.indexOf("@") + 1, jid.indexOf("/"))
238
 
242
 
239
     $(pres).find(">x").remove();
243
     $(pres).find(">x").remove();
240
     var nodes = [];
244
     var nodes = [];
286
         }
290
         }
287
         else {
291
         else {
288
             this.eventEmitter.emit(
292
             this.eventEmitter.emit(
289
-                XMPPEvents.MUC_MEMBER_JOINED, from, member.nick, member.role);
293
+                XMPPEvents.MUC_MEMBER_JOINED,
294
+                from, member.nick, member.role, member.isHiddenDomain);
290
         }
295
         }
291
     } else {
296
     } else {
292
         // Presence update for existing participant
297
         // Presence update for existing participant

Loading…
Cancel
Save