浏览代码

[eslint] max-params

dev1
Lyubo Marinov 8 年前
父节点
当前提交
66b62080e8

+ 1
- 0
.eslintrc.js 查看文件

191
         'max-len': [ 'error', 80 ],
191
         'max-len': [ 'error', 80 ],
192
         'max-lines': 0,
192
         'max-lines': 0,
193
         'max-nested-callbacks': 2,
193
         'max-nested-callbacks': 2,
194
+        'max-params': 2,
194
         'max-statements': 0,
195
         'max-statements': 0,
195
         'max-statements-per-line': 2,
196
         'max-statements-per-line': 2,
196
         'multiline-ternary': 0,
197
         'multiline-ternary': 0,

+ 60
- 38
JitsiConference.js 查看文件

675
     this.eventEmitter.emit(JitsiConferenceEvents.TRACK_ADDED, newTrack);
675
     this.eventEmitter.emit(JitsiConferenceEvents.TRACK_ADDED, newTrack);
676
 };
676
 };
677
 
677
 
678
+/* eslint-disable max-params */
679
+
678
 /**
680
 /**
679
  * Adds loca WebRTC stream to the conference.
681
  * Adds loca WebRTC stream to the conference.
680
  * @param {MediaStream} stream new stream that will be added.
682
  * @param {MediaStream} stream new stream that will be added.
688
  * called. The option is used for adding stream, before the Jingle call is
690
  * called. The option is used for adding stream, before the Jingle call is
689
  * started. That is before the 'session-accept' is sent.
691
  * started. That is before the 'session-accept' is sent.
690
  */
692
  */
691
-JitsiConference.prototype._addLocalStream
692
-    = function(stream, callback, errorCallback, ssrcInfo, dontModifySources) {
693
-        if (this.jingleSession) {
694
-            this.jingleSession.addStream(
695
-            stream, callback, errorCallback, ssrcInfo, dontModifySources);
696
-        } else {
693
+JitsiConference.prototype._addLocalStream = function(
694
+        stream,
695
+        callback,
696
+        errorCallback,
697
+        ssrcInfo,
698
+        dontModifySources) {
699
+    if (this.jingleSession) {
700
+        this.jingleSession.addStream(
701
+            stream,
702
+            callback,
703
+            errorCallback,
704
+            ssrcInfo,
705
+            dontModifySources);
706
+    } else {
697
         // We are done immediately
707
         // We are done immediately
698
-            logger.warn('Add local MediaStream - no JingleSession started yet');
699
-            callback();
700
-        }
701
-    };
708
+        logger.warn('Add local MediaStream - no JingleSession started yet');
709
+        callback();
710
+    }
711
+};
702
 
712
 
703
 /**
713
 /**
704
  * Remove local WebRTC media stream.
714
  * Remove local WebRTC media stream.
708
  * @param {object} ssrcInfo object with information about the SSRCs associated
718
  * @param {object} ssrcInfo object with information about the SSRCs associated
709
  * with the stream.
719
  * with the stream.
710
  */
720
  */
711
-JitsiConference.prototype.removeLocalStream
712
-    = function(stream, callback, errorCallback, ssrcInfo) {
713
-        if (this.jingleSession) {
714
-            this.jingleSession.removeStream(
715
-            stream, callback, errorCallback, ssrcInfo);
716
-        } else {
717
-            // We are done immediately
718
-            logger.warn(
719
-                'Remove local MediaStream - no JingleSession started yet');
720
-            callback();
721
-        }
722
-    };
721
+JitsiConference.prototype.removeLocalStream = function(
722
+        stream,
723
+        callback,
724
+        errorCallback,
725
+        ssrcInfo) {
726
+    if (this.jingleSession) {
727
+        this.jingleSession.removeStream(
728
+            stream,
729
+            callback,
730
+            errorCallback,
731
+            ssrcInfo);
732
+    } else {
733
+        // We are done immediately
734
+        logger.warn('Remove local MediaStream - no JingleSession started yet');
735
+        callback();
736
+    }
737
+};
738
+
739
+/* eslint-enable max-params */
723
 
740
 
724
 /**
741
 /**
725
  * Generate ssrc info object for a stream with the following properties:
742
  * Generate ssrc info object for a stream with the following properties:
887
     this.room.muteParticipant(participant.getJid(), true);
904
     this.room.muteParticipant(participant.getJid(), true);
888
 };
905
 };
889
 
906
 
907
+/* eslint-disable max-params */
908
+
890
 /**
909
 /**
891
  * Notifies this JitsiConference that a new member has joined its chat room.
910
  * Notifies this JitsiConference that a new member has joined its chat room.
892
  *
911
  *
898
  * @param isHidden indicates if this is a hidden participant (system
917
  * @param isHidden indicates if this is a hidden participant (system
899
  * participant for example a recorder).
918
  * participant for example a recorder).
900
  */
919
  */
901
-JitsiConference.prototype.onMemberJoined
902
-    = function(jid, nick, role, isHidden) {
903
-        const id = Strophe.getResourceFromJid(jid);
920
+JitsiConference.prototype.onMemberJoined = function(jid, nick, role, isHidden) {
921
+    const id = Strophe.getResourceFromJid(jid);
904
 
922
 
905
-        if (id === 'focus' || this.myUserId() === id) {
906
-            return;
907
-        }
908
-        const participant = new JitsiParticipant(jid, this, nick, isHidden);
923
+    if (id === 'focus' || this.myUserId() === id) {
924
+        return;
925
+    }
926
+    const participant = new JitsiParticipant(jid, this, nick, isHidden);
909
 
927
 
910
-        participant._role = role;
911
-        this.participants[id] = participant;
912
-        this.eventEmitter.emit(
913
-            JitsiConferenceEvents.USER_JOINED,
914
-            id,
915
-            participant);
916
-        this.xmpp.caps.getFeatures(jid).then(features => {
928
+    participant._role = role;
929
+    this.participants[id] = participant;
930
+    this.eventEmitter.emit(
931
+        JitsiConferenceEvents.USER_JOINED,
932
+        id,
933
+        participant);
934
+    this.xmpp.caps.getFeatures(jid)
935
+        .then(features => {
917
             participant._supportsDTMF = features.has('urn:xmpp:jingle:dtmf:0');
936
             participant._supportsDTMF = features.has('urn:xmpp:jingle:dtmf:0');
918
             this.updateDTMFSupport();
937
             this.updateDTMFSupport();
919
-        }, error => logger.error(error));
920
-    };
938
+        },
939
+        error => logger.error(error));
940
+};
941
+
942
+/* eslint-enable max-params */
921
 
943
 
922
 JitsiConference.prototype.onMemberLeft = function(jid) {
944
 JitsiConference.prototype.onMemberLeft = function(jid) {
923
     const id = Strophe.getResourceFromJid(jid);
945
     const id = Strophe.getResourceFromJid(jid);

+ 6
- 2
JitsiConferenceEventManager.js 查看文件

256
                 authIdentity);
256
                 authIdentity);
257
         });
257
         });
258
 
258
 
259
-    chatRoom.addListener(XMPPEvents.MESSAGE_RECEIVED,
259
+    chatRoom.addListener(
260
+        XMPPEvents.MESSAGE_RECEIVED,
261
+
262
+        // eslint-disable-next-line max-params
260
         (jid, displayName, txt, myJid, ts) => {
263
         (jid, displayName, txt, myJid, ts) => {
261
             const id = Strophe.getResourceFromJid(jid);
264
             const id = Strophe.getResourceFromJid(jid);
262
 
265
 
263
-            conference.eventEmitter.emit(JitsiConferenceEvents.MESSAGE_RECEIVED,
266
+            conference.eventEmitter.emit(
267
+                JitsiConferenceEvents.MESSAGE_RECEIVED,
264
                 id, txt, ts);
268
                 id, txt, ts);
265
         });
269
         });
