mirror of
https://github.com/thelounge/thelounge
synced 2024-11-30 07:50:34 +00:00
32 lines
738 B
JavaScript
32 lines
738 B
JavaScript
"use strict";
|
|
|
|
const socket = require("../socket");
|
|
const options = require("../options");
|
|
|
|
function evaluateSetting(name, value) {
|
|
if (
|
|
options.settings.syncSettings &&
|
|
options.settings[name] !== value &&
|
|
!options.noSync.includes(name)
|
|
) {
|
|
options.processSetting(name, value, true);
|
|
} else if (options.alwaysSync.includes(name)) {
|
|
options.processSetting(name, value, true);
|
|
}
|
|
}
|
|
|
|
socket.on("setting:new", function(data) {
|
|
const name = data.name;
|
|
const value = data.value;
|
|
evaluateSetting(name, value);
|
|
});
|
|
|
|
socket.on("setting:all", function(settings) {
|
|
if (Object.keys(settings).length === 0) {
|
|
options.syncAllSettings();
|
|
} else {
|
|
for (const name in settings) {
|
|
evaluateSetting(name, settings[name]);
|
|
}
|
|
}
|
|
});
|