|
@@ -1,4 +1,5 @@
|
1
|
|
-
|
|
1
|
+/* global Strophe, $, $pres, $iq, $msg */
|
|
2
|
+/* jshint -W101,-W069 */
|
2
|
3
|
var logger = require("jitsi-meet-logger").getLogger(__filename);
|
3
|
4
|
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
|
4
|
5
|
var Moderator = require("./moderator");
|
|
@@ -9,23 +10,24 @@ var parser = {
|
9
|
10
|
var self = this;
|
10
|
11
|
$(packet).children().each(function (index) {
|
11
|
12
|
var tagName = $(this).prop("tagName");
|
12
|
|
- var node = {}
|
13
|
|
- node["tagName"] = tagName;
|
|
13
|
+ var node = {
|
|
14
|
+ tagName: tagName
|
|
15
|
+ };
|
14
|
16
|
node.attributes = {};
|
15
|
17
|
$($(this)[0].attributes).each(function( index, attr ) {
|
16
|
18
|
node.attributes[ attr.name ] = attr.value;
|
17
|
|
- } );
|
|
19
|
+ });
|
18
|
20
|
var text = Strophe.getText($(this)[0]);
|
19
|
|
- if(text)
|
|
21
|
+ if (text) {
|
20
|
22
|
node.value = text;
|
|
23
|
+ }
|
21
|
24
|
node.children = [];
|
22
|
25
|
nodes.push(node);
|
23
|
26
|
self.packet2JSON($(this), node.children);
|
24
|
|
- })
|
|
27
|
+ });
|
25
|
28
|
},
|
26
|
29
|
JSON2packet: function (nodes, packet) {
|
27
|
|
- for(var i = 0; i < nodes.length; i++)
|
28
|
|
- {
|
|
30
|
+ for(var i = 0; i < nodes.length; i++) {
|
29
|
31
|
var node = nodes[i];
|
30
|
32
|
if(!node || node === null){
|
31
|
33
|
continue;
|
|
@@ -104,7 +106,7 @@ ChatRoom.prototype.updateDeviceAvailability = function (devices) {
|
104
|
106
|
}
|
105
|
107
|
]
|
106
|
108
|
});
|
107
|
|
-}
|
|
109
|
+};
|
108
|
110
|
|
109
|
111
|
ChatRoom.prototype.join = function (password, tokenPassword) {
|
110
|
112
|
if(password)
|
|
@@ -206,7 +208,7 @@ ChatRoom.prototype.onPresence = function (pres) {
|
206
|
208
|
member.jid = tmp.attr('jid');
|
207
|
209
|
member.isFocus = false;
|
208
|
210
|
if (member.jid
|
209
|
|
- && member.jid.indexOf(this.moderator.getFocusUserJid() + "/") == 0) {
|
|
211
|
+ && member.jid.indexOf(this.moderator.getFocusUserJid() + "/") === 0) {
|
210
|
212
|
member.isFocus = true;
|
211
|
213
|
}
|
212
|
214
|
|
|
@@ -345,7 +347,7 @@ ChatRoom.prototype.onPresenceUnavailable = function (pres, from) {
|
345
|
347
|
|
346
|
348
|
this.xmpp.disposeConference(false);
|
347
|
349
|
this.eventEmitter.emit(XMPPEvents.MUC_DESTROYED, reason);
|
348
|
|
- delete this.connection.emuc.rooms[Strophe.getBareJidFromJid(jid)];
|
|
350
|
+ delete this.connection.emuc.rooms[Strophe.getBareJidFromJid(from)];
|
349
|
351
|
return true;
|
350
|
352
|
}
|
351
|
353
|
|
|
@@ -388,7 +390,7 @@ ChatRoom.prototype.onMessage = function (msg, from) {
|
388
|
390
|
var subject = $(msg).find('>subject');
|
389
|
391
|
if (subject.length) {
|
390
|
392
|
var subjectText = subject.text();
|
391
|
|
- if (subjectText || subjectText == "") {
|
|
393
|
+ if (subjectText || subjectText === "") {
|
392
|
394
|
this.eventEmitter.emit(XMPPEvents.SUBJECT_CHANGED, subjectText);
|
393
|
395
|
logger.log("Subject is changed to " + subjectText);
|
394
|
396
|
}
|
|
@@ -413,7 +415,7 @@ ChatRoom.prototype.onMessage = function (msg, from) {
|
413
|
415
|
this.eventEmitter.emit(XMPPEvents.MESSAGE_RECEIVED,
|
414
|
416
|
from, nick, txt, this.myroomjid, stamp);
|
415
|
417
|
}
|
416
|
|
-}
|
|
418
|
+};
|
417
|
419
|
|
418
|
420
|
ChatRoom.prototype.onPresenceError = function (pres, from) {
|
419
|
421
|
if ($(pres).find('>error[type="auth"]>not-authorized[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
|
|
@@ -492,11 +494,11 @@ ChatRoom.prototype.removeFromPresence = function (key) {
|
492
|
494
|
|
493
|
495
|
ChatRoom.prototype.addPresenceListener = function (name, handler) {
|
494
|
496
|
this.presHandlers[name] = handler;
|
495
|
|
-}
|
|
497
|
+};
|
496
|
498
|
|
497
|
499
|
ChatRoom.prototype.removePresenceListener = function (name) {
|
498
|
500
|
delete this.presHandlers[name];
|
499
|
|
-}
|
|
501
|
+};
|
500
|
502
|
|
501
|
503
|
ChatRoom.prototype.isModerator = function (jid) {
|
502
|
504
|
return this.role === 'moderator';
|
|
@@ -515,11 +517,11 @@ ChatRoom.prototype.setJingleSession = function(session){
|
515
|
517
|
};
|
516
|
518
|
|
517
|
519
|
|
518
|
|
-ChatRoom.prototype.removeStream = function (stream, callback) {
|
|
520
|
+ChatRoom.prototype.removeStream = function (stream) {
|
519
|
521
|
if(!this.session)
|
520
|
522
|
return;
|
521
|
|
- this.session.removeStream(stream, callback);
|
522
|
|
-}
|
|
523
|
+ this.session.peerconnection.removeStream(stream);
|
|
524
|
+};
|
523
|
525
|
|
524
|
526
|
ChatRoom.prototype.switchStreams = function (stream, oldStream, callback, isAudio) {
|
525
|
527
|
if(this.session) {
|
|
@@ -541,14 +543,14 @@ ChatRoom.prototype.addStream = function (stream, callback) {
|
541
|
543
|
logger.warn("No conference handler or conference not started yet");
|
542
|
544
|
callback();
|
543
|
545
|
}
|
544
|
|
-}
|
|
546
|
+};
|
545
|
547
|
|
546
|
548
|
ChatRoom.prototype.setVideoMute = function (mute, callback, options) {
|
547
|
549
|
var self = this;
|
548
|
550
|
var localCallback = function (mute) {
|
549
|
551
|
self.sendVideoInfoPresence(mute);
|
550
|
552
|
if(callback)
|
551
|
|
- callback(mute)
|
|
553
|
+ callback(mute);
|
552
|
554
|
};
|
553
|
555
|
|
554
|
556
|
if(this.session)
|
|
@@ -581,7 +583,7 @@ ChatRoom.prototype.addAudioInfoToPresence = function (mute) {
|
581
|
583
|
{attributes:
|
582
|
584
|
{"audions": "http://jitsi.org/jitmeet/audio"},
|
583
|
585
|
value: mute.toString()});
|
584
|
|
-}
|
|
586
|
+};
|
585
|
587
|
|
586
|
588
|
ChatRoom.prototype.sendAudioInfoPresence = function(mute, callback) {
|
587
|
589
|
this.addAudioInfoToPresence(mute);
|
|
@@ -598,7 +600,7 @@ ChatRoom.prototype.addVideoInfoToPresence = function (mute) {
|
598
|
600
|
{attributes:
|
599
|
601
|
{"videons": "http://jitsi.org/jitmeet/video"},
|
600
|
602
|
value: mute.toString()});
|
601
|
|
-}
|
|
603
|
+};
|
602
|
604
|
|
603
|
605
|
|
604
|
606
|
ChatRoom.prototype.sendVideoInfoPresence = function (mute) {
|
|
@@ -631,7 +633,7 @@ ChatRoom.prototype.remoteStreamAdded = function(data, sid, thessrc) {
|
631
|
633
|
}
|
632
|
634
|
|
633
|
635
|
this.eventEmitter.emit(XMPPEvents.REMOTE_STREAM_RECEIVED, data, sid, thessrc);
|
634
|
|
-}
|
|
636
|
+};
|
635
|
637
|
|
636
|
638
|
ChatRoom.prototype.getJidBySSRC = function (ssrc) {
|
637
|
639
|
if (!this.session)
|