mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
fixes and refactoring
This commit is contained in:
parent
3962ff8643
commit
af056f26a9
7 changed files with 47 additions and 42 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue