Bladeren bron

Fixes issues after review PR #166

master
hristoterezov 8 jaren geleden
bovenliggende
commit
b1e4c8debe
6 gewijzigde bestanden met toevoegingen van 104 en 121 verwijderingen
  1. 36
    42
      JitsiConference.js
  2. 54
    48
      JitsiConferenceEventManager.js
  3. 4
    5
      JitsiConnection.js
  4. 6
    10
      modules/statistics/statistics.js
  5. 3
    4
      modules/xmpp/JingleSessionPC.js
  6. 1
    12
      modules/xmpp/xmpp.js

+ 36
- 42
JitsiConference.js Bestand weergeven

@@ -37,18 +37,10 @@ function JitsiConference(options) {
37 37
     this.eventEmitter = new EventEmitter();
38 38
     this.settings = new Settings();
39 39
     this.retries = 0;
40
+    this.options = options;
41
+    this.eventManager = new JitsiConferenceEventManager(this);
40 42
     this._init(options);
41 43
     this.componentsVersions = new ComponentsVersions(this);
42
-    this.rtc = new RTC(this, options);
43
-    this.statistics = new Statistics(this.xmpp, {
44
-        callStatsID: this.options.config.callStatsID,
45
-        callStatsSecret: this.options.config.callStatsSecret,
46
-        disableThirdPartyRequests:
47
-            this.options.config.disableThirdPartyRequests,
48
-        roomName: this.options.name
49
-    });
50
-    this.eventManager = new JitsiConferenceEventManager(this);
51
-    this._setupListeners();
52 44
     this.participants = {};
53 45
     this.lastDominantSpeaker = null;
54 46
     this.dtmfManager = null;
@@ -68,33 +60,55 @@ function JitsiConference(options) {
68 60
 
69 61
 /**
70 62
  * Initializes the conference object properties
71
- * @param options overrides this.options
63
+ * @param options {object}
64
+ * @param connection {JitsiConnection} overrides this.connection
65
+ * @param roomState {object} the state of the ChatRoom instance received by
66
+ * ChatRoom.exportState. If this property is set it will be passed to
67
+ * ChatRoom.loadState
72 68
  */
73 69
 JitsiConference.prototype._init = function (options) {
74 70
     if(!options)
75 71
         options = {};
76
-    if(!this.options) {
77
-        this.options = options;
78
-    } else {
79
-        // Override config options
80
-        var config = options.config || {};
81
-        for(var key in config)
82
-            this.options.config[key] = config[key] || this.options.config[key];
83
-    }
84 72
 
85 73
     // Override connection and xmpp properties (Usefull if the connection
86 74
     // reloaded)
87
-    this.connection = options.connection || this.connection;
88
-    this.xmpp = this.connection.xmpp;
75
+    if(options.connection) {
76
+        this.connection = options.connection;
77
+        this.xmpp = this.connection.xmpp;
78
+        // Setup XMPP events only if we have new connection object.
79
+        this.eventManager.setupXMPPListeners();
80
+    }
81
+
89 82
     this.retries++;
90 83
     this.room = this.xmpp.createRoom(this.options.name, this.options.config,
91 84
         this.settings, (this.retries < 4 ? 3 : null));
92 85
 
86
+    this.eventManager.setupChatRoomListeners();
87
+
93 88
     //restore previous presence options
94 89
     if(options.roomState) {
95 90
         this.room.loadState(options.roomState);
96 91
     }
97 92
     this.room.updateDeviceAvailability(RTC.getDeviceAvailability());
93
+
94
+    if(!this.rtc) {
95
+        this.rtc = new RTC(this, options);
96
+        this.eventManager.setupRTCListeners();
97
+    }
98
+
99
+
100
+    if(!this.statistics) {
101
+        this.statistics = new Statistics(this.xmpp, {
102
+            callStatsID: this.options.config.callStatsID,
103
+            callStatsSecret: this.options.config.callStatsSecret,
104
+            disableThirdPartyRequests:
105
+                this.options.config.disableThirdPartyRequests,
106
+            roomName: this.options.name
107
+        });
108
+    }
109
+    // Always add listeners because on reload we are executing leave and the
110
+    // listeners are removed from statistics module.
111
+    this.eventManager.setupStatisticsListeners();
98 112
 }
99 113
 
100 114
 /**
@@ -107,17 +121,7 @@ JitsiConference.prototype._reload = function (options) {
107 121
         options = {};
108 122
     options.roomState = roomState;
109 123
     this.leave(true);
110
-    this._reinitialize(options);
111
-}
112
-
113
-/**
114
- * Reinitializes JitsiConference instance
115
- * @param options {object} options to be overriden
116
- */
117
-JitsiConference.prototype._reinitialize = function (options) {
118
-    this._init(options || {});
119
-    this.eventManager.setupChatRoomListeners();
120
-    this.eventManager.setupStatisticsListeners();
124
+    this._init(options);
121 125
     this.join();
122 126
 }
123 127
 
@@ -1164,16 +1168,6 @@ JitsiConference.prototype.sendApplicationLog = function(message) {
1164 1168
     Statistics.sendLog(message);
1165 1169
 };
1166 1170
 
1167
-/**
1168
- * Setups the listeners needed for the conference.
1169
- */
1170
-JitsiConference.prototype._setupListeners = function () {
1171
-    this.eventManager.setupXMPPListeners();
1172
-    this.eventManager.setupChatRoomListeners();
1173
-    this.eventManager.setupRTCListeners();
1174
-    this.eventManager.setupStatisticsListeners();
1175
-};
1176
-
1177 1171
 /**
1178 1172
  * Checks if the user identified by given <tt>mucJid</tt> is the conference
1179 1173
  * focus.

+ 54
- 48
JitsiConferenceEventManager.js Bestand weergeven

@@ -16,8 +16,15 @@ var MediaType = require("./service/RTC/MediaType");
16 16
  */
17 17
 function JitsiConferenceEventManager(conference) {
18 18
     this.conference = conference;
19
-    this.chatRoomForwarder = new EventEmitterForwarder(this.conference.room,
20
-        this.conference.eventEmitter);
19
+
20
+    //Listeners related to the conference only
21
+    conference.on(JitsiConferenceEvents.TRACK_MUTE_CHANGED,
22
+        function (track) {
23
+            if(!track.isLocal() || !conference.statistics)
24
+                return;
25
+            conference.statistics.sendMuteEvent(track.isMuted(),
26
+                track.getType());
27
+        });
21 28
 }
22 29
 
23 30
 /**
@@ -25,15 +32,18 @@ function JitsiConferenceEventManager(conference) {
25 32
  */
26 33
 JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
27 34
     var conference = this.conference;
35
+    var chatRoom = conference.room;
36
+    this.chatRoomForwarder = new EventEmitterForwarder(chatRoom,
37
+        this.conference.eventEmitter);
28 38
 
29
-    conference.room.addListener(XMPPEvents.ICE_RESTARTING, function () {
39
+    chatRoom.addListener(XMPPEvents.ICE_RESTARTING, function () {
30 40
         // All data channels have to be closed, before ICE restart
31 41
         // otherwise Chrome will not trigger "opened" event for the channel
32 42
         // established with the new bridge
33 43
         conference.rtc.closeAllDataChannels();
34 44
     });
35 45
 
36
-    conference.room.addListener(XMPPEvents.REMOTE_TRACK_ADDED,
46
+    chatRoom.addListener(XMPPEvents.REMOTE_TRACK_ADDED,
37 47
         function (data) {
38 48
             var track = conference.rtc.createRemoteTrack(data);
39 49
             if (track) {
@@ -41,7 +51,7 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
41 51
             }
42 52
         }
43 53
     );
44
-    conference.room.addListener(XMPPEvents.REMOTE_TRACK_REMOVED,
54
+    chatRoom.addListener(XMPPEvents.REMOTE_TRACK_REMOVED,
45 55
         function (streamId, trackId) {
46 56
             conference.getParticipants().forEach(function(participant) {
47 57
                 var tracks = participant.getTracks();
@@ -59,7 +69,7 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
59 69
         }
60 70
     );
61 71
 
62
-    conference.room.addListener(XMPPEvents.AUDIO_MUTED_BY_FOCUS,
72
+    chatRoom.addListener(XMPPEvents.AUDIO_MUTED_BY_FOCUS,
63 73
         function (value) {
64 74
             // set isMutedByFocus when setAudioMute Promise ends
65 75
             conference.rtc.setAudioMute(value).then(
@@ -111,13 +121,20 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
111 121
         JitsiConferenceEvents.CONFERENCE_FAILED,
112 122
         JitsiConferenceErrors.GRACEFUL_SHUTDOWN);
113 123
 
114
-    conference.room.addListener(XMPPEvents.JINGLE_FATAL_ERROR,
124
+    chatRoom.addListener(XMPPEvents.JINGLE_FATAL_ERROR,
115 125
         function (session, error) {
116 126
             conference.eventEmitter.emit(
117 127
                 JitsiConferenceEvents.CONFERENCE_FAILED,
118 128
                 JitsiConferenceErrors.JINGLE_FATAL_ERROR, error);
119 129
         });
120 130
 
131
+    chatRoom.addListener(XMPPEvents.CONNECTION_ICE_FAILED,
132
+        function (pc) {
133
+            chatRoom.eventEmitter.emit(
134
+                XMPPEvents.CONFERENCE_SETUP_FAILED,
135
+                new Error("ICE fail"));
136
+        });
137
+
121 138
     this.chatRoomForwarder.forward(XMPPEvents.MUC_DESTROYED,
122 139
         JitsiConferenceEvents.CONFERENCE_FAILED,
123 140
         JitsiConferenceErrors.CONFERENCE_DESTROYED);
@@ -130,7 +147,7 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
130 147
         JitsiConferenceEvents.CONFERENCE_FAILED,
131 148
         JitsiConferenceErrors.FOCUS_DISCONNECTED);
132 149
 
133
-    conference.room.addListener(XMPPEvents.FOCUS_LEFT,
150
+    chatRoom.addListener(XMPPEvents.FOCUS_LEFT,
134 151
         function () {
135 152
             if(!conference.connection._reload())
136 153
                 conference.eventEmitter.emit(
@@ -138,7 +155,7 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
138 155
                     JitsiConferenceErrors.FOCUS_LEFT);
139 156
         });
140 157
 
141
-    conference.room.addListener(XMPPEvents.ALLOCATE_FOCUS_MAX_RETRIES_ERROR,
158
+    chatRoom.addListener(XMPPEvents.ALLOCATE_FOCUS_MAX_RETRIES_ERROR,
142 159
         function () {
143 160
             conference.connection._reload();
144 161
         });
@@ -159,7 +176,7 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
159 176
         JitsiConferenceEvents.CONFERENCE_FAILED,
160 177
         JitsiConferenceErrors.SETUP_FAILED);
161 178
 
162
-    conference.room.setParticipantPropertyListener(function (node, from) {
179
+    chatRoom.setParticipantPropertyListener(function (node, from) {
163 180
         var participant = conference.getParticipantById(from);
164 181
         if (!participant) {
165 182
             return;
@@ -173,15 +190,15 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
173 190
     this.chatRoomForwarder.forward(XMPPEvents.KICKED,
174 191
         JitsiConferenceEvents.KICKED);
175 192
 
176
-    conference.room.addListener(XMPPEvents.MUC_MEMBER_JOINED,
193
+    chatRoom.addListener(XMPPEvents.MUC_MEMBER_JOINED,
177 194
         conference.onMemberJoined.bind(conference));
178
-    conference.room.addListener(XMPPEvents.MUC_MEMBER_LEFT,
195
+    chatRoom.addListener(XMPPEvents.MUC_MEMBER_LEFT,
179 196
         conference.onMemberLeft.bind(conference));
180 197
 
181
-    conference.room.addListener(XMPPEvents.DISPLAY_NAME_CHANGED,
198
+    chatRoom.addListener(XMPPEvents.DISPLAY_NAME_CHANGED,
182 199
         conference.onDisplayNameChanged.bind(conference));
183 200
 
184
-    conference.room.addListener(XMPPEvents.LOCAL_ROLE_CHANGED, function (role) {
201
+    chatRoom.addListener(XMPPEvents.LOCAL_ROLE_CHANGED, function (role) {
185 202
         conference.eventEmitter.emit(JitsiConferenceEvents.USER_ROLE_CHANGED,
186 203
             conference.myUserId(), role);
187 204
 
@@ -195,10 +212,10 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
195 212
         }
196 213
     });
197 214
 
198
-    conference.room.addListener(XMPPEvents.MUC_ROLE_CHANGED,
215
+    chatRoom.addListener(XMPPEvents.MUC_ROLE_CHANGED,
199 216
         conference.onUserRoleChanged.bind(conference));
200 217
 
201
-    conference.room.addListener(AuthenticationEvents.IDENTITY_UPDATED,
218
+    chatRoom.addListener(AuthenticationEvents.IDENTITY_UPDATED,
202 219
         function (authEnabled, authIdentity) {
203 220
             conference.authEnabled = authEnabled;
204 221
             conference.authIdentity = authIdentity;
@@ -207,14 +224,14 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
207 224
                 authIdentity);
208 225
         });
209 226
 
210
-    conference.room.addListener(XMPPEvents.MESSAGE_RECEIVED,
227
+    chatRoom.addListener(XMPPEvents.MESSAGE_RECEIVED,
211 228
         function (jid, displayName, txt, myJid, ts) {
212 229
             var id = Strophe.getResourceFromJid(jid);
213 230
             conference.eventEmitter.emit(JitsiConferenceEvents.MESSAGE_RECEIVED,
214 231
                 id, txt, ts);
215 232
         });
216 233
 
217
-    conference.room.addListener(XMPPEvents.PRESENCE_STATUS,
234
+    chatRoom.addListener(XMPPEvents.PRESENCE_STATUS,
218 235
         function (jid, status) {
219 236
             var id = Strophe.getResourceFromJid(jid);
220 237
             var participant = conference.getParticipantById(id);
@@ -226,7 +243,7 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
226 243
                 JitsiConferenceEvents.USER_STATUS_CHANGED, id, status);
227 244
         });
228 245
 
229
-    conference.room.addPresenceListener("startmuted", function (data, from) {
246
+    chatRoom.addPresenceListener("startmuted", function (data, from) {
230 247
         var isModerator = false;
231 248
         if (conference.myUserId() === from && conference.isModerator()) {
232 249
             isModerator = true;
@@ -264,21 +281,21 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
264 281
         }
265 282
     });
266 283
 
267
-    conference.room.addPresenceListener("videomuted", function (values, from) {
284
+    chatRoom.addPresenceListener("videomuted", function (values, from) {
268 285
         conference.rtc.handleRemoteTrackMute(MediaType.VIDEO,
269 286
             values.value == "true", from);
270 287
     });
271 288
 
272
-    conference.room.addPresenceListener("audiomuted", function (values, from) {
289
+    chatRoom.addPresenceListener("audiomuted", function (values, from) {
273 290
         conference.rtc.handleRemoteTrackMute(MediaType.AUDIO,
274 291
             values.value == "true", from);
275 292
     });
276 293
 
277
-    conference.room.addPresenceListener("videoType", function(data, from) {
294
+    chatRoom.addPresenceListener("videoType", function(data, from) {
278 295
         conference.rtc.handleRemoteTrackVideoTypeChanged(data.value, from);
279 296
     });
280 297
 
281
-    conference.room.addPresenceListener("devices", function (data, from) {
298
+    chatRoom.addPresenceListener("devices", function (data, from) {
282 299
         var isAudioAvailable = false;
283 300
         var isVideoAvailable = false;
284 301
         data.children.forEach(function (config) {
@@ -322,40 +339,37 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
322 339
     });
323 340
 
324 341
     if(conference.statistics) {
325
-        conference.room.addListener(XMPPEvents.DISPOSE_CONFERENCE,
342
+        chatRoom.addListener(XMPPEvents.DISPOSE_CONFERENCE,
326 343
             function () {
327 344
                 conference.statistics.dispose();
328 345
             });
329 346
 
330
-        conference.room.addListener(XMPPEvents.CONNECTION_ICE_FAILED,
347
+        chatRoom.addListener(XMPPEvents.CONNECTION_ICE_FAILED,
331 348
             function (pc) {
332 349
                 conference.statistics.sendIceConnectionFailedEvent(pc);
333
-                conference.room.eventEmitter.emit(
334
-                    XMPPEvents.CONFERENCE_SETUP_FAILED,
335
-                    new Error("ICE fail"));
336 350
             });
337 351
 
338
-        conference.room.addListener(XMPPEvents.CREATE_OFFER_FAILED,
352
+        chatRoom.addListener(XMPPEvents.CREATE_OFFER_FAILED,
339 353
             function (e, pc) {
340 354
                 conference.statistics.sendCreateOfferFailed(e, pc);
341 355
             });
342 356
 
343
-        conference.room.addListener(XMPPEvents.CREATE_ANSWER_FAILED,
357
+        chatRoom.addListener(XMPPEvents.CREATE_ANSWER_FAILED,
344 358
             function (e, pc) {
345 359
                 conference.statistics.sendCreateAnswerFailed(e, pc);
346 360
             });
347 361
 
348
-        conference.room.addListener(XMPPEvents.SET_LOCAL_DESCRIPTION_FAILED,
362
+        chatRoom.addListener(XMPPEvents.SET_LOCAL_DESCRIPTION_FAILED,
349 363
             function (e, pc) {
350 364
                 conference.statistics.sendSetLocalDescFailed(e, pc);
351 365
             });
352 366
 
353
-        conference.room.addListener(XMPPEvents.SET_REMOTE_DESCRIPTION_FAILED,
367
+        chatRoom.addListener(XMPPEvents.SET_REMOTE_DESCRIPTION_FAILED,
354 368
             function (e, pc) {
355 369
                 conference.statistics.sendSetRemoteDescFailed(e, pc);
356 370
             });
357 371
 
358
-        conference.room.addListener(XMPPEvents.ADD_ICE_CANDIDATE_FAILED,
372
+        chatRoom.addListener(XMPPEvents.ADD_ICE_CANDIDATE_FAILED,
359 373
             function (e, pc) {
360 374
                 conference.statistics.sendAddIceCandidateFailed(e, pc);
361 375
             });
@@ -421,11 +435,13 @@ JitsiConferenceEventManager.prototype.setupXMPPListeners = function () {
421 435
             // mute existing local tracks because this is initial mute from
422 436
             // Jicofo
423 437
             conference.getLocalTracks().forEach(function (track) {
424
-                if (conference.startAudioMuted && track.isAudioTrack()) {
425
-                    track.mute();
426
-                }
427
-                if (conference.startVideoMuted && track.isVideoTrack()) {
428
-                    track.mute();
438
+                switch (track.getType()) {
439
+                    case MediaType.AUDIO:
440
+                        conference.startAudioMuted && track.mute();
441
+                        break;
442
+                    case MediaType.VIDEO:
443
+                        conference.startVideoMuted && track.mute();
444
+                        break;
429 445
                 }
430 446
             });
431 447
 
@@ -442,8 +458,6 @@ JitsiConferenceEventManager.prototype.setupStatisticsListeners = function () {
442 458
         return;
443 459
 
444 460
     conference.statistics.addAudioLevelListener(function (ssrc, level) {
445
-        var userId = null;
446
-
447 461
         var resource = conference.rtc.getResourceBySSRC(ssrc);
448 462
         if (!resource)
449 463
             return;
@@ -482,14 +496,6 @@ JitsiConferenceEventManager.prototype.setupStatisticsListeners = function () {
482 496
         conference.eventEmitter.emit(
483 497
             JitsiConferenceEvents.CONNECTION_STATS, stats);
484 498
     });
485
-
486
-    conference.on(JitsiConferenceEvents.TRACK_MUTE_CHANGED,
487
-        function (track) {
488
-            if(!track.isLocal())
489
-                return;
490
-            var type = (track.getType() === "audio")? "audio" : "video";
491
-            conference.statistics.sendMuteEvent(track.isMuted(), type);
492
-        });
493 499
 };
494 500
 
495 501
 module.exports = JitsiConferenceEventManager;

+ 4
- 5
JitsiConnection.js Bestand weergeven

@@ -58,9 +58,8 @@ JitsiConnection.prototype.attach = function (options) {
58 58
 
59 59
 /**
60 60
  * Reloads the JitsiConnection instance and all related conferences
61
- * @param options {object} options to be overriden
62 61
  */
63
-JitsiConnection.prototype._reload = function (options) {
62
+JitsiConnection.prototype._reload = function () {
64 63
     if(this.retryOnFail === 0)
65 64
         return false;
66 65
     this.retryOnFail--;
@@ -73,7 +72,7 @@ JitsiConnection.prototype._reload = function (options) {
73 72
         this._reloadConferences.bind(this, states);
74 73
     this.addEventListener(JitsiConnectionEvents.CONNECTION_ESTABLISHED,
75 74
         this.connectionEstablishedHandler);
76
-    this.xmpp.reload(options || {});
75
+    this.xmpp.reload();
77 76
     return true;
78 77
 }
79 78
 
@@ -87,8 +86,8 @@ JitsiConnection.prototype._reloadConferences = function (states) {
87 86
     this.connectionEstablishedHandler = null;
88 87
     states = states || {};
89 88
     for(var name in this.conferences) {
90
-        this.conferences[name]._reinitialize({connection: this,
91
-            roomState: states[name]});
89
+        this.conferences[name]._init({roomState: states[name]});
90
+        this.conferences[name].join();
92 91
     }
93 92
 }
94 93
 

+ 6
- 10
modules/statistics/statistics.js Bestand weergeven

@@ -21,12 +21,13 @@ var JitsiTrackError = require("../../JitsiTrackError");
21 21
 // downloading their API as soon as possible and (2) do the downloading
22 22
 // asynchronously.
23 23
 function loadCallStatsAPI() {
24
-    if(!isCallstatsLoaded)
24
+    if(!isCallstatsLoaded) {
25 25
         ScriptUtil.loadScript(
26 26
                 'https://api.callstats.io/static/callstats.min.js',
27 27
                 /* async */ true,
28 28
                 /* prepend */ true);
29
-    isCallstatsLoaded = true;
29
+        isCallstatsLoaded = true;
30
+    }
30 31
     // FIXME At the time of this writing, we hope that the callstats.io API will
31 32
     // have loaded by the time we needed it (i.e. CallStats.init is invoked).
32 33
 }
@@ -221,14 +222,9 @@ Statistics.prototype.startCallStats = function (session, settings) {
221 222
  * Removes the callstats.io instances.
222 223
  */
223 224
 Statistics.prototype.stopCallStats = function () {
224
-    if(this.callStatsIntegrationEnabled && this.callstats) {
225
-        var callstatsList = Statistics.callsStatsInstances;
226
-        for(var i = 0;i < callstatsList.length; i++) {
227
-            if(this.callstats === callstatsList[i]) {
228
-                Statistics.callsStatsInstances.splice(i, 1);
229
-                break;
230
-            }
231
-        }
225
+    if(this.callstats) {
226
+        var index = Statistics.callsStatsInstances.indexOf(this.callstats);
227
+        Statistics.callsStatsInstances.splice(index, 1);
232 228
         this.callstats = null;
233 229
         CallStats.dispose();
234 230
     }

+ 3
- 4
modules/xmpp/JingleSessionPC.js Bestand weergeven

@@ -1103,10 +1103,9 @@ JingleSessionPC.prototype.newJingleErrorHandler = function(request, failureCb) {
1103 1103
             error.source = request.tree();
1104 1104
         }
1105 1105
 
1106
-        // Commented to fix JSON.stringify(error) exception for
1107
-        // circular dependancies when we print that error.
1108
-        // FIXME: Maybe we can include
1109
-        // part of the session object
1106
+        // Commented to fix JSON.stringify(error) exception for circular
1107
+        // dependancies when we print that error.
1108
+        // FIXME: Maybe we can include part of the session object
1110 1109
         // error.session = this;
1111 1110
 
1112 1111
         logger.error("Jingle error", error);

+ 1
- 12
modules/xmpp/xmpp.js Bestand weergeven

@@ -60,19 +60,8 @@ function XMPP(options, token) {
60 60
 
61 61
 /**
62 62
  * Reloads the XMPP module
63
- * @param options {object} options to be overriden
64 63
  */
65
-XMPP.prototype.reload = function (options) {
66
-    if(!options)
67
-        options = {};
68
-    if(!this.options) {
69
-        this.options = options;
70
-    } else {
71
-        // Override config options
72
-        for(var key in options)
73
-            this.options[key] = options[key] || this.options[key];
74
-    }
75
-
64
+XMPP.prototype.reload = function () {
76 65
     this.disconnect();
77 66
     this.connection.pause();
78 67
     this.connection = createConnection(this.options.bosh, this.token);

Laden…
Annuleren
Opslaan