Browse Source

Add identity to JitsiParticipant

dev1
Paul Tiedtke 6 years ago
parent
commit
1239562fb2
3 changed files with 16 additions and 2 deletions
  1. 1
    1
      JitsiConference.js
  2. 3
    1
      JitsiParticipant.js
  3. 12
    0
      doc/tokens.md

+ 1
- 1
JitsiConference.js View File

@@ -1342,7 +1342,7 @@ JitsiConference.prototype.onMemberJoined = function(
1342 1342
     }
1343 1343
 
1344 1344
     const participant
1345
-        = new JitsiParticipant(jid, this, nick, isHidden, statsID, status);
1345
+        = new JitsiParticipant(jid, this, nick, isHidden, statsID, status, identity);
1346 1346
 
1347 1347
     participant._role = role;
1348 1348
     participant._botType = botType;

+ 3
- 1
JitsiParticipant.js View File

@@ -28,8 +28,9 @@ export default class JitsiParticipant {
28 28
      * represent a hidden participant; otherwise, false.
29 29
      * @param {string} statsID - optional participant statsID
30 30
      * @param {string} status - the initial status if any.
31
+     * @param {object} identity - the xmpp identity
31 32
      */
32
-    constructor(jid, conference, displayName, hidden, statsID, status) {
33
+    constructor(jid, conference, displayName, hidden, statsID, status, identity) {
33 34
         this._jid = jid;
34 35
         this._id = Strophe.getResourceFromJid(jid);
35 36
         this._conference = conference;
@@ -42,6 +43,7 @@ export default class JitsiParticipant {
42 43
         this._statsID = statsID;
43 44
         this._connectionStatus = ParticipantConnectionStatus.ACTIVE;
44 45
         this._properties = {};
46
+        this._identity = identity;
45 47
     }
46 48
 
47 49
     /* eslint-enable max-params */

+ 12
- 0
doc/tokens.md View File

@@ -38,6 +38,18 @@ In addition to the basic claims used in authentication, the token can also provi
38 38
   - 'name' is the display name of the 'callee' user
39 39
   - 'avatar' is the URL of the avatar of the 'callee'
40 40
 
41
+#### Access token identifiers / context
42
+To access the data in lib-jitsi-meet you have to enable the prosody module `mod_presence_identity` in your config.
43
+
44
+```lua
45
+VirtualHost "jitmeet.example.com"
46
+    modules_enabled = { "presence_identity" }
47
+```
48
+
49
+The data is now available as the identity in the JitsiParticipant class. You can access them by e.g. listening to the `USER_JOINED` event.
50
+
51
+NOTE: The values in the token shall always be valid values. If you define e.g. the avatar as `null` it will throw an error.
52
+
41 53
 ### Example Token
42 54
 #### Headers (using RS256 public key validation)
43 55
 ```

Loading…
Cancel
Save