mirror of
https://github.com/jeremyd/ergo.git
synced 2026-05-03 02:49:59 -07:00
Allow formatting codes in the MOTD
This commit is contained in:
@@ -180,6 +180,7 @@ type Config struct {
|
||||
STS STSConfig
|
||||
CheckIdent bool `yaml:"check-ident"`
|
||||
MOTD string
|
||||
MOTDFormatting bool `yaml:"motd-formatting"`
|
||||
ProxyAllowedFrom []string `yaml:"proxy-allowed-from"`
|
||||
MaxSendQString string `yaml:"max-sendq"`
|
||||
MaxSendQBytes uint64
|
||||
|
||||
@@ -1423,7 +1423,7 @@ func (server *Server) applyConfig(config *Config, initial bool) error {
|
||||
newISupportReplies = oldISupportList.GetDifference(server.isupport)
|
||||
}
|
||||
|
||||
server.loadMOTD(config.Server.MOTD)
|
||||
server.loadMOTD(config.Server.MOTD, config.Server.MOTDFormatting)
|
||||
|
||||
// reload logging config
|
||||
err = server.logger.ApplyConfig(config.Logging)
|
||||
@@ -1462,7 +1462,7 @@ func (server *Server) applyConfig(config *Config, initial bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (server *Server) loadMOTD(motdPath string) error {
|
||||
func (server *Server) loadMOTD(motdPath string, useFormatting bool) error {
|
||||
server.logger.Debug("rehash", "Loading MOTD")
|
||||
motdLines := make([]string, 0)
|
||||
if motdPath != "" {
|
||||
@@ -1477,6 +1477,11 @@ func (server *Server) loadMOTD(motdPath string) error {
|
||||
break
|
||||
}
|
||||
line = strings.TrimRight(line, "\r\n")
|
||||
|
||||
if useFormatting {
|
||||
line = ircfmt.Unescape(line)
|
||||
}
|
||||
|
||||
// "- " is the required prefix for MOTD, we just add it here to make
|
||||
// bursting it out to clients easier
|
||||
line = fmt.Sprintf("- %s", line)
|
||||
|
||||
Reference in New Issue
Block a user