266
 
270
 

+ 4
- 0
JitsiMeetJS.js 查看文件

390
         this.mediaDevices.enumerateDevices(callback);
390
         this.mediaDevices.enumerateDevices(callback);
391
     },
391
     },
392
 
392
 
393
+    /* eslint-disable max-params */
394
+
393
     /**
395
     /**
394
      * @returns function that can be used to be attached to window.onerror and
396
      * @returns function that can be used to be attached to window.onerror and
395
      * if options.enableWindowOnErrorHandler is enabled returns
397
      * if options.enableWindowOnErrorHandler is enabled returns
406
         Statistics.reportGlobalError(error);
408
         Statistics.reportGlobalError(error);
407
     },
409
     },
408
 
410
 
411
+    /* eslint-enable max-params */
412
+
409
     /**
413
     /**
410
      * Returns current machine id saved from the local storage.
414
      * Returns current machine id saved from the local storage.
411
      * @returns {string} the machine id
415
      * @returns {string} the machine id

+ 5
- 0
JitsiParticipant.js 查看文件

6
  * Represents a participant in (i.e. a member of) a conference.
6
  * Represents a participant in (i.e. a member of) a conference.
7
  */
7
  */
8
 export default class JitsiParticipant {
8
 export default class JitsiParticipant {
9
+
10
+    /* eslint-disable max-params */
11
+
9
     /**
12
     /**
10
      * Initializes a new JitsiParticipant instance.
13
      * Initializes a new JitsiParticipant instance.
11
      *
14
      *
34
         this._properties = {};
37
         this._properties = {};
35
     }
38
     }
36
 
39
 
40
+    /* eslint-enable max-params */
41
+
37
     /**
42
     /**
38
      * @returns {JitsiConference} The conference that this participant belongs
43
      * @returns {JitsiConference} The conference that this participant belongs
39
      * to.
44
      * to.

+ 31
- 18
modules/RTC/JitsiLocalTrack.js 查看文件

15
 
15
 
16
 const logger = getLogger(__filename);
16
 const logger = getLogger(__filename);
17
 
17
 
18
+/* eslint-disable max-params */
19
+
18
 /**
20
 /**
19
  * Represents a single media track(either audio or video).
21
  * Represents a single media track(either audio or video).
20
  * One <tt>JitsiLocalTrack</tt> corresponds to one WebRTC MediaStreamTrack.
22
  * One <tt>JitsiLocalTrack</tt> corresponds to one WebRTC MediaStreamTrack.
27
  * @param facingMode the camera facing mode used in getUserMedia call
29
  * @param facingMode the camera facing mode used in getUserMedia call
28
  * @constructor
30
  * @constructor
29
  */
31
  */
30
-function JitsiLocalTrack(stream, track, mediaType, videoType, resolution,
31
-                         deviceId, facingMode) {
32
-    const self = this;
33
-
34
-    JitsiTrack.call(this,
35
-        null /* RTC */, stream, track,
32
+function JitsiLocalTrack(
33
+        stream,
34
+        track,
35
+        mediaType,
36
+        videoType,
37
+        resolution,
38
+        deviceId,
39
+        facingMode) {
40
+    JitsiTrack.call(
41
+        this,
42
+        null /* RTC */,
43
+        stream,
44
+        track,
36
         () => {
45
         () => {
37
             if (!this.dontFireRemoveEvent) {
46
             if (!this.dontFireRemoveEvent) {
38
-                this.eventEmitter.emit(
39
-                    JitsiTrackEvents.LOCAL_TRACK_STOPPED);
47
+                this.eventEmitter.emit(JitsiTrackEvents.LOCAL_TRACK_STOPPED);
40
             }
48
             }
41
             this.dontFireRemoveEvent = false;
49
             this.dontFireRemoveEvent = false;
42
         } /* inactiveHandler */,
50
         } /* inactiveHandler */,
43
-        mediaType, videoType, null /* ssrc */);
51
+        mediaType,
52
+        videoType,
53
+        null /* ssrc */);
44
     this.dontFireRemoveEvent = false;
54
     this.dontFireRemoveEvent = false;
45
     this.resolution = resolution;
55
     this.resolution = resolution;
46
 
56
 
98
      */
108
      */
99
     this._noDataFromSourceTimeout = null;
109
     this._noDataFromSourceTimeout = null;
100
 
110
 
101
-    this._onDeviceListChanged = function(devices) {
102
-        self._setRealDeviceIdFromDeviceList(devices);
111
+    this._onDeviceListChanged = devices => {
112
+        this._setRealDeviceIdFromDeviceList(devices);
103
 
113
 
104
         // Mark track as ended for those browsers that do not support
114
         // Mark track as ended for those browsers that do not support
105
         // "readyState" property. We do not touch tracks created with default
115
         // "readyState" property. We do not touch tracks created with default
106
         // device ID "".
116
         // device ID "".
107
-        if (typeof self.getTrack().readyState === 'undefined'
108
-            && typeof self._realDeviceId !== 'undefined'
109
-            && !devices.find(d => d.deviceId === self._realDeviceId)) {
110
-            self._trackEnded = true;
117
+        if (typeof this.getTrack().readyState === 'undefined'
118
+                && typeof this._realDeviceId !== 'undefined'
119
+                && !devices.find(d => d.deviceId === this._realDeviceId)) {
120
+            this._trackEnded = true;
111
         }
121
         }
112
     };
122
     };
113
 
123
 
117
     // because there might be local tracks not attached to a conference.
127
     // because there might be local tracks not attached to a conference.
118
     if (this.isAudioTrack() && RTCUtils.isDeviceChangeAvailable('output')) {
128
     if (this.isAudioTrack() && RTCUtils.isDeviceChangeAvailable('output')) {
119
         this._onAudioOutputDeviceChanged = this.setAudioOutput.bind(this);
129
         this._onAudioOutputDeviceChanged = this.setAudioOutput.bind(this);
120
-
121
-        RTCUtils.addListener(RTCEvents.AUDIO_OUTPUT_DEVICE_CHANGED,
130
+        RTCUtils.addListener(
131
+            RTCEvents.AUDIO_OUTPUT_DEVICE_CHANGED,
122
             this._onAudioOutputDeviceChanged);
132
             this._onAudioOutputDeviceChanged);
123
     }
133
     }
124
 
134
 
125
-    RTCUtils.addListener(RTCEvents.DEVICE_LIST_CHANGED,
135
+    RTCUtils.addListener(
136
+        RTCEvents.DEVICE_LIST_CHANGED,
126
         this._onDeviceListChanged);
137
         this._onDeviceListChanged);
127
 
138
 
128
     this._initNoDataFromSourceHandlers();
139
     this._initNoDataFromSourceHandlers();
129
 }
140
 }
130
 
141
 
142
+/* eslint-enable max-params */
143
+
131
 JitsiLocalTrack.prototype = Object.create(JitsiTrack.prototype);
144
 JitsiLocalTrack.prototype = Object.create(JitsiTrack.prototype);
132
 JitsiLocalTrack.prototype.constructor = JitsiLocalTrack;
145
 JitsiLocalTrack.prototype.constructor = JitsiLocalTrack;
133
 
146
 

+ 14
- 2
modules/RTC/JitsiRemoteTrack.js 查看文件

9
 let ttfmTrackerAudioAttached = false;
9
 let ttfmTrackerAudioAttached = false;
10
 let ttfmTrackerVideoAttached = false;
10
 let ttfmTrackerVideoAttached = false;
11
 
11
 
12
+/* eslint-disable max-params */
13
+
12
 /**
14
 /**
13
  * Represents a single media track (either audio or video).
15
  * Represents a single media track (either audio or video).
14
  * @param {RTC} rtc the RTC service instance.
16
  * @param {RTC} rtc the RTC service instance.
24
  * @param {boolean} muted the initial muted state
26
  * @param {boolean} muted the initial muted state
25
  * @constructor
27
  * @constructor
26
  */
28
  */
27
-function JitsiRemoteTrack(rtc, conference, ownerEndpointId, stream, track,
28
-                          mediaType, videoType, ssrc, muted) {
29
+function JitsiRemoteTrack(
30
+        rtc,
31
+        conference,
32
+        ownerEndpointId,
33
+        stream,
34
+        track,
35
+        mediaType,
36
+        videoType,
37
+        ssrc,
38
+        muted) {
29
     JitsiTrack.call(
39
     JitsiTrack.call(
30
         this,
40
         this,
31
         conference,
41
         conference,
52
     }
62
     }
53
 }
63
 }
54
 
64
 
65
+/* eslint-enable max-params */
66
+
55
 JitsiRemoteTrack.prototype = Object.create(JitsiTrack.prototype);
67
 JitsiRemoteTrack.prototype = Object.create(JitsiTrack.prototype);
56
 JitsiRemoteTrack.prototype.constructor = JitsiRemoteTrack;
68
 JitsiRemoteTrack.prototype.constructor = JitsiRemoteTrack;
57
 
69
 

+ 4
- 0
modules/RTC/JitsiTrack.js 查看文件

54
     }
54
     }
