Store only select TAGMSG types in message stores
We only want to store TAGMSG that should be persistent. +typing TAGMSG should be dropped, but +react messages should be kept. This introduces a whitelist for TAGMSG labels. We only store TAGMSG having a least one tag in that whitelist.
This commit is contained in:
parent
6ddfc943f5
commit
2604a14b7f
18
upstream.go
18
upstream.go
@ -44,6 +44,12 @@ var permanentUpstreamCaps = map[string]bool{
|
||||
"draft/extended-monitor": true,
|
||||
}
|
||||
|
||||
// storableMessageTags is the static list of message tags that will cause
|
||||
// a TAGMSG to be stored.
|
||||
var storableMessageTags = map[string]bool{
|
||||
"+react": true,
|
||||
}
|
||||
|
||||
type registrationError struct {
|
||||
*irc.Message
|
||||
}
|
||||
@ -2096,6 +2102,18 @@ func (uc *upstreamConn) appendLog(entity string, msg *irc.Message) (msgID string
|
||||
if uc.user.msgStore == nil {
|
||||
return ""
|
||||
}
|
||||
if msg.Command == "TAGMSG" {
|
||||
store := false
|
||||
for tag := range storableMessageTags {
|
||||
if _, ok := msg.Tags[tag]; ok {
|
||||
store = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !store {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// Don't store messages with a server mask target
|
||||
if strings.HasPrefix(entity, "$") {
|
||||
|
Loading…
Reference in New Issue
Block a user