support kind filter.

This commit is contained in:
fiatjaf 2021-02-20 11:33:45 -03:00
parent ba7f7b5398
commit ee53d55800

View File

@ -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
}