diff --git a/client/components/Windows/Settings.vue b/client/components/Windows/Settings.vue index e4ec148a..163b0103 100644 --- a/client/components/Windows/Settings.vue +++ b/client/components/Windows/Settings.vue @@ -109,6 +109,21 @@ Show seconds in timestamp +
+

Automatic away message

+ + +

Status messages diff --git a/client/js/settings.js b/client/js/settings.js index 94d03b9c..1bd96867 100644 --- a/client/js/settings.js +++ b/client/js/settings.js @@ -44,6 +44,10 @@ export const config = normalizeConfig({ default: "", sync: "always", }, + awayMessage: { + default: "", + sync: "always", + }, links: { default: true, }, diff --git a/src/client.js b/src/client.js index 8d23d2fa..b7e69b10 100644 --- a/src/client.js +++ b/src/client.js @@ -45,7 +45,7 @@ const events = [ function Client(manager, name, config = {}) { _.merge(this, { - awayMessage: config.awayMessage || "", + awayMessage: "", lastActiveChannel: -1, attachedClients: {}, config: config, @@ -94,6 +94,16 @@ function Client(manager, name, config = {}) { client.config.browser = {}; } + // TODO: Backwards compatibility with older versions, remove in a future release? + if (client.config.awayMessage) { + client.config.clientSettings.awayMessage = client.config.awayMessage; + delete client.config.awayMessage; + } + + if (client.config.clientSettings.awayMessage) { + client.awayMessage = client.config.clientSettings.awayMessage; + } + client.compileCustomHighlights(); _.forOwn(client.config.sessions, (session) => { diff --git a/src/clientManager.js b/src/clientManager.js index b8502fbf..4e617519 100644 --- a/src/clientManager.js +++ b/src/clientManager.js @@ -134,7 +134,6 @@ ClientManager.prototype.addUser = function(name, password, enableLog) { const user = { password: password || "", log: enableLog, - awayMessage: "", networks: [], sessions: {}, clientSettings: {}, diff --git a/src/server.js b/src/server.js index a47b9f5a..51579a16 100644 --- a/src/server.js +++ b/src/server.js @@ -593,6 +593,12 @@ function initializeClient(socket, client, token, lastMessage, openChannel) { if (newSetting.name === "highlights") { client.compileCustomHighlights(); + } else if (newSetting.name === "awayMessage") { + if (typeof newSetting.value !== "string") { + newSetting.value = ""; + } + + client.awayMessage = newSetting.value; } } });