|
@@ -26,7 +26,6 @@ var JitsiPopover = require("./util/JitsiPopover");
|
26
|
26
|
var CQEvents = require("../../service/connectionquality/CQEvents");
|
27
|
27
|
var DesktopSharingEventTypes
|
28
|
28
|
= require("../../service/desktopsharing/DesktopSharingEventTypes");
|
29
|
|
-var XMPPEvents = require("../../service/xmpp/XMPPEvents");
|
30
|
29
|
var StatisticsEvents = require("../../service/statistics/Events");
|
31
|
30
|
var UIEvents = require("../../service/UI/UIEvents");
|
32
|
31
|
var MemberEvents = require("../../service/members/Events");
|
|
@@ -101,129 +100,74 @@ function setupToolbars() {
|
101
|
100
|
BottomToolbar.init(eventEmitter);
|
102
|
101
|
}
|
103
|
102
|
|
104
|
|
-function onDisposeConference(unload) {
|
105
|
|
- Toolbar.showAuthenticateButton(false);
|
106
|
|
-}
|
|
103
|
+UI.notifyGracefulShudown = function () {
|
|
104
|
+ messageHandler.openMessageDialog(
|
|
105
|
+ 'dialog.serviceUnavailable',
|
|
106
|
+ 'dialog.gracefulShutdown'
|
|
107
|
+ );
|
|
108
|
+};
|
107
|
109
|
|
108
|
|
-function onDisplayNameChanged(jid, displayName) {
|
|
110
|
+UI.notifyReservationError = function (code, msg) {
|
|
111
|
+ var title = APP.translation.generateTranslationHTML(
|
|
112
|
+ "dialog.reservationError");
|
|
113
|
+ var message = APP.translation.generateTranslationHTML(
|
|
114
|
+ "dialog.reservationErrorMsg", {code: code, msg: msg});
|
|
115
|
+ messageHandler.openDialog(
|
|
116
|
+ title,
|
|
117
|
+ message,
|
|
118
|
+ true, {},
|
|
119
|
+ function (event, value, message, formVals) {
|
|
120
|
+ return false;
|
|
121
|
+ }
|
|
122
|
+ );
|
|
123
|
+};
|
|
124
|
+
|
|
125
|
+UI.notifyKicked = function () {
|
|
126
|
+ messageHandler.openMessageDialog("dialog.sessTerminated", "dialog.kickMessage");
|
|
127
|
+};
|
|
128
|
+
|
|
129
|
+UI.notifyBridgeDown = function () {
|
|
130
|
+ messageHandler.showError("dialog.error", "dialog.bridgeUnavailable");
|
|
131
|
+};
|
|
132
|
+
|
|
133
|
+UI.changeDisplayName = function (jid, displayName) {
|
109
|
134
|
ContactList.onDisplayNameChange(jid, displayName);
|
110
|
135
|
SettingsMenu.onDisplayNameChange(jid, displayName);
|
111
|
136
|
VideoLayout.onDisplayNameChanged(jid, displayName);
|
112
|
|
-}
|
|
137
|
+};
|
113
|
138
|
|
114
|
|
-function registerListeners() {
|
115
|
|
- APP.xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
|
116
|
|
- APP.xmpp.addListener(XMPPEvents.GRACEFUL_SHUTDOWN, function () {
|
117
|
|
- messageHandler.openMessageDialog(
|
118
|
|
- 'dialog.serviceUnavailable',
|
119
|
|
- 'dialog.gracefulShutdown'
|
120
|
|
- );
|
121
|
|
- });
|
122
|
|
- APP.xmpp.addListener(XMPPEvents.RESERVATION_ERROR, function (code, msg) {
|
123
|
|
- var title = APP.translation.generateTranslationHTML(
|
124
|
|
- "dialog.reservationError");
|
125
|
|
- var message = APP.translation.generateTranslationHTML(
|
126
|
|
- "dialog.reservationErrorMsg", {code: code, msg: msg});
|
127
|
|
- messageHandler.openDialog(
|
128
|
|
- title,
|
129
|
|
- message,
|
130
|
|
- true, {},
|
131
|
|
- function (event, value, message, formVals) {
|
132
|
|
- return false;
|
133
|
|
- }
|
134
|
|
- );
|
135
|
|
- });
|
136
|
|
- APP.xmpp.addListener(XMPPEvents.KICKED, function () {
|
137
|
|
- messageHandler.openMessageDialog("dialog.sessTerminated",
|
138
|
|
- "dialog.kickMessage");
|
139
|
|
- });
|
140
|
|
- APP.xmpp.addListener(XMPPEvents.MUC_DESTROYED, function (reason) {
|
141
|
|
- //FIXME: use Session Terminated from translation, but
|
142
|
|
- // 'reason' text comes from XMPP packet and is not translated
|
143
|
|
- var title = APP.translation.generateTranslationHTML("dialog.sessTerminated");
|
144
|
|
- messageHandler.openDialog(
|
145
|
|
- title, reason, true, {},
|
146
|
|
- function (event, value, message, formVals) {
|
147
|
|
- return false;
|
148
|
|
- }
|
149
|
|
- );
|
150
|
|
- });
|
151
|
|
- APP.xmpp.addListener(XMPPEvents.BRIDGE_DOWN, function () {
|
152
|
|
- messageHandler.showError("dialog.error",
|
153
|
|
- "dialog.bridgeUnavailable");
|
154
|
|
- });
|
155
|
|
- APP.xmpp.addListener(XMPPEvents.USER_ID_CHANGED, function (from, id) {
|
156
|
|
- Avatar.setUserAvatar(from, id);
|
157
|
|
- });
|
158
|
|
- APP.xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, onDisplayNameChanged);
|
159
|
|
- APP.xmpp.addListener(XMPPEvents.MUC_JOINED, onMucJoined);
|
160
|
|
- APP.xmpp.addListener(XMPPEvents.LOCAL_ROLE_CHANGED, onLocalRoleChanged);
|
161
|
|
- APP.xmpp.addListener(XMPPEvents.MUC_MEMBER_JOINED, onMucMemberJoined);
|
162
|
|
- APP.xmpp.addListener(XMPPEvents.MUC_ROLE_CHANGED, onMucRoleChanged);
|
163
|
|
- APP.xmpp.addListener(XMPPEvents.PRESENCE_STATUS, onMucPresenceStatus);
|
164
|
|
- APP.xmpp.addListener(XMPPEvents.SUBJECT_CHANGED, chatSetSubject);
|
165
|
|
- APP.xmpp.addListener(XMPPEvents.MUC_MEMBER_LEFT, onMucMemberLeft);
|
166
|
|
- APP.xmpp.addListener(XMPPEvents.PASSWORD_REQUIRED, onPasswordRequired);
|
167
|
|
- APP.xmpp.addListener(XMPPEvents.ETHERPAD, initEtherpad);
|
168
|
|
- APP.xmpp.addListener(XMPPEvents.AUTHENTICATION_REQUIRED,
|
169
|
|
- onAuthenticationRequired);
|
170
|
|
- APP.xmpp.addListener(XMPPEvents.PARTICIPANT_VIDEO_TYPE_CHANGED,
|
171
|
|
- onPeerVideoTypeChanged);
|
172
|
|
- APP.xmpp.addListener(XMPPEvents.DEVICE_AVAILABLE,
|
173
|
|
- function (resource, devices) {
|
174
|
|
- VideoLayout.setDeviceAvailabilityIcons(resource, devices);
|
175
|
|
- });
|
|
139
|
+UI.initConference = function () {
|
|
140
|
+ // FIXME find own jid
|
|
141
|
+ var jid = "asdfasdf";
|
176
|
142
|
|
177
|
|
- APP.xmpp.addListener(XMPPEvents.PARTICIPANT_AUDIO_MUTED,
|
178
|
|
- VideoLayout.onAudioMute);
|
179
|
|
- APP.xmpp.addListener(XMPPEvents.PARTICIPANT_VIDEO_MUTED,
|
180
|
|
- VideoLayout.onVideoMute);
|
181
|
|
- APP.members.addListener(MemberEvents.DTMF_SUPPORT_CHANGED,
|
182
|
|
- onDtmfSupportChanged);
|
183
|
|
- APP.xmpp.addListener(XMPPEvents.START_MUTED_SETTING_CHANGED, function (audio, video) {
|
184
|
|
- SettingsMenu.setStartMuted(audio, video);
|
185
|
|
- });
|
|
143
|
+ Toolbar.updateRoomUrl(window.location.href);
|
|
144
|
+ var meHTML = APP.translation.generateTranslationHTML("me");
|
|
145
|
+ $("#localNick").html(Strophe.getResourceFromJid(jid) + " (" + meHTML + ")");
|
186
|
146
|
|
187
|
|
- APP.xmpp.addListener(XMPPEvents.JINGLE_FATAL_ERROR, function (session, error) {
|
188
|
|
- UI.messageHandler.showError("dialog.sorry",
|
189
|
|
- "dialog.internalError");
|
190
|
|
- });
|
|
147
|
+ var settings = Settings.getSettings();
|
191
|
148
|
|
192
|
|
- APP.xmpp.addListener(XMPPEvents.PROMPT_FOR_LOGIN, function (callback) {
|
193
|
|
- // FIXME: re-use LoginDialog which supports retries
|
194
|
|
- if (config.token) {
|
195
|
|
- messageHandler.showError("dialog.error", "dialog.tokenAuthFailed");
|
196
|
|
- } else {
|
197
|
|
- UI.showLoginPopup(callback);
|
198
|
|
- }
|
199
|
|
- });
|
|
149
|
+ // Make sure we configure our avatar id, before creating avatar for us
|
|
150
|
+ Avatar.setUserAvatar(jid, settings.email || settings.uid);
|
200
|
151
|
|
201
|
|
- APP.xmpp.addListener(XMPPEvents.FOCUS_DISCONNECTED, function (focusComponent, retrySec) {
|
202
|
|
- UI.messageHandler.notify(
|
203
|
|
- null, "notify.focus",
|
204
|
|
- 'disconnected', "notify.focusFail",
|
205
|
|
- {component: focusComponent, ms: retrySec});
|
206
|
|
- });
|
|
152
|
+ // Add myself to the contact list.
|
|
153
|
+ ContactList.addContact(jid);
|
207
|
154
|
|
208
|
|
- APP.xmpp.addListener(XMPPEvents.ROOM_JOIN_ERROR, function (pres) {
|
209
|
|
- UI.messageHandler.openReportDialog(null,
|
210
|
|
- "dialog.connectError", pres);
|
211
|
|
- });
|
212
|
|
- APP.xmpp.addListener(XMPPEvents.ROOM_CONNECT_ERROR, function (pres) {
|
213
|
|
- UI.messageHandler.openReportDialog(null,
|
214
|
|
- "dialog.connectError", pres);
|
215
|
|
- });
|
|
155
|
+ // Once we've joined the muc show the toolbar
|
|
156
|
+ ToolbarToggler.showToolbar();
|
216
|
157
|
|
217
|
|
- APP.xmpp.addListener(XMPPEvents.READY_TO_JOIN, function () {
|
218
|
|
- var roomName = UI.generateRoomName();
|
219
|
|
- APP.xmpp.allocateConferenceFocus(roomName, UI.checkForNicknameAndJoin);
|
220
|
|
- });
|
|
158
|
+ var displayName =
|
|
159
|
+ config.displayJids ? Strophe.getResourceFromJid(jid) : settings.displayName;
|
221
|
160
|
|
222
|
|
- //NicknameHandler emits this event
|
223
|
|
- UI.addListener(UIEvents.NICKNAME_CHANGED, function (nickname) {
|
224
|
|
- APP.xmpp.addToPresence("displayName", nickname);
|
225
|
|
- });
|
|
161
|
+ if (displayName) {
|
|
162
|
+ UI.changeDisplayName('localVideoContainer', displayName);
|
|
163
|
+ }
|
|
164
|
+
|
|
165
|
+ VideoLayout.mucJoined();
|
|
166
|
+
|
|
167
|
+ Toolbar.checkAutoEnableDesktopSharing();
|
|
168
|
+};
|
226
|
169
|
|
|
170
|
+function registerListeners() {
|
227
|
171
|
UI.addListener(UIEvents.LARGEVIDEO_INIT, function () {
|
228
|
172
|
AudioLevels.init();
|
229
|
173
|
});
|
|
@@ -231,15 +175,6 @@ function registerListeners() {
|
231
|
175
|
UI.addListener(UIEvents.FILM_STRIP_TOGGLED, function (isToggled) {
|
232
|
176
|
VideoLayout.onFilmStripToggled(isToggled);
|
233
|
177
|
});
|
234
|
|
-
|
235
|
|
- if (!interfaceConfig.filmStripOnly) {
|
236
|
|
- APP.xmpp.addListener(XMPPEvents.MESSAGE_RECEIVED, updateChatConversation);
|
237
|
|
- APP.xmpp.addListener(XMPPEvents.CHAT_ERROR_RECEIVED, chatAddError);
|
238
|
|
- // Listens for video interruption events.
|
239
|
|
- APP.xmpp.addListener(XMPPEvents.CONNECTION_INTERRUPTED, VideoLayout.onVideoInterrupted);
|
240
|
|
- // Listens for video restores events.
|
241
|
|
- APP.xmpp.addListener(XMPPEvents.CONNECTION_RESTORED, VideoLayout.onVideoRestored);
|
242
|
|
- }
|
243
|
178
|
}
|
244
|
179
|
|
245
|
180
|
function onResize() {
|
|
@@ -296,7 +231,8 @@ UI.start = function () {
|
296
|
231
|
$('#notice').css({display: 'block'});
|
297
|
232
|
}
|
298
|
233
|
$("#downloadlog").click(function (event) {
|
299
|
|
- dump(event.target);
|
|
234
|
+ // dump(event.target);
|
|
235
|
+ // FIXME integrate logs
|
300
|
236
|
});
|
301
|
237
|
Feedback.init();
|
302
|
238
|
}
|
|
@@ -388,55 +324,10 @@ function updateChatConversation(from, displayName, message, myjid, stamp) {
|
388
|
324
|
return Chat.updateChatConversation(from, displayName, message, myjid, stamp);
|
389
|
325
|
}
|
390
|
326
|
|
391
|
|
-function onMucJoined(jid, info) {
|
392
|
|
- Toolbar.updateRoomUrl(window.location.href);
|
393
|
|
- var meHTML = APP.translation.generateTranslationHTML("me");
|
394
|
|
- $("#localNick").html(Strophe.getResourceFromJid(jid) + " (" + meHTML + ")");
|
395
|
|
-
|
396
|
|
- var settings = Settings.getSettings();
|
397
|
|
-
|
398
|
|
- // Make sure we configure our avatar id, before creating avatar for us
|
399
|
|
- Avatar.setUserAvatar(jid, settings.email || settings.uid);
|
400
|
|
-
|
401
|
|
- // Add myself to the contact list.
|
402
|
|
- ContactList.addContact(jid);
|
403
|
|
-
|
404
|
|
- // Once we've joined the muc show the toolbar
|
405
|
|
- ToolbarToggler.showToolbar();
|
406
|
|
-
|
407
|
|
- var displayName =
|
408
|
|
- config.displayJids ? Strophe.getResourceFromJid(jid) : info.displayName;
|
409
|
|
-
|
410
|
|
- if (displayName)
|
411
|
|
- onDisplayNameChanged('localVideoContainer', displayName);
|
412
|
|
-
|
413
|
|
-
|
414
|
|
- VideoLayout.mucJoined();
|
415
|
|
-
|
416
|
|
- Toolbar.checkAutoEnableDesktopSharing();
|
417
|
|
-}
|
418
|
|
-
|
419
|
327
|
function initEtherpad(name) {
|
420
|
328
|
Etherpad.init(name);
|
421
|
329
|
}
|
422
|
330
|
|
423
|
|
-function onMucMemberLeft(jid) {
|
424
|
|
- console.log('left.muc', jid);
|
425
|
|
- var displayName = $('#participant_' + Strophe.getResourceFromJid(jid) +
|
426
|
|
- '>.displayname').html();
|
427
|
|
- messageHandler.notify(displayName,'notify.somebody',
|
428
|
|
- 'disconnected',
|
429
|
|
- 'notify.disconnected');
|
430
|
|
- if (!config.startAudioMuted ||
|
431
|
|
- config.startAudioMuted > APP.members.size()) {
|
432
|
|
- UIUtil.playSoundNotification('userLeft');
|
433
|
|
- }
|
434
|
|
-
|
435
|
|
- ContactList.removeContact(jid);
|
436
|
|
-
|
437
|
|
- VideoLayout.participantLeft(jid);
|
438
|
|
-}
|
439
|
|
-
|
440
|
331
|
function onLocalRoleChanged(jid, info, pres, isModerator) {
|
441
|
332
|
console.info("My role changed, new role: " + info.role);
|
442
|
333
|
onModeratorStatusChanged(isModerator);
|
|
@@ -462,7 +353,7 @@ function onModeratorStatusChanged(isModerator) {
|
462
|
353
|
//Object.keys(connection.emuc.members).length >= 3);
|
463
|
354
|
}
|
464
|
355
|
|
465
|
|
-function onPasswordRequired(callback) {
|
|
356
|
+UI.notifyPasswordRequired = function (callback) {
|
466
|
357
|
// password is required
|
467
|
358
|
Toolbar.lockLockButton();
|
468
|
359
|
var message = '<h2 data-i18n="dialog.passwordRequired">';
|
|
@@ -490,7 +381,7 @@ function onPasswordRequired(callback) {
|
490
|
381
|
},
|
491
|
382
|
':input:first'
|
492
|
383
|
);
|
493
|
|
-}
|
|
384
|
+};
|
494
|
385
|
|
495
|
386
|
/**
|
496
|
387
|
* The dialpad button is shown iff there is at least one member that supports
|
|
@@ -501,7 +392,7 @@ function onDtmfSupportChanged(dtmfSupport) {
|
501
|
392
|
//Toolbar.showDialPadButton(dtmfSupport);
|
502
|
393
|
}
|
503
|
394
|
|
504
|
|
-function onMucMemberJoined(jid, id, displayName) {
|
|
395
|
+UI.addUser = function (jid, id, displayName) {
|
505
|
396
|
messageHandler.notify(displayName,'notify.somebody',
|
506
|
397
|
'connected',
|
507
|
398
|
'notify.connected');
|
|
@@ -515,7 +406,24 @@ function onMucMemberJoined(jid, id, displayName) {
|
515
|
406
|
|
516
|
407
|
// Add Peer's container
|
517
|
408
|
VideoLayout.ensurePeerContainerExists(jid);
|
518
|
|
-}
|
|
409
|
+};
|
|
410
|
+
|
|
411
|
+UI.removeUser = function (jid) {
|
|
412
|
+ console.log('left.muc', jid);
|
|
413
|
+ var displayName = $('#participant_' + Strophe.getResourceFromJid(jid) +
|
|
414
|
+ '>.displayname').html();
|
|
415
|
+ messageHandler.notify(displayName,'notify.somebody',
|
|
416
|
+ 'disconnected',
|
|
417
|
+ 'notify.disconnected');
|
|
418
|
+ if (!config.startAudioMuted ||
|
|
419
|
+ config.startAudioMuted > APP.members.size()) {
|
|
420
|
+ UIUtil.playSoundNotification('userLeft');
|
|
421
|
+ }
|
|
422
|
+
|
|
423
|
+ ContactList.removeContact(jid);
|
|
424
|
+
|
|
425
|
+ VideoLayout.participantLeft(jid);
|
|
426
|
+};
|
519
|
427
|
|
520
|
428
|
function onMucPresenceStatus(jid, info) {
|
521
|
429
|
VideoLayout.setPresenceStatus(Strophe.getResourceFromJid(jid), info.status);
|
|
@@ -544,12 +452,13 @@ function onMucRoleChanged(role, displayName) {
|
544
|
452
|
}
|
545
|
453
|
}
|
546
|
454
|
|
547
|
|
-function onAuthenticationRequired(intervalCallback) {
|
|
455
|
+UI.notifyAuthRequired = function (intervalCallback) {
|
548
|
456
|
Authentication.openAuthenticationDialog(
|
549
|
457
|
roomName, intervalCallback, function () {
|
550
|
458
|
Toolbar.authenticateClicked();
|
551
|
|
- });
|
552
|
|
-}
|
|
459
|
+ }
|
|
460
|
+ );
|
|
461
|
+};
|
553
|
462
|
|
554
|
463
|
|
555
|
464
|
UI.toggleSmileys = function () {
|
|
@@ -655,36 +564,14 @@ UI.showLoginPopup = function(callback) {
|
655
|
564
|
);
|
656
|
565
|
};
|
657
|
566
|
|
658
|
|
-UI.checkForNicknameAndJoin = function () {
|
659
|
|
-
|
|
567
|
+UI.closeAuthenticationDialog = function () {
|
660
|
568
|
Authentication.closeAuthenticationDialog();
|
661
|
569
|
Authentication.stopInterval();
|
|
570
|
+};
|
662
|
571
|
|
663
|
|
- var nick = null;
|
664
|
|
- if (config.useNicks) {
|
665
|
|
- nick = window.prompt('Your nickname (optional)');
|
666
|
|
- }
|
667
|
|
- APP.xmpp.joinRoom(roomName, config.useNicks, nick);
|
668
|
|
-};
|
669
|
|
-
|
670
|
|
-
|
671
|
|
-function dump(elem, filename) {
|
672
|
|
- elem = elem.parentNode;
|
673
|
|
- elem.download = filename || 'meetlog.json';
|
674
|
|
- elem.href = 'data:application/json;charset=utf-8,\n';
|
675
|
|
- var data = APP.xmpp.getJingleLog();
|
676
|
|
- var metadata = {};
|
677
|
|
- metadata.time = new Date();
|
678
|
|
- metadata.url = window.location.href;
|
679
|
|
- metadata.ua = navigator.userAgent;
|
680
|
|
- var log = APP.xmpp.getXmppLog();
|
681
|
|
- if (log) {
|
682
|
|
- metadata.xmpp = log;
|
683
|
|
- }
|
684
|
|
- data.metadata = metadata;
|
685
|
|
- elem.href += encodeURIComponent(JSON.stringify(data, null, ' '));
|
686
|
|
- return false;
|
687
|
|
-}
|
|
572
|
+UI.askForNickname = function () {
|
|
573
|
+ return window.prompt('Your nickname (optional)');
|
|
574
|
+};
|
688
|
575
|
|
689
|
576
|
UI.getRoomName = function () {
|
690
|
577
|
return roomName;
|
|
@@ -798,4 +685,8 @@ UI.updateRemoteStats = function (jid, percent, stats) {
|
798
|
685
|
VideoLayout.updateConnectionStats(jid, percent, stats);
|
799
|
686
|
};
|
800
|
687
|
|
|
688
|
+UI.showAuthenticateButton = function (show) {
|
|
689
|
+ Toolbar.showAuthenticateButton(show);
|
|
690
|
+};
|
|
691
|
+
|
801
|
692
|
module.exports = UI;
|