55
 }
55
 }
56
 
56
 
57
+/* eslint-disable max-params */
58
+
57
 /**
59
 /**
58
  * Represents a single media track (either audio or video).
60
  * Represents a single media track (either audio or video).
59
  * @constructor
61
  * @constructor
101
     this._setHandler('inactive', streamInactiveHandler);
103
     this._setHandler('inactive', streamInactiveHandler);
102
 }
104
 }
103
 
105
 
106
+/* eslint-enable max-params */
107
+
104
 /**
108
 /**
105
  * Sets handler to the WebRTC MediaStream or MediaStreamTrack object depending
109
  * Sets handler to the WebRTC MediaStream or MediaStreamTrack object depending
106
  * on the passed type.
110
  * on the passed type.

+ 24
- 5
modules/RTC/RTC.js 查看文件

411
         this.localTracks.splice(pos, 1);
411
         this.localTracks.splice(pos, 1);
412
     }
412
     }
413
 
413
 
414
+    /* eslint-disable max-params */
415
+
414
     /**
416
     /**
415
      * Initializes a new JitsiRemoteTrack instance with the data provided by
417
      * Initializes a new JitsiRemoteTrack instance with the data provided by
416
      * the signaling layer and SDP.
418
      * the signaling layer and SDP.
423
      * @param {string} ssrc
425
      * @param {string} ssrc
424
      * @param {boolean} muted
426
      * @param {boolean} muted
425
      */
427
      */
426
-    _createRemoteTrack(ownerEndpointId,
427
-                        stream, track, mediaType, videoType, ssrc, muted) {
428
+    _createRemoteTrack(
429
+            ownerEndpointId,
430
+            stream,
431
+            track,
432
+            mediaType,
433
+            videoType,
434
+            ssrc,
435
+            muted) {
428
         const remoteTrack
436
         const remoteTrack
429
             = new JitsiRemoteTrack(
437
             = new JitsiRemoteTrack(
430
-                this, this.conference, ownerEndpointId, stream, track,
431
-                mediaType, videoType, ssrc, muted);
438
+                this,
439
+                this.conference,
440
+                ownerEndpointId,
441
+                stream,
442
+                track,
443
+                mediaType,
444
+                videoType,
445
+                ssrc,
446
+                muted);
432
         const remoteTracks
447
         const remoteTracks
433
             = this.remoteTracks[ownerEndpointId]
448
             = this.remoteTracks[ownerEndpointId]
434
                 || (this.remoteTracks[ownerEndpointId] = {});
449
                 || (this.remoteTracks[ownerEndpointId] = {});
435
 
450
 
436
         if (remoteTracks[mediaType]) {
451
         if (remoteTracks[mediaType]) {
437
             logger.error(
452
             logger.error(
438
-                'Overwriting remote track!', ownerEndpointId, mediaType);
453
+                'Overwriting remote track!',
454
+                ownerEndpointId,
455
+                mediaType);
439
         }
456
         }
440
         remoteTracks[mediaType] = remoteTrack;
457
         remoteTracks[mediaType] = remoteTrack;
441
 
458
 
442
         this.eventEmitter.emit(RTCEvents.REMOTE_TRACK_ADDED, remoteTrack);
459
         this.eventEmitter.emit(RTCEvents.REMOTE_TRACK_ADDED, remoteTrack);
443
     }
460
     }
444
 
461
 
462
+    /* eslint-enable max-params */
463
+
445
     /**
464
     /**
446
      * Removes all JitsiRemoteTracks associated with given MUC nickname
465
      * Removes all JitsiRemoteTracks associated with given MUC nickname
447
      * (resource part of the JID). Returns array of removed tracks.
466
      * (resource part of the JID). Returns array of removed tracks.

+ 4
- 0
modules/RTC/RTCUtils.js 查看文件

894
         });
894
         });
895
     }
895
     }
896
 
896
 
897
+    /* eslint-disable max-params */
898
+
897
     /**
899
     /**
898
     * @param {string[]} um required user media types
900
     * @param {string[]} um required user media types
899
     * @param {function} successCallback
901
     * @param {function} successCallback
942
         }
944
         }
943
     }
945
     }
944
 
946
 
947
+    /* eslint-enable max-params */
948
+
945
     /**
949
     /**
946
      * Creates the local MediaStreams.
950
      * Creates the local MediaStreams.
947
      * @param {Object} [options] optional parameters
951
      * @param {Object} [options] optional parameters

+ 4
- 0
modules/RTC/ScreenObtainer.js 查看文件

290
         }
290
         }
291
     },
291
     },
292
 
292
 
293
+    /* eslint-disable max-params */
294
+
293
     handleExtensionInstallationError(options, streamCallback, failCallback, e) {
295
     handleExtensionInstallationError(options, streamCallback, failCallback, e) {
294
         const webStoreInstallUrl = getWebStoreInstallUrl(this.options);
296
         const webStoreInstallUrl = getWebStoreInstallUrl(this.options);
295
 
297
 
314
             msg));
316
             msg));
315
     },
317
     },
316
 
318
 
