Parcourir la source

fixed jshint errors in CharRoom

dev1
isymchych il y a 10 ans
Parent
révision
bb6fda2473
1 fichiers modifiés avec 25 ajouts et 23 suppressions
  1. 25
    23
      modules/xmpp/ChatRoom.js

+ 25
- 23
modules/xmpp/ChatRoom.js Voir le fichier

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

Chargement…
Annuler
Enregistrer