mirror of
https://github.com/jeremyd/ergo.git
synced 2026-05-13 14:28:36 -07:00
fix #1676
Fix various pagination issues with CHATHISTORY; also undo #491 (msgid munging).
This commit is contained in:
@@ -4,9 +4,17 @@
|
||||
package history
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ExcludeFlags uint
|
||||
|
||||
const (
|
||||
ExcludeTagmsg ExcludeFlags = 1 << iota
|
||||
ExcludeJoins
|
||||
)
|
||||
|
||||
// Selector represents a parameter to a CHATHISTORY command
|
||||
type Selector struct {
|
||||
Msgid string
|
||||
@@ -77,3 +85,16 @@ func MinMaxAsc(after, before, cutoff time.Time) (min, max time.Time, ascending b
|
||||
}
|
||||
return after, before, ascending
|
||||
}
|
||||
|
||||
// maps regular msgids from JOIN, etc. to a msgid suitable for attaching
|
||||
// to a HistServ message describing the JOIN. See #491 for some history.
|
||||
func HistservMungeMsgid(msgid string) string {
|
||||
return "_" + msgid
|
||||
}
|
||||
|
||||
// strips munging from a msgid. future schemes may not support a well-defined
|
||||
// mapping of munged msgids to true msgids, but munged msgids should always contain
|
||||
// a _, with metadata in front and data (possibly the true msgid) after.
|
||||
func NormalizeMsgid(msgid string) string {
|
||||
return strings.TrimPrefix(msgid, "_")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user