mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-22 10:42:52 +01:00
fix #760
This commit is contained in:
parent
b329cf430e
commit
fd46874ad3
@ -704,7 +704,7 @@ func (channel *Channel) autoReplayHistory(client *Client, rb *ResponseBuffer, sk
|
|||||||
// autoreplay any messages as necessary
|
// autoreplay any messages as necessary
|
||||||
config := channel.server.Config()
|
config := channel.server.Config()
|
||||||
var items []history.Item
|
var items []history.Item
|
||||||
if rb.session.zncPlaybackTimes != nil && (rb.session.zncPlaybackTimes.targets == nil || rb.session.zncPlaybackTimes.targets[channel.NameCasefolded()]) {
|
if rb.session.zncPlaybackTimes != nil && (rb.session.zncPlaybackTimes.targets == nil || rb.session.zncPlaybackTimes.targets.Has(channel.NameCasefolded())) {
|
||||||
items, _ = channel.history.Between(rb.session.zncPlaybackTimes.after, rb.session.zncPlaybackTimes.before, false, config.History.ChathistoryMax)
|
items, _ = channel.history.Between(rb.session.zncPlaybackTimes.after, rb.session.zncPlaybackTimes.before, false, config.History.ChathistoryMax)
|
||||||
} else if !rb.session.HasHistoryCaps() {
|
} else if !rb.session.HasHistoryCaps() {
|
||||||
var replayLimit int
|
var replayLimit int
|
||||||
|
17
irc/znc.go
17
irc/znc.go
@ -49,7 +49,7 @@ func zncWireTimeToTime(str string) (result time.Time) {
|
|||||||
type zncPlaybackTimes struct {
|
type zncPlaybackTimes struct {
|
||||||
after time.Time
|
after time.Time
|
||||||
before time.Time
|
before time.Time
|
||||||
targets map[string]bool // nil for "*" (everything), otherwise the channel names
|
targets StringSet // nil for "*" (everything), otherwise the channel names
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://wiki.znc.in/Playback
|
// https://wiki.znc.in/Playback
|
||||||
@ -71,12 +71,13 @@ func zncPlaybackHandler(client *Client, command string, params []string, rb *Res
|
|||||||
before = zncWireTimeToTime(params[3])
|
before = zncWireTimeToTime(params[3])
|
||||||
}
|
}
|
||||||
|
|
||||||
var targets map[string]bool
|
var targets StringSet
|
||||||
|
|
||||||
// three cases:
|
// three cases:
|
||||||
// 1. the user's PMs get played back immediately upon receiving this
|
// 1. the user's PMs get played back immediately upon receiving this
|
||||||
// 2. if this is a new connection (from the server's POV), save the information
|
// 2. if this is a new connection (from the server's POV), save the information
|
||||||
// and use it to process subsequent joins
|
// and use it to process subsequent joins. (This is the Textual behavior:
|
||||||
|
// first send the playback PRIVMSG, then send the JOIN lines.)
|
||||||
// 3. if this is a reattach (from the server's POV), immediately play back
|
// 3. if this is a reattach (from the server's POV), immediately play back
|
||||||
// history for channels that the client is already joined to. In this scenario,
|
// history for channels that the client is already joined to. In this scenario,
|
||||||
// there are three total attempts to play the history:
|
// there are three total attempts to play the history:
|
||||||
@ -96,9 +97,9 @@ func zncPlaybackHandler(client *Client, command string, params []string, rb *Res
|
|||||||
for _, targetName := range strings.Split(targetString, ",") {
|
for _, targetName := range strings.Split(targetString, ",") {
|
||||||
if cfTarget, err := CasefoldChannel(targetName); err == nil {
|
if cfTarget, err := CasefoldChannel(targetName); err == nil {
|
||||||
if targets == nil {
|
if targets == nil {
|
||||||
targets = make(map[string]bool)
|
targets = make(StringSet)
|
||||||
}
|
}
|
||||||
targets[cfTarget] = true
|
targets.Add(cfTarget)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,7 +111,9 @@ func zncPlaybackHandler(client *Client, command string, params []string, rb *Res
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, channel := range client.Channels() {
|
for _, channel := range client.Channels() {
|
||||||
channel.autoReplayHistory(client, rb, "")
|
if targets == nil || targets.Has(channel.NameCasefolded()) {
|
||||||
rb.Flush(true)
|
channel.autoReplayHistory(client, rb, "")
|
||||||
|
rb.Flush(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user