1
0
Fork 0
forked from External/ergo

fixes and refactoring

This commit is contained in:
Shivaram Lingamneni 2020-09-09 04:01:46 -04:00
parent 3962ff8643
commit af056f26a9
7 changed files with 47 additions and 42 deletions

View file

@ -502,7 +502,7 @@ type Config struct {
MOTD string
motdLines []string
MOTDFormatting bool `yaml:"motd-formatting"`
Relaying struct {
Relaymsg struct {
Enabled bool
Separators string
AvailableToChanops bool `yaml:"available-to-chanops"`
@ -1111,13 +1111,13 @@ func LoadConfig(filename string) (config *Config, err error) {
}
config.Server.capValues[caps.Languages] = config.languageManager.CapValue()
if config.Server.Relaying.Enabled {
if config.Server.Relaymsg.Enabled {
for _, char := range protocolBreakingNameCharacters {
if strings.ContainsRune(config.Server.Relaying.Separators, char) {
return nil, fmt.Errorf("Relaying separators cannot include the characters %s", protocolBreakingNameCharacters)
if strings.ContainsRune(config.Server.Relaymsg.Separators, char) {
return nil, fmt.Errorf("RELAYMSG separators cannot include the characters %s", protocolBreakingNameCharacters)
}
}
config.Server.capValues[caps.Relaymsg] = config.Server.Relaying.Separators
config.Server.capValues[caps.Relaymsg] = config.Server.Relaymsg.Separators
} else {
config.Server.supportedCaps.Disable(caps.Relaymsg)
}
@ -1222,6 +1222,19 @@ func (config *Config) getOutputPath(filename string) string {
return filepath.Join(config.Server.OutputPath, filename)
}
func (config *Config) isRelaymsgIdentifier(nick string) bool {
if !config.Server.Relaymsg.Enabled {
return false
}
for _, char := range config.Server.Relaymsg.Separators {
if strings.ContainsRune(nick, char) {
return true
}
}
return false
}
// setISupport sets up our RPL_ISUPPORT reply.
func (config *Config) generateISupport() (err error) {
maxTargetsString := strconv.Itoa(maxTargets)