3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-11 06:29:29 +01:00

make roleplay.enabled default to false when unset

See #1240.
This commit is contained in:
Shivaram Lingamneni 2020-09-16 11:32:52 -04:00
parent 3ed047ccb8
commit 6a0d11d449
2 changed files with 3 additions and 5 deletions

View File

@ -537,8 +537,7 @@ type Config struct {
} }
Roleplay struct { Roleplay struct {
Enabled *bool Enabled bool
enabled bool
RequireChanops bool `yaml:"require-chanops"` RequireChanops bool `yaml:"require-chanops"`
RequireOper bool `yaml:"require-oper"` RequireOper bool `yaml:"require-oper"`
AddSuffix *bool `yaml:"add-suffix"` AddSuffix *bool `yaml:"add-suffix"`
@ -1192,7 +1191,6 @@ func LoadConfig(filename string) (config *Config, err error) {
config.History.ZNCMax = config.History.ChathistoryMax config.History.ZNCMax = config.History.ChathistoryMax
} }
config.Roleplay.enabled = utils.BoolDefaultTrue(config.Roleplay.Enabled)
config.Roleplay.addSuffix = utils.BoolDefaultTrue(config.Roleplay.AddSuffix) config.Roleplay.addSuffix = utils.BoolDefaultTrue(config.Roleplay.AddSuffix)
config.Datastore.MySQL.ExpireTime = time.Duration(config.History.Restrictions.ExpireTime) config.Datastore.MySQL.ExpireTime = time.Duration(config.History.Restrictions.ExpireTime)
@ -1272,7 +1270,7 @@ func (config *Config) generateISupport() (err error) {
isupport.Add("NETWORK", config.Network.Name) isupport.Add("NETWORK", config.Network.Name)
isupport.Add("NICKLEN", strconv.Itoa(config.Limits.NickLen)) isupport.Add("NICKLEN", strconv.Itoa(config.Limits.NickLen))
isupport.Add("PREFIX", "(qaohv)~&@%+") isupport.Add("PREFIX", "(qaohv)~&@%+")
if config.Roleplay.enabled { if config.Roleplay.Enabled {
isupport.Add("RPCHAN", "E") isupport.Add("RPCHAN", "E")
isupport.Add("RPUSER", "E") isupport.Add("RPUSER", "E")
} }

View File

@ -18,7 +18,7 @@ const (
func sendRoleplayMessage(server *Server, client *Client, source string, targetString string, isAction bool, messageParts []string, rb *ResponseBuffer) { func sendRoleplayMessage(server *Server, client *Client, source string, targetString string, isAction bool, messageParts []string, rb *ResponseBuffer) {
config := server.Config() config := server.Config()
if !config.Roleplay.enabled { if !config.Roleplay.Enabled {
rb.Add(nil, client.server.name, ERR_CANNOTSENDRP, targetString, client.t("Roleplaying has been disabled by the server administrators")) rb.Add(nil, client.server.name, ERR_CANNOTSENDRP, targetString, client.t("Roleplaying has been disabled by the server administrators"))
return return
} }