3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-26 05:49:25 +01:00

Merge pull request #1032 from slingamn/history_enable

fix #1030
This commit is contained in:
Shivaram Lingamneni 2020-05-20 04:33:35 -07:00 committed by GitHub
commit 5345fc35dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 21 deletions

View File

@ -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

View File

@ -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)
}

View File

@ -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)
}

View File

@ -578,7 +578,7 @@ type Config struct {
Enabled bool
ChannelLength int `yaml:"channel-length"`
ClientLength int `yaml:"client-length"`
AutoresizeWindow time.Duration `yaml:"autoresize-window"`
AutoresizeWindow custime.Duration `yaml:"autoresize-window"`
AutoreplayOnJoin int `yaml:"autoreplay-on-join"`
ChathistoryMax int `yaml:"chathistory-maxmessages"`
ZNCMax int `yaml:"znc-maxmessages"`

View File

@ -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