319
+    /* eslint-enable max-params */
320
+
317
     checkForChromeExtensionOnInterval(options, streamCallback, failCallback) {
321
     checkForChromeExtensionOnInterval(options, streamCallback, failCallback) {
318
         if (options.checkAgain() === false) {
322
         if (options.checkAgain() === false) {
319
             failCallback(new JitsiTrackError(
323
             failCallback(new JitsiTrackError(

+ 50
- 46
modules/RTC/TraceablePeerConnection.js 查看文件

17
 const logger = getLogger(__filename);
17
 const logger = getLogger(__filename);
18
 const SIMULCAST_LAYERS = 3;
18
 const SIMULCAST_LAYERS = 3;
19
 
19
 
20
+/* eslint-disable max-params */
21
+
20
 /**
22
 /**
21
  * Creates new instance of 'TraceablePeerConnection'.
23
  * Creates new instance of 'TraceablePeerConnection'.
22
  *
24
  *
39
  *
41
  *
40
  * @constructor
42
  * @constructor
41
  */
43
  */
42
-function TraceablePeerConnection(rtc, id, signalingLayer, iceConfig,
43
-                                 constraints, options) {
44
-    const self = this;
44
+function TraceablePeerConnection(
45
+        rtc,
46
+        id,
47
+        signalingLayer,
48
+        iceConfig,
49
+        constraints,
50
+        options) {
45
 
51
 
46
     /**
52
     /**
47
      * The parent instance of RTC service which created this
53
      * The parent instance of RTC service which created this
48
      * <tt>TracablePeerConnection</tt>.
54
      * <tt>TracablePeerConnection</tt>.
49
      * @type {RTC}
55
      * @type {RTC}
50
      */
56
      */
51
-
52
     this.rtc = rtc;
57
     this.rtc = rtc;
53
 
58
 
54
     /**
59
     /**
98
     this.rtxModifier = new RtxModifier();
103
     this.rtxModifier = new RtxModifier();
99
 
104
 
100
     // override as desired
105
     // override as desired
101
-    this.trace = function(what, info) {
106
+    this.trace = (what, info) => {
102
         /* logger.warn('WTRACE', what, info);
107
         /* logger.warn('WTRACE', what, info);
103
         if (info && RTCBrowserType.isIExplorer()) {
108
         if (info && RTCBrowserType.isIExplorer()) {
104
             if (info.length > 1024) {
109
             if (info.length > 1024) {
108
                 logger.warn('WTRACE', what, info.substr(2048));
113
                 logger.warn('WTRACE', what, info.substr(2048));
109
             }
114
             }
110
         }*/
115
         }*/
111
-        self.updateLog.push({
116
+        this.updateLog.push({
112
             time: new Date(),
117
             time: new Date(),
113
             type: what,
118
             type: what,
114
             value: info || ''
119
             value: info || ''
115
         });
120
         });
116
     };
121
     };
117
     this.onicecandidate = null;
122
     this.onicecandidate = null;
118
-    this.peerconnection.onicecandidate = function(event) {
123
+    this.peerconnection.onicecandidate = event => {
119
         // FIXME: this causes stack overflow with Temasys Plugin
124
         // FIXME: this causes stack overflow with Temasys Plugin
120
         if (!RTCBrowserType.isTemasysPluginUsed()) {
125
         if (!RTCBrowserType.isTemasysPluginUsed()) {
121
-            self.trace(
126
+            this.trace(
122
                 'onicecandidate',
127
                 'onicecandidate',
123
                 JSON.stringify(event.candidate, null, ' '));
128
                 JSON.stringify(event.candidate, null, ' '));
124
         }
129
         }
125
 
130
 
126
-        if (self.onicecandidate !== null) {
127
-            self.onicecandidate(event);
131
+        if (this.onicecandidate !== null) {
132
+            this.onicecandidate(event);
128
         }
133
         }
129
     };
134
     };
130
     this.onaddstream = null;
135
     this.onaddstream = null;
131
-    this.peerconnection.onaddstream = function(event) {
132
-        self.trace('onaddstream', event.stream.id);
133
-        if (self.onaddstream !== null) {
134
-            self.onaddstream(event);
136
+    this.peerconnection.onaddstream = event => {
137
+        this.trace('onaddstream', event.stream.id);
138
+        if (this.onaddstream !== null) {
139
+            this.onaddstream(event);
135
         }
140
         }
136
     };
141
     };
137
     this.onremovestream = null;
142
     this.onremovestream = null;
138
-    this.peerconnection.onremovestream = function(event) {
139
-        self.trace('onremovestream', event.stream.id);
140
-        if (self.onremovestream !== null) {
141
-            self.onremovestream(event);
143
+    this.peerconnection.onremovestream = event => {
144
+        this.trace('onremovestream', event.stream.id);
145
+        if (this.onremovestream !== null) {
146
+            this.onremovestream(event);
142
         }
147
         }
143
     };
148
     };
144
-    this.peerconnection.onaddstream = function(event) {
145
-        self._remoteStreamAdded(event.stream);
146
-    };
147
-    this.peerconnection.onremovestream = function(event) {
148
-        self._remoteStreamRemoved(event.stream);
149
-    };
149
+    this.peerconnection.onaddstream
150
+        = event => this._remoteStreamAdded(event.stream);
151
+    this.peerconnection.onremovestream
152
+        = event => this._remoteStreamRemoved(event.stream);
150
     this.onsignalingstatechange = null;
153
     this.onsignalingstatechange = null;
151
-    this.peerconnection.onsignalingstatechange = function(event) {
152
-        self.trace('onsignalingstatechange', self.signalingState);
153
-        if (self.onsignalingstatechange !== null) {
154
-            self.onsignalingstatechange(event);
154
+    this.peerconnection.onsignalingstatechange = event => {
155
+        this.trace('onsignalingstatechange', this.signalingState);
156
+        if (this.onsignalingstatechange !== null) {
157
+            this.onsignalingstatechange(event);
155
         }
158
         }
156
     };
159
     };
157
     this.oniceconnectionstatechange = null;
160
     this.oniceconnectionstatechange = null;
158
-    this.peerconnection.oniceconnectionstatechange = function(event) {
159
-        self.trace('oniceconnectionstatechange', self.iceConnectionState);
160
-        if (self.oniceconnectionstatechange !== null) {
161
-            self.oniceconnectionstatechange(event);
161
+    this.peerconnection.oniceconnectionstatechange = event => {
162
+        this.trace('oniceconnectionstatechange', this.iceConnectionState);
163
+        if (this.oniceconnectionstatechange !== null) {
164
+            this.oniceconnectionstatechange(event);
162
         }
165
         }
163
     };
166
     };
164
     this.onnegotiationneeded = null;
167
     this.onnegotiationneeded = null;
165
-    this.peerconnection.onnegotiationneeded = function(event) {
166
-        self.trace('onnegotiationneeded');
167
-        if (self.onnegotiationneeded !== null) {
168
-            self.onnegotiationneeded(event);
168
+    this.peerconnection.onnegotiationneeded = event => {
169
+        this.trace('onnegotiationneeded');
170
+        if (this.onnegotiationneeded !== null) {
171
+            this.onnegotiationneeded(event);
169
         }
172
         }
170
     };
173
     };
171
-    self.ondatachannel = null;
172
-    this.peerconnection.ondatachannel = function(event) {
173
-        self.trace('ondatachannel', event);
174
-        if (self.ondatachannel !== null) {
175
-            self.ondatachannel(event);
174
+    this.ondatachannel = null;
175
+    this.peerconnection.ondatachannel = event => {
176
+        this.trace('ondatachannel', event);
177
+        if (this.ondatachannel !== null) {
178
+            this.ondatachannel(event);
176
         }
179
         }
177
     };
180
     };
178
 
181
 
179
     // XXX: do all non-firefox browsers which we support also support this?
182
     // XXX: do all non-firefox browsers which we support also support this?
180
     if (!RTCBrowserType.isFirefox() && this.maxstats) {
183
     if (!RTCBrowserType.isFirefox() && this.maxstats) {
181
         this.statsinterval = window.setInterval(() => {
184
         this.statsinterval = window.setInterval(() => {
182
-            self.peerconnection.getStats(stats => {
185
+            this.peerconnection.getStats(stats => {
183
                 const results = stats.result();
186
                 const results = stats.result();
184
                 const now = new Date();
187
                 const now = new Date();
185
 
188
 
187
                     results[i].names().forEach(name => {
190
                     results[i].names().forEach(name => {
188
                         // eslint-disable-next-line no-shadow
191
                         // eslint-disable-next-line no-shadow
189
                         const id = `${results[i].id}-${name}`;
192
                         const id = `${results[i].id}-${name}`;
190
-                        let s = self.stats[id];
193
+                        let s = this.stats[id];
191
 
194
 
192
                         if (!s) {
195
                         if (!s) {
193
-                            self.stats[id] = s = {
196
+                            this.stats[id] = s = {
194
                                 startTime: now,
197
                                 startTime: now,
195
                                 endTime: now,
198
                                 endTime: now,
196
                                 values: [],
199
                                 values: [],
199
                         }
202
                         }
200
                         s.values.push(results[i].stat(name));
203
                         s.values.push(results[i].stat(name));
201
                         s.times.push(now.getTime());
204
                         s.times.push(now.getTime());
202
-                        if (s.values.length > self.maxstats) {
205
+                        if (s.values.length > this.maxstats) {
203
                             s.values.shift();
206
                             s.values.shift();
204
                             s.times.shift();
207
                             s.times.shift();
205
                         }
208
                         }
207
                     });
210
                     });
208
                 }
211
                 }
209
             });
212
             });
210
-
211
         }, 1000);
213
         }, 1000);
212
     }
214
     }
213
 }
215
 }
214
 
216
 
217
+/* eslint-enable max-params */
218
+
215
 /**
219
 /**
216
  * Returns a string representation of a SessionDescription object.
220
  * Returns a string representation of a SessionDescription object.
217
  */
221
  */

+ 9
- 2
modules/statistics/CallStats.js 查看文件

181
     }
181
     }
182
 });
182
 });
