mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-25 13:29:27 +01:00
Merge pull request #1667 from slingamn/playback.2
fix znc.in/playback for individual DM targets
This commit is contained in:
commit
c24254fe45
@ -747,7 +747,7 @@ func (client *Client) playReattachMessages(session *Session) {
|
||||
}
|
||||
if !session.autoreplayMissedSince.IsZero() && !hasHistoryCaps {
|
||||
rb := NewResponseBuffer(session)
|
||||
zncPlayPrivmsgs(client, rb, "", time.Now().UTC(), session.autoreplayMissedSince)
|
||||
zncPlayPrivmsgsFromAll(client, rb, time.Now().UTC(), session.autoreplayMissedSince)
|
||||
rb.Send(true)
|
||||
}
|
||||
session.autoreplayMissedSince = time.Time{}
|
||||
|
18
irc/znc.go
18
irc/znc.go
@ -165,7 +165,7 @@ func zncPlaybackPlayHandler(client *Client, command string, params []string, rb
|
||||
}
|
||||
|
||||
if playPrivmsgs {
|
||||
zncPlayPrivmsgs(client, rb, "", start, end)
|
||||
zncPlayPrivmsgsFromAll(client, rb, start, end)
|
||||
}
|
||||
|
||||
rb.session.zncPlaybackTimes = &zncPlaybackTimes{
|
||||
@ -183,16 +183,24 @@ func zncPlaybackPlayHandler(client *Client, command string, params []string, rb
|
||||
}
|
||||
|
||||
for _, cfNick := range nickTargets {
|
||||
zncPlayPrivmsgs(client, rb, cfNick, start, end)
|
||||
zncPlayPrivmsgsFrom(client, rb, cfNick, start, end)
|
||||
rb.Flush(true)
|
||||
}
|
||||
}
|
||||
|
||||
func zncPlayPrivmsgs(client *Client, rb *ResponseBuffer, target string, start, end time.Time) {
|
||||
_, sequence, _ := client.server.GetHistorySequence(nil, client, target)
|
||||
if sequence == nil {
|
||||
func zncPlayPrivmsgsFrom(client *Client, rb *ResponseBuffer, target string, start, end time.Time) {
|
||||
_, sequence, err := client.server.GetHistorySequence(nil, client, target)
|
||||
if sequence == nil || err != nil {
|
||||
return
|
||||
}
|
||||
zncMax := client.server.Config().History.ZNCMax
|
||||
items, err := sequence.Between(history.Selector{Time: start}, history.Selector{Time: end}, zncMax)
|
||||
if err == nil && len(items) != 0 {
|
||||
client.replayPrivmsgHistory(rb, items, target)
|
||||
}
|
||||
}
|
||||
|
||||
func zncPlayPrivmsgsFromAll(client *Client, rb *ResponseBuffer, start, end time.Time) {
|
||||
zncMax := client.server.Config().History.ZNCMax
|
||||
items, err := client.privmsgsBetween(start, end, maxDMTargetsForAutoplay, zncMax)
|
||||
if err == nil && len(items) != 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user