make TAGMSG storage configurable

This commit is contained in:
Shivaram Lingamneni 2020-07-09 18:36:45 -04:00
parent f2d0842453
commit bca3dd0b41
7 changed files with 74 additions and 26 deletions

View file

@ -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) {