183
 
183
 
184
+/* eslint-disable max-params */
185
+
184
 /**
186
 /**
185
  * Lets CallStats module know where is given SSRC rendered by providing renderer
187
  * Lets CallStats module know where is given SSRC rendered by providing renderer
186
  * tag ID.
188
  * tag ID.
193
  * @param containerId {string} the id of media 'audio' or 'video' tag which
195
  * @param containerId {string} the id of media 'audio' or 'video' tag which
194
  *        renders the stream.
196
  *        renders the stream.
195
  */
197
  */
196
-CallStats.prototype.associateStreamWithVideoTag
197
-= function(ssrc, isLocal, usageLabel, containerId) {
198
+CallStats.prototype.associateStreamWithVideoTag = function(
199
+        ssrc,
200
+        isLocal,
201
+        usageLabel,
202
+        containerId) {
198
     if (!callStats) {
203
     if (!callStats) {
199
         return;
204
         return;
200
     }
205
     }
234
     }).bind(this)();
239
     }).bind(this)();
235
 };
240
 };
236
 
241
 
242
+/* eslint-enable max-params */
243
+
237
 /**
244
 /**
238
  * Notifies CallStats for mute events
245
  * Notifies CallStats for mute events
239
  * @param mute {boolean} true for muted and false for not muted
246
  * @param mute {boolean} true for muted and false for not muted

+ 4
- 0
modules/statistics/RTPStatsCollector.js 查看文件

149
     this.transport = [];
149
     this.transport = [];
150
 }
150
 }
151
 
151
 
152
+/* eslint-disable max-params */
153
+
152
 /**
154
 /**
153
  * <tt>StatsCollector</tt> registers for stats updates of given
155
  * <tt>StatsCollector</tt> registers for stats updates of given
154
  * <tt>peerconnection</tt> in given <tt>interval</tt>. On each update particular
156
  * <tt>peerconnection</tt> in given <tt>interval</tt>. On each update particular
218
     this.ssrc2stats = {};
220
     this.ssrc2stats = {};
219
 }
221
 }
220
 
222
 
223
+/* eslint-enable max-params */
224
+
221
 module.exports = StatsCollector;
225
 module.exports = StatsCollector;
222
 
226
 
223
 /**
227
 /**

+ 15
- 7
modules/statistics/statistics.js 查看文件

321
     }
321
     }
322
 };
322
 };
323
 
323
 
324
+/* eslint-disable max-params */
325
+
324
 /**
326
 /**
325
  * Lets the underlying statistics module know where is given SSRC rendered by
327
  * Lets the underlying statistics module know where is given SSRC rendered by
326
  * providing renderer tag ID.
328
  * providing renderer tag ID.
332
  * @param containerId {string} the id of media 'audio' or 'video' tag which
334
  * @param containerId {string} the id of media 'audio' or 'video' tag which
333
  *        renders the stream.
335
  *        renders the stream.
334
  */
336
  */
335
-Statistics.prototype.associateStreamWithVideoTag
336
-= function(ssrc, isLocal, usageLabel, containerId) {
337
-    if (this.callstats) {
338
-        this.callstats.associateStreamWithVideoTag(
339
-            ssrc, isLocal, usageLabel, containerId);
340
-    }
341
-};
337
+Statistics.prototype.associateStreamWithVideoTag = function(
338
+        ssrc,
339
+        isLocal,
340
+        usageLabel,
341
+        containerId) {
342
+    this.callstats && this.callstats.associateStreamWithVideoTag(
343
+        ssrc,
344
+        isLocal,
345
+        usageLabel,
346
+        containerId);
347
+};
348
+
349
+/* eslint-enable max-params */
342
 
350
 
343
 /**
351
 /**
344
  * Notifies CallStats that getUserMedia failed.
352
  * Notifies CallStats that getUserMedia failed.

+ 4
- 0
modules/transcription/recordingResult.js 查看文件

1
+/* eslint-disable max-params */
2
+
1
 /**
3
 /**
2
  * This object stores variables needed around the recording of an audio stream
4
  * This object stores variables needed around the recording of an audio stream
3
  * and passing this recording along with additional information along to
5
  * and passing this recording along with additional information along to
15
     this.wordArray = wordArray;
17
     this.wordArray = wordArray;
16
 };
18
 };
17
 
19
 
20
+/* eslint-enable max-params */
21
+
18
 module.exports = RecordingResult;
22
 module.exports = RecordingResult;

+ 3
- 5
modules/util/GlobalOnErrorHandler.js 查看文件

18
  * Custom error handler that calls the old global error handler and executes
18
  * Custom error handler that calls the old global error handler and executes
19
  * all handlers that were previously added.
19
  * all handlers that were previously added.
20
  */
20
  */
21
-function JitsiGlobalErrorHandler(message, source, lineno, colno, error) {
22
-    handlers.forEach(handler => handler(message, source, lineno, colno, error));
23
-    if (oldOnErrorHandler) {
24
-        oldOnErrorHandler(message, source, lineno, colno, error);
25
-    }
21
+function JitsiGlobalErrorHandler(...args) {
22
+    handlers.forEach(handler => handler(...args));
23
+    oldOnErrorHandler && oldOnErrorHandler(...args);
26
 }
24
 }
27
 
25
 
28
 // If an old handler exists, also fire its events.
26
 // If an old handler exists, also fire its events.

+ 10
- 2
modules/util/ScriptUtil.js 查看文件

1
 const currentExecutingScript = require('current-executing-script');
1
 const currentExecutingScript = require('current-executing-script');
2
 
2
 
3
+/* eslint-disable max-params */
3
 
4
 
4
 /**
5
 /**
5
  * Implements utility functions which facilitate the dealing with scripts such
6
  * Implements utility functions which facilitate the dealing with scripts such
21
      * @param loadCallback on load callback function
22
      * @param loadCallback on load callback function
22
      * @param errorCallback callback to be called on error loading the script
23
      * @param errorCallback callback to be called on error loading the script
23
      */
24
      */
24
-    loadScript(src, async, prepend, relativeURL,
25
-                          loadCallback, errorCallback) {
25
+    loadScript(
26
+            src,
27
+            async,
28
+            prepend,
29
+            relativeURL,
30
+            loadCallback,
31
+            errorCallback) {
26
         const d = document;
32
         const d = document;
27
         const tagName = 'script';
33
         const tagName = 'script';
28
         const script = d.createElement(tagName);
34
         const script = d.createElement(tagName);
63
     }
69
     }
