|
@@ -188,6 +188,9 @@ $(document).bind('entered.muc', function (event, jid, info) {
|
188
|
188
|
focus.addNewParticipant(jid);
|
189
|
189
|
}
|
190
|
190
|
}
|
|
191
|
+ else if (sharedKey) {
|
|
192
|
+ updateLockButton();
|
|
193
|
+ }
|
191
|
194
|
});
|
192
|
195
|
|
193
|
196
|
$(document).bind('left.muc', function (event, jid) {
|
|
@@ -208,6 +211,33 @@ $(document).bind('left.muc', function (event, jid) {
|
208
|
211
|
}
|
209
|
212
|
});
|
210
|
213
|
|
|
214
|
+$(document).bind('passwordrequired.muc', function (event, jid) {
|
|
215
|
+ console.log('on password required', jid);
|
|
216
|
+
|
|
217
|
+ $.prompt('<h2>Password required</h2>' +
|
|
218
|
+ '<input id="lockKey" type="text" placeholder="shared key" autofocus>',
|
|
219
|
+ {
|
|
220
|
+ persistent: true,
|
|
221
|
+ buttons: { "Ok": true , "Cancel": false},
|
|
222
|
+ defaultButton: 1,
|
|
223
|
+ loaded: function(event) {
|
|
224
|
+ document.getElementById('lockKey').focus();
|
|
225
|
+ },
|
|
226
|
+ submit: function(e,v,m,f){
|
|
227
|
+ if(v)
|
|
228
|
+ {
|
|
229
|
+ var lockKey = document.getElementById('lockKey');
|
|
230
|
+
|
|
231
|
+ if (lockKey.value != null)
|
|
232
|
+ {
|
|
233
|
+ setSharedKey(lockKey);
|
|
234
|
+ connection.emuc.doJoin(jid, lockKey.value);
|
|
235
|
+ }
|
|
236
|
+ }
|
|
237
|
+ }
|
|
238
|
+ });
|
|
239
|
+});
|
|
240
|
+
|
211
|
241
|
function toggleVideo() {
|
212
|
242
|
if (!(connection && connection.jingle.localStream)) return;
|
213
|
243
|
for (var idx = 0; idx < connection.jingle.localStream.getVideoTracks().length; idx++) {
|
|
@@ -357,44 +387,62 @@ function buttonClick(id, classname) {
|
357
|
387
|
* Opens the lock room dialog.
|
358
|
388
|
*/
|
359
|
389
|
function openLockDialog() {
|
360
|
|
- if (sharedKey)
|
361
|
|
- $.prompt("Are you sure you would like to remove your secret key?",
|
362
|
|
- {
|
363
|
|
- title: "Remove secrect key",
|
364
|
|
- persistent: false,
|
365
|
|
- buttons: { "Remove": true, "Cancel": false},
|
366
|
|
- defaultButton: 1,
|
367
|
|
- submit: function(e,v,m,f){
|
368
|
|
- if(v)
|
369
|
|
- {
|
370
|
|
- sharedKey = '';
|
371
|
|
- lockRoom();
|
372
|
|
- }
|
373
|
|
- }
|
374
|
|
- });
|
375
|
|
- else
|
376
|
|
- $.prompt('<h2>Set a secrect key to lock your room</h2>' +
|
377
|
|
- '<input id="lockKey" type="text" placeholder="your shared key" autofocus>',
|
378
|
|
- {
|
379
|
|
- persistent: false,
|
380
|
|
- buttons: { "Save": true , "Cancel": false},
|
381
|
|
- defaultButton: 1,
|
382
|
|
- loaded: function(event) {
|
383
|
|
- document.getElementById('lockKey').focus();
|
384
|
|
- },
|
385
|
|
- submit: function(e,v,m,f){
|
386
|
|
- if(v)
|
387
|
|
- {
|
388
|
|
- var lockKey = document.getElementById('lockKey');
|
389
|
|
-
|
390
|
|
- if (lockKey.value != null)
|
391
|
|
- {
|
392
|
|
- sharedKey = lockKey.value;
|
|
390
|
+ // Only the focus is able to set a shared key.
|
|
391
|
+ if (focus == null) {
|
|
392
|
+ if (sharedKey)
|
|
393
|
+ $.prompt("This conversation is currently protected by a shared secret key.",
|
|
394
|
+ {
|
|
395
|
+ title: "Secrect key",
|
|
396
|
+ persistent: false
|
|
397
|
+ });
|
|
398
|
+ else
|
|
399
|
+ $.prompt("This conversation isn't currently protected by a secret key. Only the owner of the conference could set a shared key.",
|
|
400
|
+ {
|
|
401
|
+ title: "Secrect key",
|
|
402
|
+ persistent: false
|
|
403
|
+ });
|
|
404
|
+ }
|
|
405
|
+ else {
|
|
406
|
+ if (sharedKey)
|
|
407
|
+ $.prompt("Are you sure you would like to remove your secret key?",
|
|
408
|
+ {
|
|
409
|
+ title: "Remove secrect key",
|
|
410
|
+ persistent: false,
|
|
411
|
+ buttons: { "Remove": true, "Cancel": false},
|
|
412
|
+ defaultButton: 1,
|
|
413
|
+ submit: function(e,v,m,f){
|
|
414
|
+ if(v)
|
|
415
|
+ {
|
|
416
|
+ setSharedKey('');
|
|
417
|
+ lockRoom();
|
|
418
|
+ }
|
|
419
|
+ }
|
|
420
|
+ });
|
|
421
|
+ else
|
|
422
|
+ $.prompt('<h2>Set a secrect key to lock your room</h2>' +
|
|
423
|
+ '<input id="lockKey" type="text" placeholder="your shared key" autofocus>',
|
|
424
|
+ {
|
|
425
|
+ persistent: false,
|
|
426
|
+ buttons: { "Save": true , "Cancel": false},
|
|
427
|
+ defaultButton: 1,
|
|
428
|
+ loaded: function(event) {
|
|
429
|
+ document.getElementById('lockKey').focus();
|
|
430
|
+ },
|
|
431
|
+ submit: function(e,v,m,f){
|
|
432
|
+ if(v)
|
|
433
|
+ {
|
|
434
|
+ var lockKey = document.getElementById('lockKey');
|
|
435
|
+
|
|
436
|
+ if (lockKey.value)
|
|
437
|
+ {
|
|
438
|
+ console.log("LOCK KEY", lockKey.value);
|
|
439
|
+ setSharedKey(lockKey.value);
|
393
|
440
|
lockRoom(true);
|
394
|
|
- }
|
|
441
|
+ }
|
395
|
442
|
}
|
396
|
443
|
}
|
397
|
444
|
});
|
|
445
|
+ }
|
398
|
446
|
}
|
399
|
447
|
|
400
|
448
|
/*
|
|
@@ -418,6 +466,20 @@ function openLinkDialog() {
|
418
|
466
|
function lockRoom(lock) {
|
419
|
467
|
connection.emuc.lockRoom(sharedKey);
|
420
|
468
|
|
|
469
|
+ updateLockButton();
|
|
470
|
+}
|
|
471
|
+
|
|
472
|
+/*
|
|
473
|
+ * Sets the shared key.
|
|
474
|
+ */
|
|
475
|
+function setSharedKey(sKey) {
|
|
476
|
+ sharedKey = sKey;
|
|
477
|
+}
|
|
478
|
+
|
|
479
|
+/*
|
|
480
|
+ * Updates the lock button state.
|
|
481
|
+ */
|
|
482
|
+function updateLockButton() {
|
421
|
483
|
buttonClick("#lockIcon", "fa fa-unlock fa-lg fa fa-lock fa-lg");
|
422
|
484
|
}
|
423
|
485
|
|