Removes toggle lock icon, just lock or unlock it, depending the status returned by the server.

This commit is contained in:
Damian Minkov 2014-10-30 17:32:03 +02:00
parent f9daa25a6c
commit 5ce2ce8db6
3 changed files with 18 additions and 6 deletions

2
app.js
View File

@ -1413,8 +1413,6 @@ function lockRoom(lock) {
connection.emuc.lockRoom(sharedKey);
else
connection.emuc.lockRoom('');
Toolbar.updateLockButton();
}
/**

15
muc.js
View File

@ -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('');
}
);
},

View File

@ -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.