~emersion/soju-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] Store only select TAGMSG types in message stores

Details
Message ID
<20221216111227.31744-1-delthas@dille.cc>
DKIM signature
missing
Download raw message
Patch: +18 -0
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.
---
 upstream.go | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/upstream.go b/upstream.go
index 49e5a76..542d742 100644
--- a/upstream.go
+++ b/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, "$") {

base-commit: 6ddfc943f5a2f77f00ef2fc0a19787918e31999e
-- 
2.17.1
Details
Message ID
<U5zC8wn9JtXsz9Wy8O5H4VlO5TSMDei8KtHlxhlekNo-OloFCqBJ08sfmrFN5HV37vznyq16M0VKxINyXVVcsimSKxuIPzAHyYNq1BmGhOM=@emersion.fr>
In-Reply-To
<20221216111227.31744-1-delthas@dille.cc> (view parent)
DKIM signature
missing
Download raw message
Pushed, thanks!
Reply to thread Export thread (mbox)