64
 };
70
 };
65
 
71
 
72
+/* eslint-enable max-params */
73
+
66
 module.exports = ScriptUtil;
74
 module.exports = ScriptUtil;

+ 9
- 0
modules/xmpp/ChatRoom.js 查看文件

77
 /* eslint-disable newline-per-chained-call */
77
 /* eslint-disable newline-per-chained-call */
78
 
78
 
79
 export default class ChatRoom extends Listenable {
79
 export default class ChatRoom extends Listenable {
80
+
81
+    /* eslint-disable max-params */
82
+
80
     constructor(connection, jid, password, XMPP, options) {
83
     constructor(connection, jid, password, XMPP, options) {
81
         super();
84
         super();
82
         this.xmpp = XMPP;
85
         this.xmpp = XMPP;
108
         this.locked = false;
111
         this.locked = false;
109
     }
112
     }
110
 
113
 
114
+    /* eslint-enable max-params */
115
+
111
     initPresenceMap() {
116
     initPresenceMap() {
112
         this.presMap.to = this.myroomjid;
117
         this.presMap.to = this.myroomjid;
113
         this.presMap.xns = 'http://jabber.org/protocol/muc';
118
         this.presMap.xns = 'http://jabber.org/protocol/muc';
717
             error => logger.log('Kick participant error: ', error));
722
             error => logger.log('Kick participant error: ', error));
718
     }
723
     }
719
 
724
 
725
+    /* eslint-disable max-params */
726
+
720
     lockRoom(key, onSuccess, onError, onNotSupported) {
727
     lockRoom(key, onSuccess, onError, onNotSupported) {
721
         // http://xmpp.org/extensions/xep-0045.html#roomconfig
728
         // http://xmpp.org/extensions/xep-0045.html#roomconfig
722
         this.connection.sendIQ(
729
         this.connection.sendIQ(
775
             onError);
782
             onError);
776
     }
783
     }
777
 
784
 
785
+    /* eslint-enable max-params */
786
+
778
     addToPresence(key, values) {
787
     addToPresence(key, values) {
779
         values.tagName = key;
788
         values.tagName = key;
780
         this.removeFromPresence(key);
789
         this.removeFromPresence(key);

+ 12
- 3
modules/xmpp/JingleSession.js 查看文件

11
  */
11
  */
12
 export default class JingleSession {
12
 export default class JingleSession {
13
 
13
 
14
+    /* eslint-disable max-params */
15
+
14
     /**
16
     /**
15
      * Creates new <tt>JingleSession</tt>.
17
      * Creates new <tt>JingleSession</tt>.
16
      * @param {string} sid the Jingle session identifier
18
      * @param {string} sid the Jingle session identifier
22
      * @param {Object} iceConfig the ICE servers config object as defined by
24
      * @param {Object} iceConfig the ICE servers config object as defined by
23
      * the WebRTC. Passed to the PeerConnection's constructor.
25
      * the WebRTC. Passed to the PeerConnection's constructor.
24
      */
26
      */
25
-    constructor(sid,
26
-                localJid, peerjid, connection, mediaConstraints, iceConfig) {
27
+    constructor(
28
+            sid,
29
+            localJid,
30
+            peerjid,
31
+            connection,
32
+            mediaConstraints,
33
+            iceConfig) {
27
         this.sid = sid;
34
         this.sid = sid;
28
         this.localJid = localJid;
35
         this.localJid = localJid;
29
         this.peerjid = peerjid;
36
         this.peerjid = peerjid;
61
         this.rtc = null;
68
         this.rtc = null;
62
     }
69
     }
63
 
70
 
71
+    /* eslint-enable max-params */
72
+
64
     /**
73
     /**
65
      * Prepares this object to initiate a session.
74
      * Prepares this object to initiate a session.
66
      * @param {boolean} isInitiator whether we will be the Jingle initiator.
75
      * @param {boolean} isInitiator whether we will be the Jingle initiator.
133
      * @param failure a callback called when either timeout occurs or ERROR
142
      * @param failure a callback called when either timeout occurs or ERROR
134
      * response is received.
143
      * response is received.
135
      */
144
      */
136
-    // eslint-disable-next-line no-unused-vars, no-empty-function
145
+    // eslint-disable-next-line max-params, no-unused-vars, no-empty-function
137
     terminate(reason, text, success, failure) { }
146
     terminate(reason, text, success, failure) { }
138
 
147
 
139
     /**
148
     /**

+ 24
- 3
modules/xmpp/JingleSessionPC.js 查看文件

24
 
24
 
25
 export default class JingleSessionPC extends JingleSession {
25
 export default class JingleSessionPC extends JingleSession {
26
 
26
 
27
+    /* eslint-disable max-params */
28
+
27
     /**
29
     /**
28
      * Creates new <tt>JingleSessionPC</tt>
30
      * Creates new <tt>JingleSessionPC</tt>
29
      * @param {string} sid the Jingle Session ID - random string which
31
      * @param {string} sid the Jingle Session ID - random string which
48
      *
50
      *
49
      * @implements {SignalingLayer}
51
      * @implements {SignalingLayer}
50
      */
52
      */
51
-    constructor(sid, me, peerjid, connection,
52
-                mediaConstraints, iceConfig, options) {
53
+    constructor(
54
+            sid,
55
+            me,
56
+            peerjid,
57
+            connection,
58
+            mediaConstraints,
59
+            iceConfig,
60
+            options) {
53
         super(sid, me, peerjid, connection, mediaConstraints, iceConfig);
61
         super(sid, me, peerjid, connection, mediaConstraints, iceConfig);
54
 
62
 
55
         this.lasticecandidate = false;
63
         this.lasticecandidate = false;
98
             = async.queue(this._processQueueTasks.bind(this), 1);
106
             = async.queue(this._processQueueTasks.bind(this), 1);
99
     }
107
     }
100
 
108
 
109
+    /* eslint-enable max-params */
110
+
101
     doInitialize() {
111
     doInitialize() {
102
         this.lasticecandidate = false;
112
         this.lasticecandidate = false;
103
 
113
 
623
             IQ_TIMEOUT);
633
             IQ_TIMEOUT);
624
     }
634
     }
625
 
635
 
636
+    /* eslint-disable max-params */
637
+
626
     /**
638
     /**
627
      * @inheritDoc
639
      * @inheritDoc
628
      */
640
      */
658
         this.connection.jingle.terminate(this.sid);
670
         this.connection.jingle.terminate(this.sid);
659
     }
671
     }
660
 
672
 
673
+    /* eslint-enable max-params */
674
+
661
     onTerminated(reasonCondition, reasonText) {
675
     onTerminated(reasonCondition, reasonText) {
662
         this.state = 'ended';
676
         this.state = 'ended';
663
 
677
 
1147
         return removeSsrcInfo;
1161
         return removeSsrcInfo;
1148
     }
1162
     }
1149
 
1163
 
1164
+    /* eslint-disable max-params */
1165
+
1150
     /**
1166
     /**
1151
      * Adds stream.
1167
      * Adds stream.
1152
      * @param stream new stream that will be added.
1168
      * @param stream new stream that will be added.
1166
      *  the 'doReplaceStream' task or the 'doAddStream' task (for example)
1182
      *  the 'doReplaceStream' task or the 'doAddStream' task (for example)
1167
      */
1183
      */
