瀏覽代碼

fix znc.in/playback for individual DM targets

This is a regression introduced in 0d05ab4ff4; playback for an individual
DM target would play all DMs.
tags/v2.7.0-rc1
Shivaram Lingamneni 3 年之前
父節點
當前提交
ac806e5c62
共有 2 個文件被更改,包括 14 次插入6 次删除
  1. 1
    1
      irc/client.go
  2. 13
    5
      irc/znc.go

+ 1
- 1
irc/client.go 查看文件

747
 	}
747
 	}
748
 	if !session.autoreplayMissedSince.IsZero() && !hasHistoryCaps {
748
 	if !session.autoreplayMissedSince.IsZero() && !hasHistoryCaps {
749
 		rb := NewResponseBuffer(session)
749
 		rb := NewResponseBuffer(session)
750
-		zncPlayPrivmsgs(client, rb, "", time.Now().UTC(), session.autoreplayMissedSince)
750
+		zncPlayPrivmsgsFromAll(client, rb, time.Now().UTC(), session.autoreplayMissedSince)
751
 		rb.Send(true)
751
 		rb.Send(true)
752
 	}
752
 	}
753
 	session.autoreplayMissedSince = time.Time{}
753
 	session.autoreplayMissedSince = time.Time{}

+ 13
- 5
irc/znc.go 查看文件

165
 	}
165
 	}
166
 
166
 
167
 	if playPrivmsgs {
167
 	if playPrivmsgs {
168
-		zncPlayPrivmsgs(client, rb, "", start, end)
168
+		zncPlayPrivmsgsFromAll(client, rb, start, end)
169
 	}
169
 	}
170
 
170
 
171
 	rb.session.zncPlaybackTimes = &zncPlaybackTimes{
171
 	rb.session.zncPlaybackTimes = &zncPlaybackTimes{
183
 	}
183
 	}
184
 
184
 
185
 	for _, cfNick := range nickTargets {
185
 	for _, cfNick := range nickTargets {
186
-		zncPlayPrivmsgs(client, rb, cfNick, start, end)
186
+		zncPlayPrivmsgsFrom(client, rb, cfNick, start, end)
187
 		rb.Flush(true)
187
 		rb.Flush(true)
188
 	}
188
 	}
189
 }
189
 }
190
 
190
 
191
-func zncPlayPrivmsgs(client *Client, rb *ResponseBuffer, target string, start, end time.Time) {
192
-	_, sequence, _ := client.server.GetHistorySequence(nil, client, target)
193
-	if sequence == nil {
191
+func zncPlayPrivmsgsFrom(client *Client, rb *ResponseBuffer, target string, start, end time.Time) {
192
+	_, sequence, err := client.server.GetHistorySequence(nil, client, target)
193
+	if sequence == nil || err != nil {
194
 		return
194
 		return
195
 	}
195
 	}
196
+	zncMax := client.server.Config().History.ZNCMax
197
+	items, err := sequence.Between(history.Selector{Time: start}, history.Selector{Time: end}, zncMax)
198
+	if err == nil && len(items) != 0 {
199
+		client.replayPrivmsgHistory(rb, items, target)
200
+	}
201
+}
202
+
203
+func zncPlayPrivmsgsFromAll(client *Client, rb *ResponseBuffer, start, end time.Time) {
196
 	zncMax := client.server.Config().History.ZNCMax
204
 	zncMax := client.server.Config().History.ZNCMax
197
 	items, err := client.privmsgsBetween(start, end, maxDMTargetsForAutoplay, zncMax)
205
 	items, err := client.privmsgsBetween(start, end, maxDMTargetsForAutoplay, zncMax)
198
 	if err == nil && len(items) != 0 {
206
 	if err == nil && len(items) != 0 {

Loading…
取消
儲存