|
@@ -197,6 +197,22 @@ JitsiConference.prototype.removeTrack = function (track) {
|
197
|
197
|
this.rtc.removeLocalStream(track);
|
198
|
198
|
};
|
199
|
199
|
|
|
200
|
+/**
|
|
201
|
+ * Get role of the local user.
|
|
202
|
+ * @returns {string} user role: 'moderator' or 'none'
|
|
203
|
+ */
|
|
204
|
+JitsiConference.prototype.getRole = function () {
|
|
205
|
+ return this.room.role;
|
|
206
|
+};
|
|
207
|
+
|
|
208
|
+/**
|
|
209
|
+ * Check if local user is moderator.
|
|
210
|
+ * @returns {boolean} true if local user is moderator, false otherwise.
|
|
211
|
+ */
|
|
212
|
+JitsiConference.prototype.isModerator = function () {
|
|
213
|
+ return this.room.isModerator();
|
|
214
|
+};
|
|
215
|
+
|
200
|
216
|
/**
|
201
|
217
|
* Elects the participant with the given id to be the selected participant or the speaker.
|
202
|
218
|
* @param id the identifier of the participant
|
|
@@ -255,6 +271,16 @@ JitsiConference.prototype.onMemberLeft = function (jid) {
|
255
|
271
|
this.eventEmitter.emit(JitsiConferenceEvents.USER_LEFT, id);
|
256
|
272
|
};
|
257
|
273
|
|
|
274
|
+JitsiConference.prototype.onUserRoleChanged = function (jid, role) {
|
|
275
|
+ var id = Strophe.getResourceFromJid(jid);
|
|
276
|
+ var participant = this.getParticipantById(id);
|
|
277
|
+ if (!participant) {
|
|
278
|
+ return;
|
|
279
|
+ }
|
|
280
|
+ participant._role = role;
|
|
281
|
+ this.eventEmitter.emit(JitsiConferenceEvents.USER_ROLE_CHANGED, id, role);
|
|
282
|
+};
|
|
283
|
+
|
258
|
284
|
JitsiConference.prototype.onDisplayNameChanged = function (jid, displayName) {
|
259
|
285
|
var id = Strophe.getResourceFromJid(jid);
|
260
|
286
|
var participant = this.getParticipantById(id);
|
|
@@ -364,6 +390,11 @@ function setupListeners(conference) {
|
364
|
390
|
|
365
|
391
|
conference.room.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, conference.onDisplayNameChanged.bind(conference));
|
366
|
392
|
|
|
393
|
+ conference.room.addListener(XMPPEvents.LOCAL_ROLE_CHANGED, function (role) {
|
|
394
|
+ conference.eventEmitter.emit(JitsiConferenceEvents.USER_ROLE_CHANGED, conference.myUserId(), role);
|
|
395
|
+ });
|
|
396
|
+ conference.room.addListener(XMPPEvents.MUC_ROLE_CHANGED, conference.onUserRoleChanged.bind(conference));
|
|
397
|
+
|
367
|
398
|
conference.room.addListener(XMPPEvents.CONNECTION_INTERRUPTED, function () {
|
368
|
399
|
conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_INTERRUPTED);
|
369
|
400
|
});
|
|
@@ -496,6 +527,10 @@ var JitsiConferenceEvents = {
|
496
|
527
|
* A user has left the conference.
|
497
|
528
|
*/
|
498
|
529
|
USER_LEFT: "conference.userLeft",
|
|
530
|
+ /**
|
|
531
|
+ * User role changed.
|
|
532
|
+ */
|
|
533
|
+ USER_ROLE_CHANGED: "conference.roleChanged",
|
499
|
534
|
/**
|
500
|
535
|
* New text message was received.
|
501
|
536
|
*/
|
|
@@ -552,7 +587,7 @@ var JitsiConferenceEvents = {
|
552
|
587
|
/**
|
553
|
588
|
* Indicates that DTMF support changed.
|
554
|
589
|
*/
|
555
|
|
- DTMF_SUPPORT_CHANGED: "conference.dtmf_support_changed"
|
|
590
|
+ DTMF_SUPPORT_CHANGED: "conference.dtmfSupportChanged"
|
556
|
591
|
};
|
557
|
592
|
|
558
|
593
|
module.exports = JitsiConferenceEvents;
|
|
@@ -783,7 +818,7 @@ function JitsiParticipant(id, conference, displayName){
|
783
|
818
|
this._displayName = displayName;
|
784
|
819
|
this._supportsDTMF = false;
|
785
|
820
|
this._tracks = [];
|
786
|
|
- this._isModerator = false;
|
|
821
|
+ this._role = 'none';
|
787
|
822
|
}
|
788
|
823
|
|
789
|
824
|
/**
|
|
@@ -818,7 +853,7 @@ JitsiParticipant.prototype.getDisplayName = function() {
|
818
|
853
|
* @returns {Boolean} Whether this participant is a moderator or not.
|
819
|
854
|
*/
|
820
|
855
|
JitsiParticipant.prototype.isModerator = function() {
|
821
|
|
- return this._isModerator;
|
|
856
|
+ return this._role === 'moderator';
|
822
|
857
|
};
|
823
|
858
|
|
824
|
859
|
// Gets a link to an etherpad instance advertised by the participant?
|
|
@@ -857,7 +892,7 @@ JitsiParticipant.prototype.getLatestStats = function() {
|
857
|
892
|
* @returns {String} The role of this participant.
|
858
|
893
|
*/
|
859
|
894
|
JitsiParticipant.prototype.getRole = function() {
|
860
|
|
-
|
|
895
|
+ return this._role;
|
861
|
896
|
};
|
862
|
897
|
|
863
|
898
|
/*
|
|
@@ -5565,7 +5600,8 @@ module.exports = RandomUtil;
|
5565
|
5600
|
|
5566
|
5601
|
},{}],26:[function(require,module,exports){
|
5567
|
5602
|
(function (__filename){
|
5568
|
|
-
|
|
5603
|
+/* global Strophe, $, $pres, $iq, $msg */
|
|
5604
|
+/* jshint -W101,-W069 */
|
5569
|
5605
|
var logger = require("jitsi-meet-logger").getLogger(__filename);
|
5570
|
5606
|
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
|
5571
|
5607
|
var Moderator = require("./moderator");
|
|
@@ -5576,23 +5612,24 @@ var parser = {
|
5576
|
5612
|
var self = this;
|
5577
|
5613
|
$(packet).children().each(function (index) {
|
5578
|
5614
|
var tagName = $(this).prop("tagName");
|
5579
|
|
- var node = {}
|
5580
|
|
- node["tagName"] = tagName;
|
|
5615
|
+ var node = {
|
|
5616
|
+ tagName: tagName
|
|
5617
|
+ };
|
5581
|
5618
|
node.attributes = {};
|
5582
|
5619
|
$($(this)[0].attributes).each(function( index, attr ) {
|
5583
|
5620
|
node.attributes[ attr.name ] = attr.value;
|
5584
|
|
- } );
|
|
5621
|
+ });
|
5585
|
5622
|
var text = Strophe.getText($(this)[0]);
|
5586
|
|
- if(text)
|
|
5623
|
+ if (text) {
|
5587
|
5624
|
node.value = text;
|
|
5625
|
+ }
|
5588
|
5626
|
node.children = [];
|
5589
|
5627
|
nodes.push(node);
|
5590
|
5628
|
self.packet2JSON($(this), node.children);
|
5591
|
|
- })
|
|
5629
|
+ });
|
5592
|
5630
|
},
|
5593
|
5631
|
JSON2packet: function (nodes, packet) {
|
5594
|
|
- for(var i = 0; i < nodes.length; i++)
|
5595
|
|
- {
|
|
5632
|
+ for(var i = 0; i < nodes.length; i++) {
|
5596
|
5633
|
var node = nodes[i];
|
5597
|
5634
|
if(!node || node === null){
|
5598
|
5635
|
continue;
|
|
@@ -5634,7 +5671,7 @@ function ChatRoom(connection, jid, password, XMPP, options) {
|
5634
|
5671
|
this.presMap = {};
|
5635
|
5672
|
this.presHandlers = {};
|
5636
|
5673
|
this.joined = false;
|
5637
|
|
- this.role = null;
|
|
5674
|
+ this.role = 'none';
|
5638
|
5675
|
this.focusMucJid = null;
|
5639
|
5676
|
this.bridgeIsDown = false;
|
5640
|
5677
|
this.options = options || {};
|
|
@@ -5671,7 +5708,7 @@ ChatRoom.prototype.updateDeviceAvailability = function (devices) {
|
5671
|
5708
|
}
|
5672
|
5709
|
]
|
5673
|
5710
|
});
|
5674
|
|
-}
|
|
5711
|
+};
|
5675
|
5712
|
|
5676
|
5713
|
ChatRoom.prototype.join = function (password, tokenPassword) {
|
5677
|
5714
|
if(password)
|
|
@@ -5773,7 +5810,7 @@ ChatRoom.prototype.onPresence = function (pres) {
|
5773
|
5810
|
member.jid = tmp.attr('jid');
|
5774
|
5811
|
member.isFocus = false;
|
5775
|
5812
|
if (member.jid
|
5776
|
|
- && member.jid.indexOf(this.moderator.getFocusUserJid() + "/") == 0) {
|
|
5813
|
+ && member.jid.indexOf(this.moderator.getFocusUserJid() + "/") === 0) {
|
5777
|
5814
|
member.isFocus = true;
|
5778
|
5815
|
}
|
5779
|
5816
|
|
|
@@ -5822,8 +5859,7 @@ ChatRoom.prototype.onPresence = function (pres) {
|
5822
|
5859
|
if (this.role !== member.role) {
|
5823
|
5860
|
this.role = member.role;
|
5824
|
5861
|
|
5825
|
|
- this.eventEmitter.emit(XMPPEvents.LOCAL_ROLE_CHANGED,
|
5826
|
|
- member, this.isModerator());
|
|
5862
|
+ this.eventEmitter.emit(XMPPEvents.LOCAL_ROLE_CHANGED, this.role);
|
5827
|
5863
|
}
|
5828
|
5864
|
if (!this.joined) {
|
5829
|
5865
|
this.joined = true;
|
|
@@ -5846,8 +5882,7 @@ ChatRoom.prototype.onPresence = function (pres) {
|
5846
|
5882
|
// Watch role change:
|
5847
|
5883
|
if (this.members[from].role != member.role) {
|
5848
|
5884
|
this.members[from].role = member.role;
|
5849
|
|
- this.eventEmitter.emit(XMPPEvents.MUC_ROLE_CHANGED,
|
5850
|
|
- member.role, member.nick);
|
|
5885
|
+ this.eventEmitter.emit(XMPPEvents.MUC_ROLE_CHANGED, from, member.role);
|
5851
|
5886
|
}
|
5852
|
5887
|
|
5853
|
5888
|
// store the new display name
|
|
@@ -5912,7 +5947,7 @@ ChatRoom.prototype.onPresenceUnavailable = function (pres, from) {
|
5912
|
5947
|
|
5913
|
5948
|
this.xmpp.disposeConference(false);
|
5914
|
5949
|
this.eventEmitter.emit(XMPPEvents.MUC_DESTROYED, reason);
|
5915
|
|
- delete this.connection.emuc.rooms[Strophe.getBareJidFromJid(jid)];
|
|
5950
|
+ delete this.connection.emuc.rooms[Strophe.getBareJidFromJid(from)];
|
5916
|
5951
|
return true;
|
5917
|
5952
|
}
|
5918
|
5953
|
|
|
@@ -5955,7 +5990,7 @@ ChatRoom.prototype.onMessage = function (msg, from) {
|
5955
|
5990
|
var subject = $(msg).find('>subject');
|
5956
|
5991
|
if (subject.length) {
|
5957
|
5992
|
var subjectText = subject.text();
|
5958
|
|
- if (subjectText || subjectText == "") {
|
|
5993
|
+ if (subjectText || subjectText === "") {
|
5959
|
5994
|
this.eventEmitter.emit(XMPPEvents.SUBJECT_CHANGED, subjectText);
|
5960
|
5995
|
logger.log("Subject is changed to " + subjectText);
|
5961
|
5996
|
}
|
|
@@ -5980,7 +6015,7 @@ ChatRoom.prototype.onMessage = function (msg, from) {
|
5980
|
6015
|
this.eventEmitter.emit(XMPPEvents.MESSAGE_RECEIVED,
|
5981
|
6016
|
from, nick, txt, this.myroomjid, stamp);
|
5982
|
6017
|
}
|
5983
|
|
-}
|
|
6018
|
+};
|
5984
|
6019
|
|
5985
|
6020
|
ChatRoom.prototype.onPresenceError = function (pres, from) {
|
5986
|
6021
|
if ($(pres).find('>error[type="auth"]>not-authorized[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
|
|
@@ -6059,13 +6094,13 @@ ChatRoom.prototype.removeFromPresence = function (key) {
|
6059
|
6094
|
|
6060
|
6095
|
ChatRoom.prototype.addPresenceListener = function (name, handler) {
|
6061
|
6096
|
this.presHandlers[name] = handler;
|
6062
|
|
-}
|
|
6097
|
+};
|
6063
|
6098
|
|
6064
|
6099
|
ChatRoom.prototype.removePresenceListener = function (name) {
|
6065
|
6100
|
delete this.presHandlers[name];
|
6066
|
|
-}
|
|
6101
|
+};
|
6067
|
6102
|
|
6068
|
|
-ChatRoom.prototype.isModerator = function (jid) {
|
|
6103
|
+ChatRoom.prototype.isModerator = function () {
|
6069
|
6104
|
return this.role === 'moderator';
|
6070
|
6105
|
};
|
6071
|
6106
|
|
|
@@ -6085,8 +6120,8 @@ ChatRoom.prototype.setJingleSession = function(session){
|
6085
|
6120
|
ChatRoom.prototype.removeStream = function (stream) {
|
6086
|
6121
|
if(!this.session)
|
6087
|
6122
|
return;
|
6088
|
|
- this.session.peerconnection.removeStream(stream)
|
6089
|
|
-}
|
|
6123
|
+ this.session.peerconnection.removeStream(stream);
|
|
6124
|
+};
|
6090
|
6125
|
|
6091
|
6126
|
ChatRoom.prototype.switchStreams = function (stream, oldStream, callback, isAudio) {
|
6092
|
6127
|
if(this.session) {
|
|
@@ -6108,14 +6143,14 @@ ChatRoom.prototype.addStream = function (stream, callback) {
|
6108
|
6143
|
logger.warn("No conference handler or conference not started yet");
|
6109
|
6144
|
callback();
|
6110
|
6145
|
}
|
6111
|
|
-}
|
|
6146
|
+};
|
6112
|
6147
|
|
6113
|
6148
|
ChatRoom.prototype.setVideoMute = function (mute, callback, options) {
|
6114
|
6149
|
var self = this;
|
6115
|
6150
|
var localCallback = function (mute) {
|
6116
|
6151
|
self.sendVideoInfoPresence(mute);
|
6117
|
6152
|
if(callback)
|
6118
|
|
- callback(mute)
|
|
6153
|
+ callback(mute);
|
6119
|
6154
|
};
|
6120
|
6155
|
|
6121
|
6156
|
if(this.session)
|
|
@@ -6148,7 +6183,7 @@ ChatRoom.prototype.addAudioInfoToPresence = function (mute) {
|
6148
|
6183
|
{attributes:
|
6149
|
6184
|
{"audions": "http://jitsi.org/jitmeet/audio"},
|
6150
|
6185
|
value: mute.toString()});
|
6151
|
|
-}
|
|
6186
|
+};
|
6152
|
6187
|
|
6153
|
6188
|
ChatRoom.prototype.sendAudioInfoPresence = function(mute, callback) {
|
6154
|
6189
|
this.addAudioInfoToPresence(mute);
|
|
@@ -6165,7 +6200,7 @@ ChatRoom.prototype.addVideoInfoToPresence = function (mute) {
|
6165
|
6200
|
{attributes:
|
6166
|
6201
|
{"videons": "http://jitsi.org/jitmeet/video"},
|
6167
|
6202
|
value: mute.toString()});
|
6168
|
|
-}
|
|
6203
|
+};
|
6169
|
6204
|
|
6170
|
6205
|
|
6171
|
6206
|
ChatRoom.prototype.sendVideoInfoPresence = function (mute) {
|
|
@@ -6198,7 +6233,7 @@ ChatRoom.prototype.remoteStreamAdded = function(data, sid, thessrc) {
|
6198
|
6233
|
}
|
6199
|
6234
|
|
6200
|
6235
|
this.eventEmitter.emit(XMPPEvents.REMOTE_STREAM_RECEIVED, data, sid, thessrc);
|
6201
|
|
-}
|
|
6236
|
+};
|
6202
|
6237
|
|
6203
|
6238
|
ChatRoom.prototype.getJidBySSRC = function (ssrc) {
|
6204
|
6239
|
if (!this.session)
|