Commit 056f9860 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Simplify checking for privileged user messages.

parent fae045fb
......@@ -2531,27 +2531,28 @@ function gotUserMessage(id, dest, username, time, privileged, kind, message) {
case 'error':
case 'warning':
case 'info':
if(!privileged) {
console.error(`Got unprivileged message of kind ${kind}`);
return;
}
let from = id ? (username || 'Anonymous') : 'The Server';
if(privileged)
displayError(`${from} said: ${message}`, kind);
else
console.error(`Got unprivileged message of kind ${kind}`);
break;
case 'mute':
if(privileged) {
if(!privileged) {
console.error(`Got unprivileged message of kind ${kind}`);
return;
}
setLocalMute(true, true);
let by = username ? ' by ' + username : '';
displayWarning(`You have been muted${by}`);
} else {
console.error(`Got unprivileged message of kind ${kind}`);
}
break;
case 'clearchat':
if(privileged) {
clearChat();
} else {
if(!privileged) {
console.error(`Got unprivileged message of kind ${kind}`);
return;
}
clearChat();
break;
default:
console.warn(`Got unknown user message ${kind}`);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment