mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-22 18:52:41 +01:00
fix Client.historyStatus
This commit is contained in:
parent
8f4c14c783
commit
17a89838b8
@ -353,7 +353,7 @@ func (server *Server) AddAlwaysOnClient(account ClientAccount, chnames []string)
|
||||
}
|
||||
|
||||
func (client *Client) resizeHistory(config *Config) {
|
||||
_, ephemeral := client.historyStatus(config)
|
||||
_, ephemeral, _ := client.historyStatus(config)
|
||||
if ephemeral {
|
||||
client.history.Resize(config.History.ClientLength, config.History.AutoresizeWindow)
|
||||
} else {
|
||||
@ -756,7 +756,7 @@ func (session *Session) playResume() {
|
||||
}
|
||||
}
|
||||
}
|
||||
_, cEphemeral := client.historyStatus(config)
|
||||
_, cEphemeral, _ := client.historyStatus(config)
|
||||
if cEphemeral {
|
||||
lastDiscarded := client.history.LastDiscarded()
|
||||
if oldestLostMessage.Before(lastDiscarded) {
|
||||
@ -1543,20 +1543,23 @@ func (client *Client) attemptAutoOper(session *Session) {
|
||||
}
|
||||
}
|
||||
|
||||
func (client *Client) historyStatus(config *Config) (persistent, ephemeral bool) {
|
||||
func (client *Client) historyStatus(config *Config) (persistent, ephemeral bool, target string) {
|
||||
if !config.History.Enabled {
|
||||
return false, false
|
||||
return
|
||||
} else if !config.History.Persistent.Enabled {
|
||||
return false, true
|
||||
ephemeral = true
|
||||
return
|
||||
}
|
||||
|
||||
client.stateMutex.RLock()
|
||||
alwaysOn := client.alwaysOn
|
||||
historyStatus := client.accountSettings.DMHistory
|
||||
target = client.nickCasefolded
|
||||
client.stateMutex.RUnlock()
|
||||
|
||||
if !alwaysOn {
|
||||
return false, true
|
||||
ephemeral = true
|
||||
return
|
||||
}
|
||||
|
||||
historyStatus = historyEnabled(config.History.Persistent.DirectMessages, historyStatus)
|
||||
|
@ -1975,8 +1975,8 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
|
||||
}
|
||||
targetedItem := item
|
||||
targetedItem.Params[0] = tnick
|
||||
cPersistent, cEphemeral := client.historyStatus(config)
|
||||
tPersistent, tEphemeral := user.historyStatus(config)
|
||||
cPersistent, cEphemeral, _ := client.historyStatus(config)
|
||||
tPersistent, tEphemeral, _ := user.historyStatus(config)
|
||||
// add to ephemeral history
|
||||
if cEphemeral {
|
||||
targetedItem.CfCorrespondent = tDetails.nickCasefolded
|
||||
|
@ -867,10 +867,13 @@ func (server *Server) GetHistorySequence(providedChannel *Channel, client *Clien
|
||||
var sender, recipient string
|
||||
var hist *history.Buffer
|
||||
if target == "*" {
|
||||
if client.AlwaysOn() {
|
||||
recipient = client.NickCasefolded()
|
||||
} else {
|
||||
persistent, ephemeral, target := client.historyStatus(config)
|
||||
if persistent {
|
||||
recipient = target
|
||||
} else if ephemeral {
|
||||
hist = &client.history
|
||||
} else {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
channel = providedChannel
|
||||
|
Loading…
Reference in New Issue
Block a user