Lyubo Marinov 8 лет назад
Родитель
Сommit
de61af8b2d

+ 10
- 0
.eslintrc.js Просмотреть файл

@@ -231,6 +231,16 @@ module.exports = {
231 231
         'padded-blocks': 0,
232 232
         'quote-props': 0,
233 233
         'quotes': [ 'error', 'single' ],
234
+        'require-jsdoc': [
235
+            'error',
236
+            {
237
+                'require': {
238
+                    'ClassDeclaration': true,
239
+                    'FunctionDeclaration': true,
240
+                    'MethodDefinition': true
241
+                }
242
+            }
243
+        ],
234 244
         'semi': [ 'error', 'always' ],
235 245
         'semi-spacing': 2,
236 246
         'sort-vars': 2,

+ 4
- 0
JitsiMeetJS.js Просмотреть файл

@@ -31,6 +31,10 @@ const logger = Logger.getLogger(__filename);
31 31
 // JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN event
32 32
 const USER_MEDIA_PERMISSION_PROMPT_TIMEOUT = 500;
33 33
 
34
+/**
35
+ *
36
+ * @param resolution
37
+ */
34 38
 function getLowerResolution(resolution) {
35 39
     if (!Resolutions[resolution]) {
36 40
         return null;

+ 3
- 0
JitsiParticipant.js Просмотреть файл

@@ -205,6 +205,9 @@ export default class JitsiParticipant {
205 205
         return this._role;
206 206
     }
207 207
 
208
+    /**
209
+     *
210
+     */
208 211
     supportsDTMF() {
209 212
         return this._supportsDTMF;
210 213
     }

+ 14
- 0
doc/example/example.js Просмотреть файл

@@ -108,6 +108,10 @@ function onConferenceJoined() {
108 108
     }
109 109
 }
110 110
 
111
+/**
112
+ *
113
+ * @param id
114
+ */
111 115
 function onUserLeft(id) {
112 116
     console.log('user left');
113 117
     if (!remoteTracks[id]) {
@@ -190,6 +194,9 @@ function disconnect() {
190 194
         disconnect);
191 195
 }
192 196
 
197
+/**
198
+ *
199
+ */
193 200
 function unload() {
194 201
     for (let i = 0; i < localTracks.length; i++) {
195 202
         localTracks[i].stop();
@@ -200,6 +207,9 @@ function unload() {
200 207
 
201 208
 let isVideo = true;
202 209
 
210
+/**
211
+ *
212
+ */
203 213
 function switchVideo() { // eslint-disable-line no-unused-vars
204 214
     isVideo = !isVideo;
205 215
     if (localTracks[1]) {
@@ -222,6 +232,10 @@ function switchVideo() { // eslint-disable-line no-unused-vars
222 232
         .catch(error => console.log(error));
223 233
 }
224 234
 
235
+/**
236
+ *
237
+ * @param selected
238
+ */
225 239
 function changeAudioOutput(selected) { // eslint-disable-line no-unused-vars
226 240
     JitsiMeetJS.mediaDevices.setAudioOutputDevice(selected.value);
227 241
 }

+ 5
- 1
modules/DTMF/JitsiDTMFManager.js Просмотреть файл

@@ -1,5 +1,10 @@
1 1
 const logger = require('jitsi-meet-logger').getLogger(__filename);
2 2
 
3
+/**
4
+ *
5
+ * @param localAudio
6
+ * @param peerConnection
7
+ */
3 8
 function JitsiDTMFManager(localAudio, peerConnection) {
4 9
     const audioTrack = localAudio.getTrack();
5 10
 
@@ -11,7 +16,6 @@ function JitsiDTMFManager(localAudio, peerConnection) {
11 16
     logger.debug('Initialized DTMFSender');
12 17
 }
13 18
 
14
-
15 19
 JitsiDTMFManager.prototype.sendTones = function(tones, duration, pause) {
16 20
     this.dtmfSender.insertDTMF(tones, duration || 200, pause || 200);
17 21
 };

+ 58
- 0
modules/RTC/RTC.js Просмотреть файл

@@ -15,6 +15,11 @@ import VideoType from '../../service/RTC/VideoType';
15 15
 
16 16
 const logger = getLogger(__filename);
17 17
 
18
+/**
19
+ *
20
+ * @param tracksInfo
21
+ * @param options
22
+ */
18 23
 function createLocalTracks(tracksInfo, options) {
19 24
     const newTracks = [];
20 25
     let deviceId = null;
@@ -41,7 +46,15 @@ function createLocalTracks(tracksInfo, options) {
41 46
     return newTracks;
42 47
 }
43 48
 
49
+/**
50
+ *
51
+ */
44 52
 export default class RTC extends Listenable {
53
+    /**
54
+     *
55
+     * @param conference
56
+     * @param options
57
+     */
45 58
     constructor(conference, options = {}) {
46 59
         super();
47 60
         this.conference = conference;
@@ -198,24 +211,44 @@ export default class RTC extends Listenable {
198 211
         }
199 212
     }
200 213
 
214
+    /**
215
+     *
216
+     * @param eventType
217
+     * @param listener
218
+     */
201 219
     static addListener(eventType, listener) {
202 220
         RTCUtils.addListener(eventType, listener);
203 221
     }
204 222
 
223
+    /**
224
+     *
225
+     * @param eventType
226
+     * @param listener
227
+     */
205 228
     static removeListener(eventType, listener) {
206 229
         RTCUtils.removeListener(eventType, listener);
207 230
     }
208 231
 
232
+    /**
233
+     *
234
+     */
209 235
     static isRTCReady() {
210 236
         return RTCUtils.isRTCReady();
211 237
     }
212 238
 
239
+    /**
240
+     *
241
+     * @param options
242
+     */
213 243
     static init(options = {}) {
214 244
         this.options = options;
215 245
 
216 246
         return RTCUtils.init(this.options);
217 247
     }
218 248
 
249
+    /**
250
+     *
251
+     */
219 252
     static getDeviceAvailability() {
220 253
         return RTCUtils.getDeviceAvailability();
221 254
     }
@@ -269,6 +302,10 @@ export default class RTC extends Listenable {
269 302
 
270 303
     }
271 304
 
305
+    /**
306
+     *
307
+     * @param track
308
+     */
272 309
     addLocalTrack(track) {
273 310
         if (!track) {
274 311
             throw new Error('track must not be null nor undefined');
@@ -401,6 +438,10 @@ export default class RTC extends Listenable {
401 438
         return Promise.all(mutePromises);
402 439
     }
403 440
 
441
+    /**
442
+     *
443
+     * @param track
444
+     */
404 445
     removeLocalTrack(track) {
405 446
         const pos = this.localTracks.indexOf(track);
406 447
 
@@ -546,14 +587,26 @@ export default class RTC extends Listenable {
546 587
         return toBeRemoved;
547 588
     }
548 589
 
590
+    /**
591
+     *
592
+     */
549 593
     static getPCConstraints() {
550 594
         return RTCUtils.pcConstraints;
551 595
     }
552 596
 
597
+    /**
598
+     *
599
+     * @param elSelector
600
+     * @param stream
601
+     */
553 602
     static attachMediaStream(elSelector, stream) {
554 603
         return RTCUtils.attachMediaStream(elSelector, stream);
555 604
     }
556 605
 
606
+    /**
607
+     *
608
+     * @param stream
609
+     */
557 610
     static getStreamID(stream) {
558 611
         return RTCUtils.getStreamID(stream);
559 612
     }
@@ -682,6 +735,11 @@ export default class RTC extends Listenable {
682 735
         }
683 736
     }
684 737
 
738
+    /**
739
+     *
740
+     * @param resource
741
+     * @param audioLevel
742
+     */
685 743
     setAudioLevel(resource, audioLevel) {
686 744
         if (!resource) {
687 745
             return;

+ 25
- 2
modules/RTC/RTCBrowserType.js Просмотреть файл

@@ -197,8 +197,10 @@ const RTCBrowserType = {
197 197
     // Add version getters for other browsers when needed
198 198
 };
199 199
 
200
-// detectOpera() must be called before detectChrome() !!!
201
-// otherwise Opera wil be detected as Chrome
200
+/**
201
+ * detectOpera() must be called before detectChrome() !!!
202
+ * otherwise Opera wil be detected as Chrome
203
+ */
202 204
 function detectChrome() {
203 205
     if (navigator.webkitGetUserMedia) {
204 206
         currentBrowser = RTCBrowserType.RTC_BROWSER_CHROME;
@@ -216,6 +218,9 @@ function detectChrome() {
216 218
     return null;
217 219
 }
218 220
 
221
+/**
222
+ *
223
+ */
219 224
 function detectOpera() {
220 225
     const userAgent = navigator.userAgent;
221 226
 
@@ -231,6 +236,9 @@ function detectOpera() {
231 236
     return null;
232 237
 }
233 238
 
239
+/**
240
+ *
241
+ */
234 242
 function detectFirefox() {
235 243
     if (navigator.mozGetUserMedia) {
236 244
         currentBrowser = RTCBrowserType.RTC_BROWSER_FIREFOX;
@@ -245,6 +253,9 @@ function detectFirefox() {
245 253
     return null;
246 254
 }
247 255
 
256
+/**
257
+ *
258
+ */
248 259
 function detectSafari() {
249 260
     if (/^((?!chrome).)*safari/i.test(navigator.userAgent)) {
250 261
         currentBrowser = RTCBrowserType.RTC_BROWSER_SAFARI;
@@ -257,6 +268,9 @@ function detectSafari() {
257 268
     return null;
258 269
 }
259 270
 
271
+/**
272
+ *
273
+ */
260 274
 function detectIE() {
261 275
     let version;
262 276
     const ua = window.navigator.userAgent;
@@ -310,6 +324,9 @@ function detectElectron() {
310 324
     return null;
311 325
 }
312 326
 
327
+/**
328
+ *
329
+ */
313 330
 function detectNWJS() {
314 331
     const userAgent = navigator.userAgent;
315 332
 
@@ -325,6 +342,9 @@ function detectNWJS() {
325 342
     return null;
326 343
 }
327 344
 
345
+/**
346
+ *
347
+ */
328 348
 function detectReactNative() {
329 349
     const match
330 350
         = navigator.userAgent.match(/\b(react[ \t_-]*native)(?:\/(\S+))?/i);
@@ -353,6 +373,9 @@ function detectReactNative() {
353 373
     return version;
354 374
 }
355 375
 
376
+/**
377
+ *
378
+ */
356 379
 function detectBrowser() {
357 380
     let version;
358 381
     const detectors = [

+ 43
- 6
modules/RTC/RTCUtils.js Просмотреть файл

@@ -62,14 +62,16 @@ const isAudioOutputDeviceChangeAvailable
62 62
 
63 63
 let currentlyAvailableMediaDevices;
64 64
 
65
-let rawEnumerateDevicesWithCallback;
66
-
67 65
 /**
68 66
  * "rawEnumerateDevicesWithCallback" will be initialized only after WebRTC is
69 67
  * ready. Otherwise it is too early to assume that the devices listing is not
70 68
  * supported.
71 69
  */
70
+let rawEnumerateDevicesWithCallback;
72 71
 
72
+/**
73
+ *
74
+ */
73 75
 function initRawEnumerateDevicesWithCallback() {
74 76
     rawEnumerateDevicesWithCallback = navigator.mediaDevices
75 77
         && navigator.mediaDevices.enumerateDevices
@@ -105,6 +107,11 @@ const isDeviceChangeEventSupported = false;
105 107
 
106 108
 let rtcReady = false;
107 109
 
110
+/**
111
+ *
112
+ * @param constraints
113
+ * @param resolution
114
+ */
108 115
 function setResolutionConstraints(constraints, resolution) {
109 116
     const isAndroid = RTCBrowserType.isAndroid();
110 117
 
@@ -358,6 +365,10 @@ function compareAvailableMediaDevices(newDevices) {
358 365
                 .sort()
359 366
                 .join(''));
360 367
 
368
+    /**
369
+     *
370
+     * @param info
371
+     */
361 372
     function mediaDeviceInfoToJSON(info) {
362 373
         return JSON.stringify({
363 374
             kind: info.kind,
@@ -664,12 +675,21 @@ function defaultSetVideoSrc(element, stream) {
664 675
     element.src = src || '';
665 676
 }
666 677
 
667
-// Options parameter is to pass config options. Currently uses only "useIPv6".
678
+/**
679
+ *
680
+ */
668 681
 class RTCUtils extends Listenable {
682
+    /**
683
+     *
684
+     */
669 685
     constructor() {
670 686
         super(eventEmitter);
671 687
     }
672 688
 
689
+    /**
690
+     *
691
+     * @param options
692
+     */
673 693
     init(options) {
674 694
         if (typeof options.disableAEC === 'boolean') {
675 695
             disableAEC = options.disableAEC;
@@ -1119,14 +1139,23 @@ class RTCUtils extends Listenable {
1119 1139
         });
1120 1140
     }
1121 1141
 
1142
+    /**
1143
+     *
1144
+     */
1122 1145
     getDeviceAvailability() {
1123 1146
         return devices;
1124 1147
     }
1125 1148
 
1149
+    /**
1150
+     *
1151
+     */
1126 1152
     isRTCReady() {
1127 1153
         return rtcReady;
1128 1154
     }
1129 1155
 
1156
+    /**
1157
+     *
1158
+     */
1130 1159
     _isDeviceListAvailable() {
1131 1160
         if (!rtcReady) {
1132 1161
             throw new Error('WebRTC not ready yet');
@@ -1327,6 +1356,10 @@ function rejectWithWebRTCNotSupported(errorMessage, reject) {
1327 1356
 
1328 1357
 const rtcUtils = new RTCUtils();
1329 1358
 
1359
+/**
1360
+ *
1361
+ * @param options
1362
+ */
1330 1363
 function obtainDevices(options) {
1331 1364
     if (!options.devices || options.devices.length === 0) {
1332 1365
         return options.successCallback(options.streams || {});
@@ -1350,9 +1383,13 @@ function obtainDevices(options) {
1350 1383
         });
1351 1384
 }
1352 1385
 
1353
-// In case of IE we continue from 'onReady' callback
1354
-// passed to RTCUtils constructor. It will be invoked by Temasys plugin
1355
-// once it is initialized.
1386
+/**
1387
+ * In case of IE we continue from 'onReady' callback passed to RTCUtils
1388
+ * constructor. It will be invoked by Temasys plugin once it is initialized.
1389
+ *
1390
+ * @param options
1391
+ * @param GUM
1392
+ */
1356 1393
 function onReady(options, GUM) {
1357 1394
     rtcReady = true;
1358 1395
     eventEmitter.emit(RTCEvents.RTC_READY, true);

+ 15
- 0
modules/RTC/ScreenObtainer.js Просмотреть файл

@@ -406,6 +406,11 @@ function isUpdateRequired(minVersion, extVersion) {
406 406
     }
407 407
 }
408 408
 
409
+/**
410
+ *
411
+ * @param callback
412
+ * @param options
413
+ */
409 414
 function checkChromeExtInstalled(callback, options) {
410 415
     if (typeof chrome === 'undefined' || !chrome || !chrome.runtime) {
411 416
         // No API, so no extension for sure
@@ -440,6 +445,12 @@ function checkChromeExtInstalled(callback, options) {
440 445
     );
441 446
 }
442 447
 
448
+/**
449
+ *
450
+ * @param options
451
+ * @param streamCallback
452
+ * @param failCallback
453
+ */
443 454
 function doGetStreamFromExtension(options, streamCallback, failCallback) {
444 455
     // Sends 'getStream' msg to the extension.
445 456
     // Extension id must be defined in the config.
@@ -482,6 +493,10 @@ function initInlineInstalls(options) {
482 493
         getWebStoreInstallUrl(options));
483 494
 }
484 495
 
496
+/**
497
+ *
498
+ * @param options
499
+ */
485 500
 function initChromeExtension(options) {
486 501
     // Initialize Chrome extension inline installs
487 502
     initInlineInstalls(options);

+ 3
- 0
modules/TalkMutedDetection.js Просмотреть файл

@@ -1,5 +1,8 @@
1 1
 import * as JitsiConferenceEvents from '../JitsiConferenceEvents';
2 2
 
3
+/**
4
+ *
5
+ */
3 6
 export default class TalkMutedDetection {
4 7
     /**
5 8
      * Creates TalkMutedDetection

+ 6
- 0
modules/connectivity/ConnectionQuality.js Просмотреть файл

@@ -145,6 +145,12 @@ function rampUp(millisSinceStart) {
145 145
  * value of 0% indicates a poor connection.
146 146
  */
147 147
 export default class ConnectionQuality {
148
+    /**
149
+     *
150
+     * @param conference
151
+     * @param eventEmitter
152
+     * @param options
153
+     */
148 154
     constructor(conference, eventEmitter, options) {
149 155
         this.eventEmitter = eventEmitter;
150 156
 

+ 5
- 0
modules/connectivity/ParticipantConnectionStatus.js Просмотреть файл

@@ -189,6 +189,11 @@ export default class ParticipantConnectionStatus {
189 189
         }
190 190
     }
191 191
 
192
+    /**
193
+     *
194
+     * @param participant
195
+     * @param newStatus
196
+     */
192 197
     _changeConnectionStatus(participant, newStatus) {
193 198
         if (participant.isConnectionActive() !== newStatus) {
194 199
 

+ 12
- 0
modules/settings/Settings.js Просмотреть файл

@@ -17,10 +17,16 @@ function getLocalStorage() {
17 17
     return global.localStorage;
18 18
 }
19 19
 
20
+/**
21
+ *
22
+ */
20 23
 function _p8() {
21 24
     return `${Math.random().toString(16)}000000000`.substr(2, 8);
22 25
 }
23 26
 
27
+/**
28
+ *
29
+ */
24 30
 function generateUniqueId() {
25 31
     return _p8() + _p8() + _p8() + _p8();
26 32
 }
@@ -49,7 +55,13 @@ function generateCallStatsUsername() {
49 55
     return username;
50 56
 }
51 57
 
58
+/**
59
+ *
60
+ */
52 61
 class Settings {
62
+    /**
63
+     *
64
+     */
53 65
     constructor() {
54 66
         const localStorage = getLocalStorage();
55 67
 

+ 9
- 0
modules/statistics/AnalyticsAdapter.js Просмотреть файл

@@ -2,6 +2,9 @@
2 2
  * Interface for analytics handlers.
3 3
  */
4 4
 class AnalyticsAbstract {
5
+    /**
6
+     *
7
+     */
5 8
     sendEvent() {} // eslint-disable-line no-empty-function
6 9
 }
7 10
 
@@ -10,6 +13,9 @@ class AnalyticsAbstract {
10 13
  * @extends AnalyticsAbstract
11 14
  */
12 15
 class CacheAnalytics extends AnalyticsAbstract {
16
+    /**
17
+     *
18
+     */
13 19
     constructor() {
14 20
         super();
15 21
 
@@ -50,6 +56,9 @@ const cacheAnalytics = new CacheAnalytics();
50 56
  * This class will store and manage the handlers that are going to be used.
51 57
  */
52 58
 class AnalyticsAdapter {
59
+    /**
60
+     *
61
+     */
53 62
     constructor() {
54 63
         this.analyticsHandlers = new Set();
55 64
 

+ 6
- 0
modules/statistics/CallStats.js Просмотреть файл

@@ -486,6 +486,12 @@ CallStats.dispose = function() {
486 486
 };
487 487
 
488 488
 /* eslint-disable no-invalid-this */
489
+
490
+/**
491
+ *
492
+ * @param err
493
+ * @param msg
494
+ */
489 495
 function initCallback(err, msg) {
490 496
     logger.log(`CallStats Status: err=${err} msg=${msg}`);
491 497
 

+ 8
- 0
modules/statistics/RTPStatsCollector.js Просмотреть файл

@@ -122,6 +122,9 @@ SsrcStats.prototype.resetBitrate = function() {
122 122
     this.bitrate.upload = 0;
123 123
 };
124 124
 
125
+/**
126
+ *
127
+ */
125 128
 function ConferenceStats() {
126 129
 
127 130
     /**
@@ -402,6 +405,11 @@ StatsCollector.prototype.processStatsReport = function() {
402 405
 
403 406
     const getStatValue = this._getStatValue;
404 407
 
408
+    /**
409
+     *
410
+     * @param report
411
+     * @param name
412
+     */
405 413
     function getNonNegativeStat(report, name) {
406 414
         let value = getStatValue(report, name);
407 415
 

+ 16
- 7
modules/statistics/statistics.js Просмотреть файл

@@ -16,13 +16,17 @@ import * as StatisticsEvents from '../../service/statistics/Events';
16 16
  */
17 17
 let isCallstatsLoaded = false;
18 18
 
19
-// Since callstats.io is a third party, we cannot guarantee the quality of their
20
-// service. More specifically, their server may take noticeably long time to
21
-// respond. Consequently, it is in our best interest (in the sense that the
22
-// intergration of callstats.io is pretty important to us but not enough to
23
-// allow it to prevent people from joining a conference) to (1) start
24
-// downloading their API as soon as possible and (2) do the downloading
25
-// asynchronously.
19
+/**
20
+ * Since callstats.io is a third party, we cannot guarantee the quality of their
21
+ * service. More specifically, their server may take noticeably long time to
22
+ * respond. Consequently, it is in our best interest (in the sense that the
23
+ * intergration of callstats.io is pretty important to us but not enough to
24
+ * allow it to prevent people from joining a conference) to (1) start
25
+ * downloading their API as soon as possible and (2) do the downloading
26
+ * asynchronously.
27
+ *
28
+ * @param customScriptUrl
29
+ */
26 30
 function loadCallStatsAPI(customScriptUrl) {
27 31
     if (!isCallstatsLoaded) {
28 32
         ScriptUtil.loadScript(
@@ -81,6 +85,11 @@ Statistics.init = function(options) {
81 85
 
82 86
 };
83 87
 
88
+/**
89
+ *
90
+ * @param xmpp
91
+ * @param options
92
+ */
84 93
 function Statistics(xmpp, options) {
85 94
     this.rtpStats = null;
86 95
     this.eventEmitter = new EventEmitter();

+ 5
- 0
modules/xmpp/Caps.js Просмотреть файл

@@ -9,6 +9,11 @@ const IDENTITY_PROPERTIES = [ 'category', 'type', 'lang', 'name' ];
9 9
 const IDENTITY_PROPERTIES_FOR_COMPARE = [ 'category', 'type', 'lang' ];
10 10
 const HASH = 'sha-1';
11 11
 
12
+/**
13
+ *
14
+ * @param a
15
+ * @param b
16
+ */
12 17
 function compareIdentities(a, b) {
13 18
     let res = 0;
14 19
 

+ 136
- 1
modules/xmpp/ChatRoom.js Просмотреть файл

@@ -83,10 +83,21 @@ function filterNodeFromPresenceJSON(pres, nodeName) {
83 83
 // of chaining function calls, allow long function call chains.
84 84
 /* eslint-disable newline-per-chained-call */
85 85
 
86
+/**
87
+ *
88
+ */
86 89
 export default class ChatRoom extends Listenable {
87 90
 
88 91
     /* eslint-disable max-params */
89 92
 
93
+    /**
94
+     *
95
+     * @param connection
96
+     * @param jid
97
+     * @param password
98
+     * @param XMPP
99
+     * @param options
100
+     */
90 101
     constructor(connection, jid, password, XMPP, options) {
91 102
         super();
92 103
         this.xmpp = XMPP;
@@ -120,6 +131,9 @@ export default class ChatRoom extends Listenable {
120 131
 
121 132
     /* eslint-enable max-params */
122 133
 
134
+    /**
135
+     *
136
+     */
123 137
     initPresenceMap() {
124 138
         this.presMap.to = this.myroomjid;
125 139
         this.presMap.xns = 'http://jabber.org/protocol/muc';
@@ -136,6 +150,10 @@ export default class ChatRoom extends Listenable {
136 150
         this.addVideoInfoToPresence(false);
137 151
     }
138 152
 
153
+    /**
154
+     *
155
+     * @param devices
156
+     */
139 157
     updateDeviceAvailability(devices) {
140 158
         this.presMap.nodes.push({
141 159
             'tagName': 'devices',
@@ -152,11 +170,19 @@ export default class ChatRoom extends Listenable {
152 170
         });
153 171
     }
154 172
 
173
+    /**
174
+     *
175
+     * @param password
176
+     */
155 177
     join(password) {
156 178
         this.password = password;
157 179
         this.moderator.allocateConferenceFocus(() => this.sendPresence(true));
158 180
     }
159 181
 
182
+    /**
183
+     *
184
+     * @param fromJoin
185
+     */
160 186
     sendPresence(fromJoin) {
161 187
         const to = this.presMap.to;
162 188
 
@@ -220,6 +246,9 @@ export default class ChatRoom extends Listenable {
220 246
         this.connection.flush();
221 247
     }
222 248
 
249
+    /**
250
+     *
251
+     */
223 252
     discoRoomInfo() {
224 253
       // https://xmpp.org/extensions/xep-0045.html#disco-roominfo
225 254
 
@@ -243,7 +272,9 @@ export default class ChatRoom extends Listenable {
243 272
         });
244 273
     }
245 274
 
246
-
275
+    /**
276
+     *
277
+     */
247 278
     createNonAnonymousRoom() {
248 279
         // http://xmpp.org/extensions/xep-0045.html#createroom-reserved
249 280
 
@@ -289,6 +320,10 @@ export default class ChatRoom extends Listenable {
289 320
         });
290 321
     }
291 322
 
323
+    /**
324
+     *
325
+     * @param pres
326
+     */
292 327
     onPresence(pres) {
293 328
         const from = pres.getAttribute('from');
294 329
 
@@ -490,6 +525,11 @@ export default class ChatRoom extends Listenable {
490 525
         this.participantPropertyListener = listener;
491 526
     }
492 527
 
528
+    /**
529
+     *
530
+     * @param node
531
+     * @param from
532
+     */
493 533
     processNode(node, from) {
494 534
         // make sure we catch all errors coming from any handler
495 535
         // otherwise we can remove the presence handler from strophe
@@ -509,6 +549,11 @@ export default class ChatRoom extends Listenable {
509 549
         }
510 550
     }
511 551
 
552
+    /**
553
+     *
554
+     * @param body
555
+     * @param nickname
556
+     */
512 557
     sendMessage(body, nickname) {
513 558
         const msg = $msg({ to: this.roomjid,
514 559
             type: 'groupchat' });
@@ -524,6 +569,10 @@ export default class ChatRoom extends Listenable {
524 569
         this.eventEmitter.emit(XMPPEvents.SENDING_CHAT_MESSAGE, body);
525 570
     }
526 571
 
572
+    /**
573
+     *
574
+     * @param subject
575
+     */
527 576
     setSubject(subject) {
528 577
         const msg = $msg({ to: this.roomjid,
529 578
             type: 'groupchat' });
@@ -551,6 +600,11 @@ export default class ChatRoom extends Listenable {
551 600
         this.moderator.onMucMemberLeft(jid);
552 601
     }
553 602
 
603
+    /**
604
+     *
605
+     * @param pres
606
+     * @param from
607
+     */
554 608
     onPresenceUnavailable(pres, from) {
555 609
         // room destroyed ?
556 610
         if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]'
@@ -617,6 +671,11 @@ export default class ChatRoom extends Listenable {
617 671
         }
618 672
     }
619 673
 
674
+    /**
675
+     *
676
+     * @param msg
677
+     * @param from
678
+     */
620 679
     onMessage(msg, from) {
621 680
         const nick
622 681
             = $(msg).find('>nick[xmlns="http://jabber.org/protocol/nick"]')
@@ -676,6 +735,11 @@ export default class ChatRoom extends Listenable {
676 735
         }
677 736
     }
678 737
 
738
+    /**
739
+     *
740
+     * @param pres
741
+     * @param from
742
+     */
679 743
     onPresenceError(pres, from) {
680 744
         if ($(pres)
681 745
                 .find(
@@ -715,6 +779,10 @@ export default class ChatRoom extends Listenable {
715 779
         }
716 780
     }
717 781
 
782
+    /**
783
+     *
784
+     * @param jid
785
+     */
718 786
     kick(jid) {
719 787
         const kickIQ = $iq({ to: this.roomjid,
720 788
             type: 'set' })
@@ -731,6 +799,13 @@ export default class ChatRoom extends Listenable {
731 799
 
732 800
     /* eslint-disable max-params */
733 801
 
802
+    /**
803
+     *
804
+     * @param key
805
+     * @param onSuccess
806
+     * @param onError
807
+     * @param onNotSupported
808
+     */
734 809
     lockRoom(key, onSuccess, onError, onNotSupported) {
735 810
         // http://xmpp.org/extensions/xep-0045.html#roomconfig
736 811
         this.connection.sendIQ(
@@ -791,22 +866,40 @@ export default class ChatRoom extends Listenable {
791 866
 
792 867
     /* eslint-enable max-params */
793 868
 
869
+    /**
870
+     *
871
+     * @param key
872
+     * @param values
873
+     */
794 874
     addToPresence(key, values) {
795 875
         values.tagName = key;
796 876
         this.removeFromPresence(key);
797 877
         this.presMap.nodes.push(values);
798 878
     }
799 879
 
880
+    /**
881
+     *
882
+     * @param key
883
+     */
800 884
     removeFromPresence(key) {
801 885
         const nodes = this.presMap.nodes.filter(node => key !== node.tagName);
802 886
 
803 887
         this.presMap.nodes = nodes;
804 888
     }
805 889
 
890
+    /**
891
+     *
892
+     * @param name
893
+     * @param handler
894
+     */
806 895
     addPresenceListener(name, handler) {
807 896
         this.presHandlers[name] = handler;
808 897
     }
809 898
 
899
+    /**
900
+     *
901
+     * @param name
902
+     */
810 903
     removePresenceListener(name) {
811 904
         delete this.presHandlers[name];
812 905
     }
@@ -829,10 +922,17 @@ export default class ChatRoom extends Listenable {
829 922
         return null;
830 923
     }
831 924
 
925
+    /**
926
+     *
927
+     */
832 928
     isModerator() {
833 929
         return this.role === 'moderator';
834 930
     }
835 931
 
932
+    /**
933
+     *
934
+     * @param peerJid
935
+     */
836 936
     getMemberRole(peerJid) {
837 937
         if (this.members[peerJid]) {
838 938
             return this.members[peerJid].role;
@@ -841,6 +941,11 @@ export default class ChatRoom extends Listenable {
841 941
         return null;
842 942
     }
843 943
 
944
+    /**
945
+     *
946
+     * @param mute
947
+     * @param callback
948
+     */
844 949
     setVideoMute(mute, callback) {
845 950
         this.sendVideoInfoPresence(mute);
846 951
         if (callback) {
@@ -848,10 +953,19 @@ export default class ChatRoom extends Listenable {
848 953
         }
849 954
     }
850 955
 
956
+    /**
957
+     *
958
+     * @param mute
959
+     * @apram callback
960
+     */
851 961
     setAudioMute(mute, callback) {
852 962
         return this.sendAudioInfoPresence(mute, callback);
853 963
     }
854 964
 
965
+    /**
966
+     *
967
+     * @param mute
968
+     */
855 969
     addAudioInfoToPresence(mute) {
856 970
         this.removeFromPresence('audiomuted');
857 971
         this.addToPresence('audiomuted',
@@ -860,6 +974,11 @@ export default class ChatRoom extends Listenable {
860 974
                 value: mute.toString() });
861 975
     }
862 976
 
977
+    /**
978
+     *
979
+     * @param mute
980
+     * @param callback
981
+     */
863 982
     sendAudioInfoPresence(mute, callback) {
864 983
         this.addAudioInfoToPresence(mute);
865 984
         if (this.connection) {
@@ -870,6 +989,10 @@ export default class ChatRoom extends Listenable {
870 989
         }
871 990
     }
872 991
 
992
+    /**
993
+     *
994
+     * @param mute
995
+     */
873 996
     addVideoInfoToPresence(mute) {
874 997
         this.removeFromPresence('videomuted');
875 998
         this.addToPresence('videomuted',
@@ -878,6 +1001,10 @@ export default class ChatRoom extends Listenable {
878 1001
                 value: mute.toString() });
879 1002
     }
880 1003
 
1004
+    /**
1005
+     *
1006
+     * @param mute
1007
+     */
881 1008
     sendVideoInfoPresence(mute) {
882 1009
         this.addVideoInfoToPresence(mute);
883 1010
         if (!this.connection) {
@@ -1037,6 +1164,10 @@ export default class ChatRoom extends Listenable {
1037 1164
             error => logger.log('set mute error', error));
1038 1165
     }
1039 1166
 
1167
+    /**
1168
+     *
1169
+     * @param iq
1170
+     */
1040 1171
     onMute(iq) {
1041 1172
         const from = iq.getAttribute('from');
1042 1173
 
@@ -1069,6 +1200,10 @@ export default class ChatRoom extends Listenable {
1069 1200
             const timeout = setTimeout(() => onMucLeft(true), 5000);
1070 1201
             const eventEmitter = this.eventEmitter;
1071 1202
 
1203
+            /**
1204
+             *
1205
+             * @param doReject
1206
+             */
1072 1207
             function onMucLeft(doReject = false) {
1073 1208
                 eventEmitter.removeListener(XMPPEvents.MUC_LEFT, onMucLeft);
1074 1209
                 clearTimeout(timeout);

+ 8
- 0
modules/xmpp/ConnectionPlugin.js Просмотреть файл

@@ -10,10 +10,18 @@ function getConnectionPluginDefinition(base = class {}) {
10 10
      * Base class for strophe connection plugins.
11 11
      */
12 12
     return class extends base {
13
+        /**
14
+         *
15
+         */
13 16
         constructor(...args) {
14 17
             super(...args);
15 18
             this.connection = null;
16 19
         }
20
+
21
+        /**
22
+         *
23
+         * @param connection
24
+         */
17 25
         init(connection) {
18 26
             this.connection = connection;
19 27
         }

+ 21
- 12
modules/xmpp/JingleSession.js Просмотреть файл

@@ -4,7 +4,7 @@ import * as JingleSessionState from './JingleSessionState';
4 4
 
5 5
 const logger = getLogger(__filename);
6 6
 
7
-/*
7
+/**
8 8
  * JingleSession provides an API to manage a single Jingle session. We will
9 9
  * have different implementations depending on the underlying interface used
10 10
  * (i.e. WebRTC and ORTC) and here we hold the code common to all of them.
@@ -99,15 +99,20 @@ export default class JingleSession {
99 99
      * {@link initialize}.
100 100
      * @protected
101 101
      */
102
-    doInitialize() { } // eslint-disable-line no-empty-function
102
+    doInitialize() {} // eslint-disable-line no-empty-function
103
+
104
+    /* eslint-disable no-unused-vars, no-empty-function */
103 105
 
104 106
     /**
105 107
      * Adds the ICE candidates found in the 'contents' array as remote
106 108
      * candidates?
107 109
      * Note: currently only used on transport-info
110
+     *
111
+     * @param contents
108 112
      */
109
-    // eslint-disable-next-line no-unused-vars, no-empty-function
110
-    addIceCandidates(contents) { }
113
+    addIceCandidates(contents) {}
114
+
115
+    /* eslint-enable no-unused-vars, no-empty-function */
111 116
 
112 117
     /**
113 118
      * Returns current state of this <tt>JingleSession</tt> instance.
@@ -117,21 +122,23 @@ export default class JingleSession {
117 122
         return this.state;
118 123
     }
119 124
 
125
+    /* eslint-disable no-unused-vars, no-empty-function */
126
+
120 127
     /**
121 128
      * Handles an 'add-source' event.
122 129
      *
123 130
      * @param contents an array of Jingle 'content' elements.
124 131
      */
125
-    // eslint-disable-next-line no-unused-vars, no-empty-function
126
-    addSources(contents) { }
132
+    addSources(contents) {}
127 133
 
128 134
     /**
129 135
      * Handles a 'remove-source' event.
130 136
      *
131 137
      * @param contents an array of Jingle 'content' elements.
132 138
      */
133
-    // eslint-disable-next-line no-unused-vars, no-empty-function
134
-    removeSources(contents) { }
139
+    removeSources(contents) {}
140
+
141
+    /* eslint-disable max-params */
135 142
 
136 143
     /**
137 144
      * Terminates this Jingle session by sending session-terminate
@@ -142,8 +149,9 @@ export default class JingleSession {
142 149
      * @param failure a callback called when either timeout occurs or ERROR
143 150
      * response is received.
144 151
      */
145
-    // eslint-disable-next-line max-params, no-unused-vars, no-empty-function
146
-    terminate(reason, text, success, failure) { }
152
+    terminate(reason, text, success, failure) {}
153
+
154
+    /* eslint-enable max-params */
147 155
 
148 156
     /**
149 157
      * Handles an offer from the remote peer (prepares to accept a session).
@@ -154,6 +162,7 @@ export default class JingleSession {
154 162
      * error object with details(which is meant more to be printed to the logger
155 163
      * than analysed in the code, as the error is unrecoverable anyway)
156 164
      */
157
-    // eslint-disable-next-line no-unused-vars, no-empty-function
158
-    acceptOffer(jingle, success, failure) { }
165
+    acceptOffer(jingle, success, failure) {}
166
+
167
+    /* eslint-enable no-unused-vars, no-empty-function */
159 168
 }

+ 28
- 0
modules/xmpp/JingleSessionPC.js Просмотреть файл

@@ -22,6 +22,9 @@ import * as JingleSessionState from './JingleSessionState';
22 22
  */
23 23
 const IQ_TIMEOUT = 10000;
24 24
 
25
+/**
26
+ *
27
+ */
25 28
 export default class JingleSessionPC extends JingleSession {
26 29
 
27 30
     /* eslint-disable max-params */
@@ -108,6 +111,9 @@ export default class JingleSessionPC extends JingleSession {
108 111
 
109 112
     /* eslint-enable max-params */
110 113
 
114
+    /**
115
+     *
116
+     */
111 117
     doInitialize() {
112 118
         this.lasticecandidate = false;
113 119
 
@@ -244,6 +250,10 @@ export default class JingleSessionPC extends JingleSession {
244 250
         };
245 251
     }
246 252
 
253
+    /**
254
+     *
255
+     * @param candidate
256
+     */
247 257
     sendIceCandidate(candidate) {
248 258
         const localSDP = new SDP(this.peerconnection.localDescription.sdp);
249 259
 
@@ -286,6 +296,10 @@ export default class JingleSessionPC extends JingleSession {
286 296
         }
287 297
     }
288 298
 
299
+    /**
300
+     *
301
+     * @param candidates
302
+     */
289 303
     sendIceCandidates(candidates) {
290 304
         logger.log('sendIceCandidates', candidates);
291 305
         const cand = $iq({ to: this.peerjid,
@@ -357,6 +371,10 @@ export default class JingleSessionPC extends JingleSession {
357 371
             }), IQ_TIMEOUT);
358 372
     }
359 373
 
374
+    /**
375
+     *
376
+     * @param contents
377
+     */
360 378
     readSsrcInfo(contents) {
361 379
         $(contents).each((i1, content) => {
362 380
             const ssrcs
@@ -672,6 +690,11 @@ export default class JingleSessionPC extends JingleSession {
672 690
 
673 691
     /* eslint-enable max-params */
674 692
 
693
+    /**
694
+     *
695
+     * @param reasonCondition
696
+     * @param reasonText
697
+     */
675 698
     onTerminated(reasonCondition, reasonText) {
676 699
         this.state = 'ended';
677 700
 
@@ -1492,6 +1515,11 @@ export default class JingleSessionPC extends JingleSession {
1492 1515
         };
1493 1516
     }
1494 1517
 
1518
+    /**
1519
+     *
1520
+     * @param session
1521
+     * @param error
1522
+     */
1495 1523
     static onJingleFatalError(session, error) {
1496 1524
         if (this.room) {
1497 1525
             this.room.eventEmitter.emit(

+ 4
- 1
modules/xmpp/SDP.js Просмотреть файл

@@ -2,7 +2,10 @@
2 2
 
3 3
 const SDPUtil = require('./SDPUtil');
4 4
 
5
-// SDP STUFF
5
+/**
6
+ *
7
+ * @param sdp
8
+ */
6 9
 function SDP(sdp) {
7 10
     const media = sdp.split('\r\nm=');
8 11
 

+ 10
- 0
modules/xmpp/SDPDiffer.js Просмотреть файл

@@ -1,6 +1,11 @@
1 1
 const SDPUtil = require('./SDPUtil');
2 2
 
3 3
 // this could be useful in Array.prototype.
4
+/**
5
+ *
6
+ * @param array1
7
+ * @param array2
8
+ */
4 9
 function arrayEquals(array1, array2) {
5 10
     // if the other array is a falsy value, return
6 11
     if (!array2) {
@@ -29,6 +34,11 @@ function arrayEquals(array1, array2) {
29 34
     return true;
30 35
 }
31 36
 
37
+/**
38
+ *
39
+ * @param mySDP
40
+ * @param otherSDP
41
+ */
32 42
 function SDPDiffer(mySDP, otherSDP) {
33 43
     this.mySDP = mySDP;
34 44
     this.otherSDP = otherSDP;

+ 3
- 0
modules/xmpp/SdpTransformUtil.js Просмотреть файл

@@ -53,6 +53,9 @@ class MLineWrap {
53 53
         this.mLine = mLine;
54 54
     }
55 55
 
56
+    /**
57
+     *
58
+     */
56 59
     get _ssrcs() {
57 60
         if (!this.mLine.ssrcs) {
58 61
             this.mLine.ssrcs = [];

+ 16
- 2
modules/xmpp/moderator.js Просмотреть файл

@@ -8,6 +8,10 @@ const GlobalOnErrorHandler = require('../util/GlobalOnErrorHandler');
8 8
 
9 9
 import Settings from '../settings/Settings';
10 10
 
11
+/**
12
+ *
13
+ * @param step
14
+ */
11 15
 function createExpBackoffTimer(step) {
12 16
     let count = 1;
13 17
 
@@ -30,6 +34,13 @@ function createExpBackoffTimer(step) {
30 34
 
31 35
 /* eslint-disable max-params */
32 36
 
37
+/**
38
+ *
39
+ * @param roomName
40
+ * @param xmpp
41
+ * @param emitter
42
+ * @param options
43
+ */
33 44
 function Moderator(roomName, xmpp, emitter, options) {
34 45
     this.roomName = roomName;
35 46
     this.xmppService = xmpp;
@@ -51,8 +62,11 @@ function Moderator(roomName, xmpp, emitter, options) {
51 62
 
52 63
     this.connection = this.xmppService.connection;
53 64
 
54
-    // FIXME:
55
-    // Message listener that talks to POPUP window
65
+    // FIXME: Message listener that talks to POPUP window
66
+    /**
67
+     *
68
+     * @param event
69
+     */
56 70
     function listener(event) {
57 71
         if (event.data && event.data.sessionId) {
58 72
             if (event.origin !== window.location.origin) {

+ 9
- 0
modules/xmpp/recording.js Просмотреть файл

@@ -8,6 +8,15 @@ const GlobalOnErrorHandler = require('../util/GlobalOnErrorHandler');
8 8
 
9 9
 /* eslint-disable max-params */
10 10
 
11
+/**
12
+ *
13
+ * @param type
14
+ * @param eventEmitter
15
+ * @param connection
16
+ * @param focusMucJid
17
+ * @param jirecon
18
+ * @param roomjid
19
+ */
11 20
 function Recording(
12 21
         type,
13 22
         eventEmitter,

+ 45
- 0
modules/xmpp/strophe.emuc.js Просмотреть файл

@@ -11,13 +11,24 @@ import ChatRoom from './ChatRoom';
11 11
 import { ConnectionPluginListenable } from './ConnectionPlugin';
12 12
 import XMPPEvents from '../../service/xmpp/XMPPEvents';
13 13
 
14
+/**
15
+ *
16
+ */
14 17
 class MucConnectionPlugin extends ConnectionPluginListenable {
18
+    /**
19
+     *
20
+     * @param xmpp
21
+     */
15 22
     constructor(xmpp) {
16 23
         super();
17 24
         this.xmpp = xmpp;
18 25
         this.rooms = {};
19 26
     }
20 27
 
28
+    /**
29
+     *
30
+     * @param connection
31
+     */
21 32
     init(connection) {
22 33
         super.init(connection);
23 34
 
@@ -34,6 +45,12 @@ class MucConnectionPlugin extends ConnectionPluginListenable {
34 45
             'http://jitsi.org/jitmeet/audio', 'iq', 'set', null, null);
35 46
     }
36 47
 
48
+    /**
49
+     *
50
+     * @param jid
51
+     * @param password
52
+     * @param options
53
+     */
37 54
     createRoom(jid, password, options) {
38 55
         const roomJid = Strophe.getBareJidFromJid(jid);
39 56
 
@@ -51,12 +68,20 @@ class MucConnectionPlugin extends ConnectionPluginListenable {
51 68
         return this.rooms[roomJid];
52 69
     }
53 70
 
71
+    /**
72
+     *
73
+     * @param jid
74
+     */
54 75
     doLeave(jid) {
55 76
         this.eventEmitter.emit(
56 77
             XMPPEvents.EMUC_ROOM_REMOVED, this.rooms[jid]);
57 78
         delete this.rooms[jid];
58 79
     }
59 80
 
81
+    /**
82
+     *
83
+     * @param pres
84
+     */
60 85
     onPresence(pres) {
61 86
         const from = pres.getAttribute('from');
62 87
 
@@ -82,6 +107,10 @@ class MucConnectionPlugin extends ConnectionPluginListenable {
82 107
         return true;
83 108
     }
84 109
 
110
+    /**
111
+     *
112
+     * @param pres
113
+     */
85 114
     onPresenceUnavailable(pres) {
86 115
         const from = pres.getAttribute('from');
87 116
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
@@ -95,6 +124,10 @@ class MucConnectionPlugin extends ConnectionPluginListenable {
95 124
         return true;
96 125
     }
97 126
 
127
+    /**
128
+     *
129
+     * @param pres
130
+     */
98 131
     onPresenceError(pres) {
99 132
         const from = pres.getAttribute('from');
100 133
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
@@ -108,6 +141,10 @@ class MucConnectionPlugin extends ConnectionPluginListenable {
108 141
         return true;
109 142
     }
110 143
 
144
+    /**
145
+     *
146
+     * @param msg
147
+     */
111 148
     onMessage(msg) {
112 149
         // FIXME: this is a hack. but jingle on muc makes nickchanges hard
113 150
         const from = msg.getAttribute('from');
@@ -122,6 +159,10 @@ class MucConnectionPlugin extends ConnectionPluginListenable {
122 159
         return true;
123 160
     }
124 161
 
162
+    /**
163
+     *
164
+     * @param iq
165
+     */
125 166
     onMute(iq) {
126 167
         const from = iq.getAttribute('from');
127 168
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
@@ -136,6 +177,10 @@ class MucConnectionPlugin extends ConnectionPluginListenable {
136 177
     }
137 178
 }
138 179
 
180
+/**
181
+ *
182
+ * @param XMPP
183
+ */
139 184
 export default function(XMPP) {
140 185
     Strophe.addConnectionPlugin('emuc', new MucConnectionPlugin(XMPP));
141 186
 }

+ 25
- 0
modules/xmpp/strophe.jingle.js Просмотреть файл

@@ -13,7 +13,15 @@ import ConnectionPlugin from './ConnectionPlugin';
13 13
 // function call chains.
14 14
 /* eslint-disable newline-per-chained-call */
15 15
 
16
+/**
17
+ *
18
+ */
16 19
 class JingleConnectionPlugin extends ConnectionPlugin {
20
+    /**
21
+     *
22
+     * @param xmpp
23
+     * @param eventEmitter
24
+     */
17 25
     constructor(xmpp, eventEmitter) {
18 26
         super();
19 27
         this.xmpp = xmpp;
@@ -30,12 +38,20 @@ class JingleConnectionPlugin extends ConnectionPlugin {
30 38
         };
31 39
     }
32 40
 
41
+    /**
42
+     *
43
+     * @param connection
44
+     */
33 45
     init(connection) {
34 46
         super.init(connection);
35 47
         this.connection.addHandler(this.onJingle.bind(this),
36 48
             'urn:xmpp:jingle:1', 'iq', 'set', null, null);
37 49
     }
38 50
 
51
+    /**
52
+     *
53
+     * @param iq
54
+     */
39 55
     onJingle(iq) {
40 56
         const sid = $(iq).find('jingle').attr('sid');
41 57
         const action = $(iq).find('jingle').attr('action');
@@ -186,6 +202,12 @@ class JingleConnectionPlugin extends ConnectionPlugin {
186 202
         return true;
187 203
     }
188 204
 
205
+    /**
206
+     *
207
+     * @param sid
208
+     * @param reasonCondition
209
+     * @param reasonText
210
+     */
189 211
     terminate(sid, reasonCondition, reasonText) {
190 212
         if (this.sessions.hasOwnProperty(sid)) {
191 213
             if (this.sessions[sid].state !== 'ended') {
@@ -195,6 +217,9 @@ class JingleConnectionPlugin extends ConnectionPlugin {
195 217
         }
196 218
     }
197 219
 
220
+    /**
221
+     *
222
+     */
198 223
     getStunAndTurnCredentials() {
199 224
         // get stun and turn configuration from server via xep-0215
200 225
         // uses time-limited credentials as described in

+ 18
- 0
modules/xmpp/strophe.logger.js Просмотреть файл

@@ -5,26 +5,44 @@ import ConnectionPlugin from './ConnectionPlugin';
5 5
  *  Logs raw stanzas and makes them available for download as JSON
6 6
  */
7 7
 class StropheLogger extends ConnectionPlugin {
8
+    /**
9
+     *
10
+     */
8 11
     constructor() {
9 12
         super();
10 13
         this.log = [];
11 14
     }
12 15
 
16
+    /**
17
+     *
18
+     * @param connection
19
+     */
13 20
     init(connection) {
14 21
         super.init(connection);
15 22
         this.connection.rawInput = this.logIncoming.bind(this);
16 23
         this.connection.rawOutput = this.logOutgoing.bind(this);
17 24
     }
18 25
 
26
+    /**
27
+     *
28
+     * @param stanza
29
+     */
19 30
     logIncoming(stanza) {
20 31
         this.log.push([ new Date().getTime(), 'incoming', stanza ]);
21 32
     }
22 33
 
34
+    /**
35
+     *
36
+     * @param stanza
37
+     */
23 38
     logOutgoing(stanza) {
24 39
         this.log.push([ new Date().getTime(), 'outgoing', stanza ]);
25 40
     }
26 41
 }
27 42
 
43
+/**
44
+ *
45
+ */
28 46
 export default function() {
29 47
     Strophe.addConnectionPlugin('logger', new StropheLogger());
30 48
 }

+ 4
- 0
modules/xmpp/strophe.ping.js Просмотреть файл

@@ -141,6 +141,10 @@ class PingConnectionPlugin extends ConnectionPlugin {
141 141
     }
142 142
 }
143 143
 
144
+/**
145
+ *
146
+ * @param xmpp
147
+ */
144 148
 export default function(xmpp) {
145 149
     Strophe.addConnectionPlugin('ping', new PingConnectionPlugin(xmpp));
146 150
 }

+ 25
- 0
modules/xmpp/strophe.rayo.js Просмотреть файл

@@ -7,7 +7,14 @@ import ConnectionPlugin from './ConnectionPlugin';
7 7
 
8 8
 const RAYO_XMLNS = 'urn:xmpp:rayo:1';
9 9
 
10
+/**
11
+ *
12
+ */
10 13
 class RayoConnectionPlugin extends ConnectionPlugin {
14
+    /**
15
+     *
16
+     * @param connection
17
+     */
11 18
     init(connection) {
12 19
         super.init(connection);
13 20
 
@@ -15,12 +22,24 @@ class RayoConnectionPlugin extends ConnectionPlugin {
15 22
             this.onRayo.bind(this), RAYO_XMLNS, 'iq', 'set', null, null);
16 23
     }
17 24
 
25
+    /**
26
+     *
27
+     * @param iq
28
+     */
18 29
     onRayo(iq) {
19 30
         logger.info('Rayo IQ', iq);
20 31
     }
21 32
 
22 33
     /* eslint-disable max-params */
23 34
 
35
+    /**
36
+     *
37
+     * @param to
38
+     * @param from
39
+     * @param roomName
40
+     * @param roomPass
41
+     * @param focusMucJid
42
+     */
24 43
     dial(to, from, roomName, roomPass, focusMucJid) {
25 44
         return new Promise((resolve, reject) => {
26 45
             if (!focusMucJid) {
@@ -71,6 +90,9 @@ class RayoConnectionPlugin extends ConnectionPlugin {
71 90
 
72 91
     /* eslint-enable max-params */
73 92
 
93
+    /**
94
+     *
95
+     */
74 96
     hangup() {
75 97
         return new Promise((resolve, reject) => {
76 98
             if (!this.callResource) {
@@ -102,6 +124,9 @@ class RayoConnectionPlugin extends ConnectionPlugin {
102 124
     }
103 125
 }
104 126
 
127
+/**
128
+ *
129
+ */
105 130
 export default function() {
106 131
     Strophe.addConnectionPlugin('rayo', new RayoConnectionPlugin());
107 132
 }

+ 3
- 0
modules/xmpp/strophe.util.js Просмотреть файл

@@ -41,6 +41,9 @@ const resetLastErrorStatusRegExpr = /request id \d+.\d+ got 200/;
41 41
 const lastErrorStatusRegExpr
42 42
     = /request errored, status: (\d+), number of errors: \d+/;
43 43
 
44
+/**
45
+ *
46
+ */
44 47
 export default function() {
45 48
 
46 49
     Strophe.log = function(level, msg) {

+ 49
- 0
modules/xmpp/xmpp.js Просмотреть файл

@@ -16,6 +16,11 @@ import initStropheLogger from './strophe.logger';
16 16
 import Listenable from '../util/Listenable';
17 17
 import Caps from './Caps';
18 18
 
19
+/**
20
+ *
21
+ * @param token
22
+ * @param bosh
23
+ */
19 24
 function createConnection(token, bosh = '/http-bind') {
20 25
     // Append token as URL param
21 26
     if (token) {
@@ -26,7 +31,15 @@ function createConnection(token, bosh = '/http-bind') {
26 31
     return new Strophe.Connection(bosh);
27 32
 }
28 33
 
34
+/**
35
+ *
36
+ */
29 37
 export default class XMPP extends Listenable {
38
+    /**
39
+     *
40
+     * @param options
41
+     * @param token
42
+     */
30 43
     constructor(options, token) {
31 44
         super();
32 45
         this.connection = null;
@@ -95,6 +108,9 @@ export default class XMPP extends Listenable {
95 108
         }
96 109
     }
97 110
 
111
+    /**
112
+     *
113
+     */
98 114
     getConnection() {
99 115
         return this.connection;
100 116
     }
@@ -203,6 +219,11 @@ export default class XMPP extends Listenable {
203 219
         }
204 220
     }
205 221
 
222
+    /**
223
+     *
224
+     * @param jid
225
+     * @param password
226
+     */
206 227
     _connect(jid, password) {
207 228
         // connection.connect() starts the connection process.
208 229
         //
@@ -254,6 +275,11 @@ export default class XMPP extends Listenable {
254 275
             this.connectionHandler.bind(this, options.password));
255 276
     }
256 277
 
278
+    /**
279
+     *
280
+     * @param jid
281
+     * @param password
282
+     */
257 283
     connect(jid, password) {
258 284
         this.connectParams = {
259 285
             jid,
@@ -280,6 +306,11 @@ export default class XMPP extends Listenable {
280 306
         return this._connect(jid, password);
281 307
     }
282 308
 
309
+    /**
310
+     *
311
+     * @param roomName
312
+     * @param options
313
+     */
283 314
     createRoom(roomName, options) {
284 315
         // By default MUC nickname is the resource part of the JID
285 316
         let mucNickname = Strophe.getNodeFromJid(this.connection.jid);
@@ -324,18 +355,33 @@ export default class XMPP extends Listenable {
324 355
         return (this.connection.logger || {}).log || null;
325 356
     }
326 357
 
358
+    /**
359
+     *
360
+     */
327 361
     dial(...args) {
328 362
         this.connection.rayo.dial(...args);
329 363
     }
330 364
 
365
+    /**
366
+     *
367
+     * @param jid
368
+     * @param mute
369
+     */
331 370
     setMute(jid, mute) {
332 371
         this.connection.moderate.setMute(jid, mute);
333 372
     }
334 373
 
374
+    /**
375
+     *
376
+     * @param jid
377
+     */
335 378
     eject(jid) {
336 379
         this.connection.moderate.eject(jid);
337 380
     }
338 381
 
382
+    /**
383
+     *
384
+     */
339 385
     getSessions() {
340 386
         return this.connection.jingle.sessions;
341 387
     }
@@ -391,6 +437,9 @@ export default class XMPP extends Listenable {
391 437
         }
392 438
     }
393 439
 
440
+    /**
441
+     *
442
+     */
394 443
     _initStrophePlugins() {
395 444
         initEmuc(this);
396 445
         initJingle(this, this.eventEmitter);

Загрузка…
Отмена
Сохранить