From ee53d55800033ba2fa1d61e0570e855e29450fb6 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sat, 20 Feb 2021 11:33:45 -0300 Subject: [PATCH] support kind filter. --- filter/filter.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/filter/filter.go b/filter/filter.go index 093e6b5..127826a 100644 --- a/filter/filter.go +++ b/filter/filter.go @@ -5,7 +5,7 @@ import "github.com/fiatjaf/go-nostr/event" type EventFilter struct { ID string `json:"id,omitempty"` Author string `json:"author,omitempty"` - Kind uint8 `json:"kind,omitempty"` + Kind *uint8 `json:"kind,omitempty"` Authors []string `json:"authors,omitempty"` TagEvent string `json:"#e,omitempty"` TagProfile string `json:"#p,omitempty"` @@ -96,6 +96,10 @@ func (ef EventFilter) Matches(event *event.Event) bool { } } + if ef.Kind != nil && *ef.Kind != event.Kind { + return false + } + if ef.Since != 0 && event.CreatedAt < ef.Since { return false }