From 5c4984f45f63d3e769b3ed09cbb7c36d8e93e4de Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Thu, 11 Mar 2021 00:43:07 -0500 Subject: [PATCH] fix #1544 PerstentStatusMandatory should display as "enabled", not "mandatory", in the context where it refers to a user-chosen setting. --- irc/nickserv.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/irc/nickserv.go b/irc/nickserv.go index 9a7d6897..50d497a3 100644 --- a/irc/nickserv.go +++ b/irc/nickserv.go @@ -425,7 +425,7 @@ func displaySetting(service *ircService, settingName string, settings AccountSet case "always-on": stored := settings.AlwaysOn actual := persistenceEnabled(config.Accounts.Multiclient.AlwaysOn, stored) - service.Notice(rb, fmt.Sprintf(client.t("Your stored always-on setting is: %s"), persistentStatusToString(stored))) + service.Notice(rb, fmt.Sprintf(client.t("Your stored always-on setting is: %s"), userPersistentStatusToString(stored))) if actual { service.Notice(rb, client.t("Given current server settings, your client is always-on")) } else { @@ -447,7 +447,7 @@ func displaySetting(service *ircService, settingName string, settings AccountSet stored := settings.AutoAway alwaysOn := persistenceEnabled(config.Accounts.Multiclient.AlwaysOn, settings.AlwaysOn) actual := persistenceEnabled(config.Accounts.Multiclient.AutoAway, settings.AutoAway) - service.Notice(rb, fmt.Sprintf(client.t("Your stored auto-away setting is: %s"), persistentStatusToString(stored))) + service.Notice(rb, fmt.Sprintf(client.t("Your stored auto-away setting is: %s"), userPersistentStatusToString(stored))) if actual && alwaysOn { service.Notice(rb, client.t("Given current server settings, auto-away is enabled for your client")) } else if actual && !alwaysOn { @@ -465,6 +465,15 @@ func displaySetting(service *ircService, settingName string, settings AccountSet } } +func userPersistentStatusToString(status PersistentStatus) string { + // #1544: "mandatory" as a user setting should display as "enabled" + result := persistentStatusToString(status) + if result == "mandatory" { + result = "enabled" + } + return result +} + func nsSetHandler(service *ircService, server *Server, client *Client, command string, params []string, rb *ResponseBuffer) { var account string if command == "saset" {