mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-09-06 05:00:33 +02:00
support kind filter.
This commit is contained in:
@@ -5,7 +5,7 @@ import "github.com/fiatjaf/go-nostr/event"
|
|||||||
type EventFilter struct {
|
type EventFilter struct {
|
||||||
ID string `json:"id,omitempty"`
|
ID string `json:"id,omitempty"`
|
||||||
Author string `json:"author,omitempty"`
|
Author string `json:"author,omitempty"`
|
||||||
Kind uint8 `json:"kind,omitempty"`
|
Kind *uint8 `json:"kind,omitempty"`
|
||||||
Authors []string `json:"authors,omitempty"`
|
Authors []string `json:"authors,omitempty"`
|
||||||
TagEvent string `json:"#e,omitempty"`
|
TagEvent string `json:"#e,omitempty"`
|
||||||
TagProfile string `json:"#p,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 {
|
if ef.Since != 0 && event.CreatedAt < ef.Since {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user