3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-29 07:29:31 +01:00

fix 2-parameter case for *playback

This commit is contained in:
Shivaram Lingamneni 2020-07-21 16:33:17 -04:00
parent e6e55bbf29
commit af009a5bc1
2 changed files with 6 additions and 1 deletions

View File

@ -813,16 +813,19 @@ func (channel *Channel) autoReplayHistory(client *Client, rb *ResponseBuffer, sk
// autoreplay any messages as necessary // autoreplay any messages as necessary
var items []history.Item var items []history.Item
hasAutoreplayTimestamps := false
var start, end time.Time var start, end time.Time
if rb.session.zncPlaybackTimes.ValidFor(channel.NameCasefolded()) { if rb.session.zncPlaybackTimes.ValidFor(channel.NameCasefolded()) {
hasAutoreplayTimestamps = true
start, end = rb.session.zncPlaybackTimes.start, rb.session.zncPlaybackTimes.end start, end = rb.session.zncPlaybackTimes.start, rb.session.zncPlaybackTimes.end
} else if !rb.session.autoreplayMissedSince.IsZero() { } else if !rb.session.autoreplayMissedSince.IsZero() {
// we already checked for history caps in `playReattachMessages` // we already checked for history caps in `playReattachMessages`
hasAutoreplayTimestamps = true
start = time.Now().UTC() start = time.Now().UTC()
end = rb.session.autoreplayMissedSince end = rb.session.autoreplayMissedSince
} }
if !start.IsZero() || !end.IsZero() { if hasAutoreplayTimestamps {
_, seq, _ := channel.server.GetHistorySequence(channel, client, "") _, seq, _ := channel.server.GetHistorySequence(channel, client, "")
if seq != nil { if seq != nil {
zncMax := channel.server.Config().History.ZNCMax zncMax := channel.server.Config().History.ZNCMax

View File

@ -108,6 +108,8 @@ func zncPlaybackPlayHandler(client *Client, command string, params []string, rb
now := time.Now().UTC() now := time.Now().UTC()
var start, end time.Time var start, end time.Time
switch len(params) { switch len(params) {
case 2:
// #1205: this should have the same semantics as `LATEST *`
case 3: case 3:
// #831: this should have the same semantics as `LATEST timestamp=qux`, // #831: this should have the same semantics as `LATEST timestamp=qux`,
// or equivalently `BETWEEN timestamp=$now timestamp=qux`, as opposed to // or equivalently `BETWEEN timestamp=$now timestamp=qux`, as opposed to