1168
     addStream(stream, callback, errorCallback, ssrcInfo, dontModifySources) {
1184
     addStream(stream, callback, errorCallback, ssrcInfo, dontModifySources) {
1169
-
1170
         const workFunction = finishedCallback => {
1185
         const workFunction = finishedCallback => {
1171
             if (!this.peerconnection) {
1186
             if (!this.peerconnection) {
1172
                 finishedCallback(
1187
                 finishedCallback(
1212
             });
1227
             });
1213
     }
1228
     }
1214
 
1229
 
1230
+    /* eslint-enable max-params */
1231
+
1215
     /**
1232
     /**
1216
      * Generate ssrc info object for a stream with the following properties:
1233
      * Generate ssrc info object for a stream with the following properties:
1217
      * - ssrcs - Array of the ssrcs associated with the stream.
1234
      * - ssrcs - Array of the ssrcs associated with the stream.
1291
         }
1308
         }
1292
     }
1309
     }
1293
 
1310
 
1311
+    /* eslint-disable max-params */
1312
+
1294
     /**
1313
     /**
1295
      * Remove streams.
1314
      * Remove streams.
1296
      * @param stream stream that will be removed.
1315
      * @param stream stream that will be removed.
1339
             });
1358
             });
1340
     }
1359
     }
1341
 
1360
 
1361
+    /* eslint-enable max-params */
1362
+
1342
     /**
1363
     /**
1343
      * Figures out added/removed ssrcs and send update IQs.
1364
      * Figures out added/removed ssrcs and send update IQs.
1344
      * @param oldSDP SDP object for old description.
1365
      * @param oldSDP SDP object for old description.

+ 7
- 3
modules/xmpp/moderator.js 查看文件

11
 function createExpBackoffTimer(step) {
11
 function createExpBackoffTimer(step) {
12
     let count = 1;
12
     let count = 1;
13
 
13
 
14
-
15
     return function(reset) {
14
     return function(reset) {
16
         // Reset call
15
         // Reset call
17
         if (reset) {
16
         if (reset) {
29
     };
28
     };
30
 }
29
 }
31
 
30
 
31
+/* eslint-disable max-params */
32
+
32
 function Moderator(roomName, xmpp, emitter, options) {
33
 function Moderator(roomName, xmpp, emitter, options) {
33
     this.roomName = roomName;
34
     this.roomName = roomName;
34
     this.xmppService = xmpp;
35
     this.xmppService = xmpp;
42
     // Sip gateway can be enabled by configuring Jigasi host in config.js or
43
     // Sip gateway can be enabled by configuring Jigasi host in config.js or
43
     // it will be enabled automatically if focus detects the component through
44
     // it will be enabled automatically if focus detects the component through
44
     // service discovery.
45
     // service discovery.
45
-    this.sipGatewayEnabled = this.options.connection.hosts
46
-        && this.options.connection.hosts.call_control !== undefined;
46
+    this.sipGatewayEnabled
47
+        = this.options.connection.hosts
48
+            && this.options.connection.hosts.call_control !== undefined;
47
 
49
 
48
     this.eventEmitter = emitter;
50
     this.eventEmitter = emitter;
49
 
51
 
74
     }
76
     }
75
 }
77
 }
76
 
78
 
79
+/* eslint-enable max-params */
80
+
77
 Moderator.prototype.isExternalAuthEnabled = function() {
81
 Moderator.prototype.isExternalAuthEnabled = function() {
78
     return this.externalAuthEnabled;
82
     return this.externalAuthEnabled;
79
 };
83
 };

+ 75
- 47
modules/xmpp/recording.js 查看文件

6
 const JitsiRecorderErrors = require('../../JitsiRecorderErrors');
6
 const JitsiRecorderErrors = require('../../JitsiRecorderErrors');
7
 const GlobalOnErrorHandler = require('../util/GlobalOnErrorHandler');
7
 const GlobalOnErrorHandler = require('../util/GlobalOnErrorHandler');
8
 
8
 
9
-function Recording(type, eventEmitter, connection, focusMucJid, jirecon,
10
-    roomjid) {
9
+/* eslint-disable max-params */
10
+
11
+function Recording(
12
+        type,
13
+        eventEmitter,
14
+        connection,
15
+        focusMucJid,
16
+        jirecon,
17
+        roomjid) {
11
     this.eventEmitter = eventEmitter;
18
     this.eventEmitter = eventEmitter;
12
     this.connection = connection;
19
     this.connection = connection;
13
     this.state = null;
20
     this.state = null;
30
     this.roomjid = roomjid;
37
     this.roomjid = roomjid;
31
 }
38
 }
32
 
39
 
40
+/* eslint-enable max-params */
41
+
33
 Recording.types = {
42
 Recording.types = {
34
     COLIBRI: 'colibri',
43
     COLIBRI: 'colibri',
35
     JIRECON: 'jirecon',
44
     JIRECON: 'jirecon',
84
     this.eventEmitter.emit(XMPPEvents.RECORDER_STATE_CHANGED, this.state);
93
     this.eventEmitter.emit(XMPPEvents.RECORDER_STATE_CHANGED, this.state);
85
 };
94
 };
86
 
95
 
87
-Recording.prototype.setRecordingJibri
88
-    = function(state, callback, errCallback, options = {}) {
96
+/* eslint-disable max-params */
89
 
97
 
90
-        if (state === this.state) {
91
-            errCallback(JitsiRecorderErrors.INVALID_STATE);
92
-        }
93
-
94
-        // FIXME jibri does not accept IQ without 'url' attribute set ?
95
-        const iq
96
-            = $iq({ to: this.focusMucJid,
97
-                type: 'set' })
98
-                .c('jibri', {
99
-                    'xmlns': 'http://jitsi.org/protocol/jibri',
100
-                    'action': state === Recording.status.ON
101
-                            ? Recording.action.START
102
-                            : Recording.action.STOP,
103
-                    'streamid': options.streamId
104
-                })
105
-                .up();
106
-
107
-        logger.log(`Set jibri recording: ${state}`, iq.nodeTree);
108
-        logger.log(iq.nodeTree);
109
-        this.connection.sendIQ(
110
-        iq,
111
-        result => {
112
-            logger.log('Result', result);
98
+Recording.prototype.setRecordingJibri = function(
99
+        state,
100
+        callback,
101
+        errCallback,
102
+        options = {}) {
103
+    if (state === this.state) {
104
+        errCallback(JitsiRecorderErrors.INVALID_STATE);
105
+    }
113
 
106
 
114
-            const jibri = $(result).find('jibri');
107
+    // FIXME jibri does not accept IQ without 'url' attribute set ?
108
+    const iq
109
+        = $iq({
110
+            to: this.focusMucJid,
111
+            type: 'set'
112
+        })
113
+            .c('jibri', {
114
+                'xmlns': 'http://jitsi.org/protocol/jibri',
115
+                'action': state === Recording.status.ON
116
+                        ? Recording.action.START
117
+                        : Recording.action.STOP,
118
+                'streamid': options.streamId
119
+            })
120
+            .up();
121
+
122
+    logger.log(`Set jibri recording: ${state}`, iq.nodeTree);
123
+    logger.log(iq.nodeTree);
124
+    this.connection.sendIQ(
125
+    iq,
126
+    result => {
127
+        logger.log('Result', result);
128
+
129
+        const jibri = $(result).find('jibri');
130
+
131
+        callback(jibri.attr('state'), jibri.attr('url'));
132
+    },
133
+    error => {
134
+        logger.log('Failed to start recording, error: ', error);
135
+        errCallback(error);
136
+    });
137
+};
115
 
138
 
116
-            callback(jibri.attr('state'), jibri.attr('url'));
117
-        },
118
-        error => {
119
-            logger.log('Failed to start recording, error: ', error);
120
-            errCallback(error);
121
-        });
122
-    };
139
+/* eslint-enable max-params */
123
 
140
 
124
 Recording.prototype.setRecordingJirecon
141
 Recording.prototype.setRecordingJirecon
