| 1 | package event |
| 2 | |
| 3 | import "github.com/FelineStateMachine/tinyrelay/protocol/nostr" |
| 4 | |
| 5 | // Filter is the public subscription and query value. |
| 6 | type Filter = nostr.Filter |
| 7 | |
| 8 | func ParseFilter(raw []byte) (Filter, error) { return nostr.ParseFilter(raw) } |
| 9 | func SearchTerms(query string) []string { return nostr.SearchTerms(query) } |
| 10 | |
| 11 | // Matches preserves the host's search visibility rule for existing consumers. |
| 12 | // Generic field, tag and content matching lives in protocol/nostr. |
| 13 | func Matches(f Filter, e Event) bool { |
| 14 | if IsPrivate(e.Kind) && len(nostr.SearchTerms(f.Search)) > 0 { |
| 15 | return false |
| 16 | } |
| 17 | return nostr.Matches(f, e) |
| 18 | } |