From b2483f5cf258901149dd5db67c6355c9db8c0997 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Tue, 19 May 2020 07:57:44 -0400 Subject: [PATCH] fix #1030 --- conventional.yaml | 12 ++++++------ irc/channel.go | 2 +- irc/client.go | 4 ++-- irc/config.go | 12 ++++++------ oragono.yaml | 17 +++++++++++------ 5 files changed, 26 insertions(+), 21 deletions(-) diff --git a/conventional.yaml b/conventional.yaml index 777d9275..a5c95b28 100644 --- a/conventional.yaml +++ b/conventional.yaml @@ -766,13 +766,13 @@ roleplay: history: # should we store messages for later playback? # by default, messages are stored in RAM only; they do not persist - # across server restarts. however, you should not enable this unless you understand - # how it interacts with the GDPR and/or any data privacy laws that apply + # across server restarts. however, you may want to understand how message + # history interacts with the GDPR and/or any data privacy laws that apply # in your country and the countries of your users. - enabled: false + enabled: true # how many channel-specific events (messages, joins, parts) should be tracked per channel? - channel-length: 1024 + channel-length: 2048 # how many direct messages and notices should be tracked per user? client-length: 256 @@ -783,7 +783,7 @@ history: # are dynamically expanded up to the maximum length. if the buffer is full # and the oldest message is older than `autoresize-window`, then it will overwrite # the oldest message rather than resize; otherwise, it will expand if possible. - autoresize-window: 1h + autoresize-window: 3d # number of messages to automatically play back on channel join (0 to disable): autoreplay-on-join: 0 @@ -800,7 +800,7 @@ history: restrictions: # if this is set, messages older than this cannot be retrieved by anyone # (and will eventually be deleted from persistent storage, if that's enabled) - #expire-time: 1w + expire-time: 1w # if this is set, logged-in users cannot retrieve messages older than their # account registration date, and logged-out users cannot retrieve messages diff --git a/irc/channel.go b/irc/channel.go index d57fce15..6b0e2117 100644 --- a/irc/channel.go +++ b/irc/channel.go @@ -111,7 +111,7 @@ func (channel *Channel) IsLoaded() bool { func (channel *Channel) resizeHistory(config *Config) { status, _ := channel.historyStatus(config) if status == HistoryEphemeral { - channel.history.Resize(config.History.ChannelLength, config.History.AutoresizeWindow) + channel.history.Resize(config.History.ChannelLength, time.Duration(config.History.AutoresizeWindow)) } else { channel.history.Resize(0, 0) } diff --git a/irc/client.go b/irc/client.go index e013063d..e455f512 100644 --- a/irc/client.go +++ b/irc/client.go @@ -318,7 +318,7 @@ func (server *Server) RunClient(conn IRCConn) { proxiedIP: proxiedIP, } client.writerSemaphore.Initialize(1) - client.history.Initialize(config.History.ClientLength, config.History.AutoresizeWindow) + client.history.Initialize(config.History.ClientLength, time.Duration(config.History.AutoresizeWindow)) client.brbTimer.Initialize(client) session := &Session{ client: client, @@ -414,7 +414,7 @@ func (server *Server) AddAlwaysOnClient(account ClientAccount, chnames []string, func (client *Client) resizeHistory(config *Config) { status, _ := client.historyStatus(config) if status == HistoryEphemeral { - client.history.Resize(config.History.ClientLength, config.History.AutoresizeWindow) + client.history.Resize(config.History.ClientLength, time.Duration(config.History.AutoresizeWindow)) } else { client.history.Resize(0, 0) } diff --git a/irc/config.go b/irc/config.go index 81512b7b..91156172 100644 --- a/irc/config.go +++ b/irc/config.go @@ -576,12 +576,12 @@ type Config struct { History struct { Enabled bool - ChannelLength int `yaml:"channel-length"` - ClientLength int `yaml:"client-length"` - AutoresizeWindow time.Duration `yaml:"autoresize-window"` - AutoreplayOnJoin int `yaml:"autoreplay-on-join"` - ChathistoryMax int `yaml:"chathistory-maxmessages"` - ZNCMax int `yaml:"znc-maxmessages"` + ChannelLength int `yaml:"channel-length"` + ClientLength int `yaml:"client-length"` + AutoresizeWindow custime.Duration `yaml:"autoresize-window"` + AutoreplayOnJoin int `yaml:"autoreplay-on-join"` + ChathistoryMax int `yaml:"chathistory-maxmessages"` + ZNCMax int `yaml:"znc-maxmessages"` Restrictions struct { ExpireTime custime.Duration `yaml:"expire-time"` EnforceRegistrationDate bool `yaml:"enforce-registration-date"` diff --git a/oragono.yaml b/oragono.yaml index 5b454f2e..c2c02716 100644 --- a/oragono.yaml +++ b/oragono.yaml @@ -16,6 +16,11 @@ # you should enable them in server.listeners in place of the default # self-signed certificates # 3. the operator password in the 'opers' section +# 4. by default, message history is enabled, using in-memory history storage +# and with messages expiring after 7 days. depending on your needs, you may +# want to disable history entirely, remove the expiration time, switch to +# persistent history stored in MySQL, or do something else entirely. See +# the 'history' section of the config. # network configuration network: @@ -787,13 +792,13 @@ roleplay: history: # should we store messages for later playback? # by default, messages are stored in RAM only; they do not persist - # across server restarts. however, you should not enable this unless you understand - # how it interacts with the GDPR and/or any data privacy laws that apply + # across server restarts. however, you may want to understand how message + # history interacts with the GDPR and/or any data privacy laws that apply # in your country and the countries of your users. - enabled: false + enabled: true # how many channel-specific events (messages, joins, parts) should be tracked per channel? - channel-length: 1024 + channel-length: 2048 # how many direct messages and notices should be tracked per user? client-length: 256 @@ -804,7 +809,7 @@ history: # are dynamically expanded up to the maximum length. if the buffer is full # and the oldest message is older than `autoresize-window`, then it will overwrite # the oldest message rather than resize; otherwise, it will expand if possible. - autoresize-window: 1h + autoresize-window: 3d # number of messages to automatically play back on channel join (0 to disable): autoreplay-on-join: 0 @@ -821,7 +826,7 @@ history: restrictions: # if this is set, messages older than this cannot be retrieved by anyone # (and will eventually be deleted from persistent storage, if that's enabled) - #expire-time: 1w + expire-time: 1w # if this is set, logged-in users cannot retrieve messages older than their # account registration date, and logged-out users cannot retrieve messages