From 43553390d6dd38efdd1224ae99c30b2ec46ec98f Mon Sep 17 00:00:00 2001 From: Daniel Oaks Date: Sun, 14 Aug 2016 14:07:50 +1000 Subject: [PATCH] WHOWAS: Make maximum number of entries configurable --- CHANGELOG.md | 3 ++- irc/config.go | 5 +++-- irc/server.go | 2 +- irc/whowas.go | 2 +- oragono.yaml | 3 +++ 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91584775..214f451a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,9 +27,10 @@ Initial release of Oragono! * Changed private (`+p`) channel mode to secret (`+s`), to match what's used by servers today. * Changed default channel modes to (`+nt`), matching most other IRCds. * Changed CLI commands and arguments to be more consistent with typical software. -* Changed maximum nickname and channel name lengths to be configurable. * Changed usernames set by the `USER` command to start with `"~"` (to work with new ident support). * Renamed `ONICK` command to `SANICK` to be more consistent with other IRCds. +* Made maximum nickname and channel name lengths configurable. +* Made maximum `WHOWAS` entries configurable. ### Removed * Removed gitconfig configuration format [replaced with YAML]. diff --git a/irc/config.go b/irc/config.go index 4524c726..7eb01379 100644 --- a/irc/config.go +++ b/irc/config.go @@ -68,8 +68,9 @@ type Config struct { Theater map[string]*PassConfig Limits struct { - NickLen int `yaml:"nicklen"` - ChannelLen int `yaml:"channellen"` + NickLen int `yaml:"nicklen"` + ChannelLen int `yaml:"channellen"` + WhowasEntries uint `yaml:"whowas-entries"` } } diff --git a/irc/server.go b/irc/server.go index e9c6b7aa..096e46ec 100644 --- a/irc/server.go +++ b/irc/server.go @@ -69,7 +69,7 @@ func NewServer(config *Config) *Server { operators: config.Operators(), signals: make(chan os.Signal, len(SERVER_SIGNALS)), proxyAllowedFrom: config.Server.ProxyAllowedFrom, - whoWas: NewWhoWasList(100), + whoWas: NewWhoWasList(config.Limits.WhowasEntries), theaters: config.Theaters(), checkIdent: config.Server.CheckIdent, } diff --git a/irc/whowas.go b/irc/whowas.go index 9724a007..08077877 100644 --- a/irc/whowas.go +++ b/irc/whowas.go @@ -18,7 +18,7 @@ type WhoWas struct { func NewWhoWasList(size uint) *WhoWasList { return &WhoWasList{ - buffer: make([]*WhoWas, size), + buffer: make([]*WhoWas, size+1), } } diff --git a/oragono.yaml b/oragono.yaml index 54808407..f8502d3a 100644 --- a/oragono.yaml +++ b/oragono.yaml @@ -64,3 +64,6 @@ limits: # channellen is the max channel length allowed channellen: 64 + + # whowas entries to store + whowas-entries: 100