mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
make TAGMSG storage configurable
This commit is contained in:
parent
f2d0842453
commit
bca3dd0b41
7 changed files with 74 additions and 26 deletions
|
|
@ -29,12 +29,6 @@ const (
|
|||
initialAutoSize = 32
|
||||
)
|
||||
|
||||
// a Tagmsg that consists entirely of transient tags is not stored
|
||||
var transientTags = map[string]bool{
|
||||
"+draft/typing": true,
|
||||
"+typing": true, // future-proofing
|
||||
}
|
||||
|
||||
// Item represents an event (e.g., a PRIVMSG or a JOIN) and its associated data
|
||||
type Item struct {
|
||||
Type ItemType
|
||||
|
|
@ -57,23 +51,6 @@ func (item *Item) HasMsgid(msgid string) bool {
|
|||
return item.Message.Msgid == msgid
|
||||
}
|
||||
|
||||
func (item *Item) IsStorable() bool {
|
||||
switch item.Type {
|
||||
case Tagmsg:
|
||||
for name := range item.Tags {
|
||||
if !transientTags[name] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false // all tags were blacklisted
|
||||
case Privmsg, Notice:
|
||||
// don't store CTCP other than ACTION
|
||||
return !item.Message.IsRestrictedCTCPMessage()
|
||||
default:
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
type Predicate func(item *Item) (matches bool)
|
||||
|
||||
func Reverse(results []Item) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue