Преглед изворни кода

Add hidden participant support

dev1
yanas пре 9 година
родитељ
комит
02c46a19fb
3 измењених фајлова са 33 додато и 4 уклоњено
  1. 12
    2
      JitsiConference.js
  2. 15
    1
      JitsiParticipant.js
  3. 6
    1
      modules/xmpp/ChatRoom.js

+ 12
- 2
JitsiConference.js Прегледај датотеку

@@ -540,12 +540,22 @@ JitsiConference.prototype.muteParticipant = function (id) {
540 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 554
     var id = Strophe.getResourceFromJid(jid);
545 555
     if (id === 'focus' || this.myUserId() === id) {
546 556
        return;
547 557
     }
548
-    var participant = new JitsiParticipant(jid, this, nick);
558
+    var participant = new JitsiParticipant(jid, this, nick, isHidden);
549 559
     participant._role = role;
550 560
     this.participants[id] = participant;
551 561
     this.eventEmitter.emit(JitsiConferenceEvents.USER_JOINED, id, participant);

+ 15
- 1
JitsiParticipant.js Прегледај датотеку

@@ -2,8 +2,12 @@
2 2
 
3 3
 /**
4 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 11
     this._jid = jid;
8 12
     this._id = Strophe.getResourceFromJid(jid);
9 13
     this._conference = conference;
@@ -16,6 +20,7 @@ function JitsiParticipant(jid, conference, displayName){
16 20
         audio: undefined,
17 21
         video: undefined
18 22
     };
23
+    this._isHidden = isHidden;
19 24
 }
20 25
 
21 26
 /**
@@ -67,6 +72,15 @@ JitsiParticipant.prototype.isModerator = function() {
67 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 84
 // Gets a link to an etherpad instance advertised by the participant?
71 85
 //JitsiParticipant.prototype.getEtherpad = function() {
72 86
 //

+ 6
- 1
modules/xmpp/ChatRoom.js Прегледај датотеку

@@ -235,6 +235,10 @@ ChatRoom.prototype.onPresence = function (pres) {
235 235
     member.jid = jid;
236 236
     member.isFocus
237 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 243
     $(pres).find(">x").remove();
240 244
     var nodes = [];
@@ -286,7 +290,8 @@ ChatRoom.prototype.onPresence = function (pres) {
286 290
         }
287 291
         else {
288 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 296
     } else {
292 297
         // Presence update for existing participant

Loading…
Откажи
Сачувај