|
@@ -49,7 +49,7 @@ func zncWireTimeToTime(str string) (result time.Time) {
|
49
|
49
|
type zncPlaybackTimes struct {
|
50
|
50
|
after time.Time
|
51
|
51
|
before time.Time
|
52
|
|
- targets map[string]bool // nil for "*" (everything), otherwise the channel names
|
|
52
|
+ targets StringSet // nil for "*" (everything), otherwise the channel names
|
53
|
53
|
}
|
54
|
54
|
|
55
|
55
|
// https://wiki.znc.in/Playback
|
|
@@ -71,12 +71,13 @@ func zncPlaybackHandler(client *Client, command string, params []string, rb *Res
|
71
|
71
|
before = zncWireTimeToTime(params[3])
|
72
|
72
|
}
|
73
|
73
|
|
74
|
|
- var targets map[string]bool
|
|
74
|
+ var targets StringSet
|
75
|
75
|
|
76
|
76
|
// three cases:
|
77
|
77
|
// 1. the user's PMs get played back immediately upon receiving this
|
78
|
78
|
// 2. if this is a new connection (from the server's POV), save the information
|
79
|
|
- // and use it to process subsequent joins
|
|
79
|
+ // and use it to process subsequent joins. (This is the Textual behavior:
|
|
80
|
+ // first send the playback PRIVMSG, then send the JOIN lines.)
|
80
|
81
|
// 3. if this is a reattach (from the server's POV), immediately play back
|
81
|
82
|
// history for channels that the client is already joined to. In this scenario,
|
82
|
83
|
// there are three total attempts to play the history:
|
|
@@ -96,9 +97,9 @@ func zncPlaybackHandler(client *Client, command string, params []string, rb *Res
|
96
|
97
|
for _, targetName := range strings.Split(targetString, ",") {
|
97
|
98
|
if cfTarget, err := CasefoldChannel(targetName); err == nil {
|
98
|
99
|
if targets == nil {
|
99
|
|
- targets = make(map[string]bool)
|
|
100
|
+ targets = make(StringSet)
|
100
|
101
|
}
|
101
|
|
- targets[cfTarget] = true
|
|
102
|
+ targets.Add(cfTarget)
|
102
|
103
|
}
|
103
|
104
|
}
|
104
|
105
|
}
|
|
@@ -110,7 +111,9 @@ func zncPlaybackHandler(client *Client, command string, params []string, rb *Res
|
110
|
111
|
}
|
111
|
112
|
|
112
|
113
|
for _, channel := range client.Channels() {
|
113
|
|
- channel.autoReplayHistory(client, rb, "")
|
114
|
|
- rb.Flush(true)
|
|
114
|
+ if targets == nil || targets.Has(channel.NameCasefolded()) {
|
|
115
|
+ channel.autoReplayHistory(client, rb, "")
|
|
116
|
+ rb.Flush(true)
|
|
117
|
+ }
|
115
|
118
|
}
|
116
|
119
|
}
|