125
     = function(state, callback, errCallback) {
142
     = function(state, callback, errCallback) {
166
         });
183
         });
167
     };
184
     };
168
 
185
 
186
+/* eslint-disable max-params */
187
+
169
 // Sends a COLIBRI message which enables or disables (according to 'state')
188
 // Sends a COLIBRI message which enables or disables (according to 'state')
170
 // the recording on the bridge. Waits for the result IQ and calls 'callback'
189
 // the recording on the bridge. Waits for the result IQ and calls 'callback'
171
 // with the new recording state, according to the IQ.
190
 // with the new recording state, according to the IQ.
172
-Recording.prototype.setRecordingColibri
173
-= function(state, callback, errCallback, options) {
174
-    const elem = $iq({ to: this.focusMucJid,
175
-        type: 'set' });
191
+Recording.prototype.setRecordingColibri = function(
192
+        state,
193
+        callback,
194
+        errCallback,
195
+        options) {
196
+    const elem = $iq({
197
+        to: this.focusMucJid,
198
+        type: 'set'
199
+    });
176
 
200
 
177
     elem.c('conference', {
201
     elem.c('conference', {
178
         xmlns: 'http://jitsi.org/protocol/colibri'
202
         xmlns: 'http://jitsi.org/protocol/colibri'
179
     });
203
     });
180
-    elem.c('recording', { state,
181
-        token: options.token });
204
+    elem.c('recording', {
205
+        state,
206
+        token: options.token
207
+    });
182
 
208
 
183
     const self = this;
209
     const self = this;
184
 
210
 
185
-    this.connection.sendIQ(elem,
211
+    this.connection.sendIQ(
212
+        elem,
186
         result => {
213
         result => {
187
             logger.log('Set recording "', state, '". Result:', result);
214
             logger.log('Set recording "', state, '". Result:', result);
188
             const recordingElem = $(result).find('>conference>recording');
215
             const recordingElem = $(result).find('>conference>recording');
210
     );
237
     );
211
 };
238
 };
212
 
239
 
213
-Recording.prototype.setRecording
214
-= function(state, callback, errCallback, options) {
240
+/* eslint-enable max-params */
241
+
242
+Recording.prototype.setRecording = function(...args) {
215
     switch (this.type) {
243
     switch (this.type) {
216
     case Recording.types.JIRECON:
244
     case Recording.types.JIRECON:
217
-        this.setRecordingJirecon(state, callback, errCallback, options);
245
+        this.setRecordingJirecon(...args);
218
         break;
246
         break;
219
     case Recording.types.COLIBRI:
247
     case Recording.types.COLIBRI:
220
-        this.setRecordingColibri(state, callback, errCallback, options);
248
+        this.setRecordingColibri(...args);
221
         break;
249
         break;
222
     case Recording.types.JIBRI:
250
     case Recording.types.JIBRI:
223
-        this.setRecordingJibri(state, callback, errCallback, options);
251
+        this.setRecordingJibri(...args);
224
         break;
252
         break;
225
     default: {
253
     default: {
226
         const errmsg = 'Unknown recording type!';
254
         const errmsg = 'Unknown recording type!';

+ 9
- 4
modules/xmpp/strophe.ping.js 查看文件

47
         Strophe.addNamespace('PING', 'urn:xmpp:ping');
47
         Strophe.addNamespace('PING', 'urn:xmpp:ping');
48
     }
48
     }
49
 
49
 
50
+    /* eslint-disable max-params */
51
+
50
     /**
52
     /**
51
      * Sends "ping" to given <tt>jid</tt>
53
      * Sends "ping" to given <tt>jid</tt>
52
      * @param jid the JID to which ping request will be sent.
54
      * @param jid the JID to which ping request will be sent.
53
      * @param success callback called on success.
55
      * @param success callback called on success.
54
      * @param error callback called on error.
56
      * @param error callback called on error.
55
      * @param timeout ms how long are we going to wait for the response. On
57
      * @param timeout ms how long are we going to wait for the response. On
56
-     *        timeout <tt>error<//t> callback is called with undefined error
57
-     *        argument.
58
+     * timeout <tt>error<//t> callback is called with undefined error argument.
58
      */
59
      */
59
     ping(jid, success, error, timeout) {
60
     ping(jid, success, error, timeout) {
60
-        const iq = $iq({ type: 'get',
61
-            to: jid });
61
+        const iq = $iq({
62
+            type: 'get',
63
+            to: jid
64
+        });
62
 
65
 
63
         iq.c('ping', { xmlns: Strophe.NS.PING });
66
         iq.c('ping', { xmlns: Strophe.NS.PING });
64
         this.connection.sendIQ(iq, success, error, timeout);
67
         this.connection.sendIQ(iq, success, error, timeout);
65
     }
68
     }
66
 
69
 
70
+    /* eslint-enable max-params */
71
+
67
     /**
72
     /**
68
      * Checks if given <tt>jid</tt> has XEP-0199 ping support.
73
      * Checks if given <tt>jid</tt> has XEP-0199 ping support.
69
      * @param jid the JID to be checked for ping support.
74
      * @param jid the JID to be checked for ping support.

+ 20
- 13
modules/xmpp/strophe.rayo.js 查看文件

19
         logger.info('Rayo IQ', iq);
19
         logger.info('Rayo IQ', iq);
20
     }
20
     }
21
 
21
 
22
+    /* eslint-disable max-params */
23
+
22
     dial(to, from, roomName, roomPass, focusMucJid) {
24
     dial(to, from, roomName, roomPass, focusMucJid) {
23
         return new Promise((resolve, reject) => {
25
         return new Promise((resolve, reject) => {
24
             if (!focusMucJid) {
26
             if (!focusMucJid) {
48
                 }).up();
50
                 }).up();
49
             }
51
             }
50
 
52
 
51
-            this.connection.sendIQ(req, result => {
52
-                logger.info('Dial result ', result);
53
-
54
-                // eslint-disable-next-line newline-per-chained-call
55
-                const resource = $(result).find('ref').attr('uri');
56
-
57
-                this.callResource = resource.substr('xmpp:'.length);
58
-                logger.info(`Received call resource: ${this.callResource}`);
59
-                resolve();
60
-            }, error => {
61
-                logger.info('Dial error ', error);
62
-                reject(error);
63
-            });
53
+            this.connection.sendIQ(
54
+                req,
55
+                result => {
56
+                    logger.info('Dial result ', result);
57
+
58
+                    // eslint-disable-next-line newline-per-chained-call
59
+                    const resource = $(result).find('ref').attr('uri');
60
+
61
+                    this.callResource = resource.substr('xmpp:'.length);
62
+                    logger.info(`Received call resource: ${this.callResource}`);
63
+                    resolve();
64
+                },
65
+                error => {
66
+                    logger.info('Dial error ', error);
67
+                    reject(error);
68
+                });
64
         });
69
         });
65
     }
70
     }
66
 
71
 
72
+    /* eslint-enable max-params */
73
+
67
     hangup() {
74
     hangup() {
68
         return new Promise((resolve, reject) => {
75
         return new Promise((resolve, reject) => {
69
             if (!this.callResource) {
76
             if (!this.callResource) {

+ 2
- 2
modules/xmpp/xmpp.js 查看文件

324
         return (this.connection.logger || {}).log || null;
324
         return (this.connection.logger || {}).log || null;
325
     }
325
     }
326
 
326
 
327
-    dial(to, from, roomName, roomPass) {
328
-        this.connection.rayo.dial(to, from, roomName, roomPass);
327
+    dial(...args) {
328
+        this.connection.rayo.dial(...args);
329
     }
329
     }
330
 
330
 
331
     setMute(jid, mute) {
331
     setMute(jid, mute) {

正在加载...
取消
保存