diff --git a/app.js b/app.js index c448b3797e..535dac43fb 100644 --- a/app.js +++ b/app.js @@ -1413,8 +1413,6 @@ function lockRoom(lock) { connection.emuc.lockRoom(sharedKey); else connection.emuc.lockRoom(''); - - Toolbar.updateLockButton(); } /** diff --git a/muc.js b/muc.js index a71dc28322..e4a32e4dc1 100644 --- a/muc.js +++ b/muc.js @@ -263,19 +263,31 @@ Strophe.addConnectionPlugin('emuc', { // FIXME: is muc#roomconfig_passwordprotectedroom required? this.connection.sendIQ(formsubmit, function (res) { - console.log('set room password'); + // password is required + if (sharedKey) + { + console.log('set room password'); + Toolbar.lockLockButton(); + } + else + { + console.log('removed room password'); + Toolbar.unlockLockButton(); + } }, function (err) { console.warn('setting password failed', err); messageHandler.showError('Lock failed', 'Failed to lock conference.', err); + setSharedKey(''); } ); } else { console.warn('room passwords not supported'); messageHandler.showError('Warning', 'Room passwords are currently not supported.'); + setSharedKey(''); } }, @@ -284,6 +296,7 @@ Strophe.addConnectionPlugin('emuc', { messageHandler.showError('Lock failed', 'Failed to lock conference.', err); + setSharedKey(''); } ); }, diff --git a/toolbar.js b/toolbar.js index 077dd26db6..7fcdfee0dc 100644 --- a/toolbar.js +++ b/toolbar.js @@ -204,10 +204,11 @@ var Toolbar = (function (my) { } }; /** - * Updates the lock button state. + * Unlocks the lock button state. */ - my.updateLockButton = function() { - buttonClick("#lockIcon", "icon-security icon-security-locked"); + my.unlockLockButton = function() { + if($("#lockIcon").hasClass("icon-security-locked")) + buttonClick("#lockIcon", "icon-security icon-security-locked"); }; /** * Updates the lock button state to locked.