3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 18:52:41 +01:00

simplify some logic

This commit is contained in:
Shivaram Lingamneni 2020-07-20 13:45:52 -04:00
parent e827bc0f9c
commit 562b85c1c0

View File

@ -139,15 +139,15 @@ func zncPlaybackPlayHandler(client *Client, command string, params []string, rb
// 3.3 When the client sends a subsequent redundant JOIN line for those // 3.3 When the client sends a subsequent redundant JOIN line for those
// channels; redundant JOIN is a complete no-op so we won't replay twice // channels; redundant JOIN is a complete no-op so we won't replay twice
playPrivmsgs := false
if params[1] == "*" { if params[1] == "*" {
zncPlayPrivmsgs(client, rb, "*", start, end) playPrivmsgs = true // XXX nil `targets` means "every channel"
} else if params[1] == "*self" {
zncPlayPrivmsgs(client, rb, "*", start, end)
targets = make(StringSet) // XXX non-nil but empty channel set means "no channels"
} else { } else {
targets = make(StringSet) targets = make(StringSet)
for _, targetName := range strings.Split(targetString, ",") { for _, targetName := range strings.Split(targetString, ",") {
if strings.HasPrefix(targetName, "#") { if targetName == "*self" {
playPrivmsgs = true
} else if strings.HasPrefix(targetName, "#") {
if cfTarget, err := CasefoldChannel(targetName); err == nil { if cfTarget, err := CasefoldChannel(targetName); err == nil {
targets.Add(cfTarget) targets.Add(cfTarget)
} }
@ -159,6 +159,10 @@ func zncPlaybackPlayHandler(client *Client, command string, params []string, rb
} }
} }
if playPrivmsgs {
zncPlayPrivmsgs(client, rb, "*", start, end)
}
rb.session.zncPlaybackTimes = &zncPlaybackTimes{ rb.session.zncPlaybackTimes = &zncPlaybackTimes{
start: start, start: start,
end: end, end: end,