|
@@ -4,9 +4,10 @@
|
4
|
4
|
package history
|
5
|
5
|
|
6
|
6
|
import (
|
7
|
|
- "github.com/ergochat/ergo/irc/utils"
|
8
|
7
|
"sync"
|
9
|
8
|
"time"
|
|
9
|
+
|
|
10
|
+ "github.com/ergochat/ergo/irc/utils"
|
10
|
11
|
)
|
11
|
12
|
|
12
|
13
|
type ItemType uint
|
|
@@ -55,12 +56,6 @@ func (item *Item) HasMsgid(msgid string) bool {
|
55
|
56
|
|
56
|
57
|
type Predicate func(item *Item) (matches bool)
|
57
|
58
|
|
58
|
|
-func Reverse(results []Item) {
|
59
|
|
- for i, j := 0, len(results)-1; i < j; i, j = i+1, j-1 {
|
60
|
|
- results[i], results[j] = results[j], results[i]
|
61
|
|
- }
|
62
|
|
-}
|
63
|
|
-
|
64
|
59
|
// Buffer is a ring buffer holding message/event history for a channel or user
|
65
|
60
|
type Buffer struct {
|
66
|
61
|
sync.RWMutex
|
|
@@ -160,7 +155,7 @@ func (list *Buffer) betweenHelper(start, end Selector, cutoff time.Time, pred Pr
|
160
|
155
|
|
161
|
156
|
defer func() {
|
162
|
157
|
if !ascending {
|
163
|
|
- Reverse(results)
|
|
158
|
+ utils.ReverseSlice(results)
|
164
|
159
|
}
|
165
|
160
|
}()
|
166
|
161
|
|