invert the filtering for our purposes
This commit is contained in:
parent
4d4d9d62d0
commit
713aa404c7
1 changed files with 2 additions and 2 deletions
|
|
@ -11,12 +11,12 @@ pub struct Kinds {
|
||||||
impl NoteFilter for Kinds {
|
impl NoteFilter for Kinds {
|
||||||
fn filter_note(&mut self, input: &InputMessage) -> OutputMessage {
|
fn filter_note(&mut self, input: &InputMessage) -> OutputMessage {
|
||||||
let kind = input.event.kind;
|
let kind = input.event.kind;
|
||||||
if self.kinds.contains(&kind) {
|
if !self.kinds.contains(&kind) {
|
||||||
let msg = self
|
let msg = self
|
||||||
.messages
|
.messages
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|msgs| msgs.get(&kind.to_string()).cloned())
|
.and_then(|msgs| msgs.get(&kind.to_string()).cloned())
|
||||||
.unwrap_or_else(|| "blocked: note kind is not allowed here".to_string());
|
.unwrap_or_else(|| "blocked: this relay only accept music and playlist events (kind 36787 and 34139)".to_string());
|
||||||
OutputMessage::new(input.event.id.clone(), Action::Reject, Some(msg))
|
OutputMessage::new(input.event.id.clone(), Action::Reject, Some(msg))
|
||||||
} else {
|
} else {
|
||||||
OutputMessage::new(input.event.id.clone(), Action::Accept, None)
|
OutputMessage::new(input.event.id.clone(), Action::Accept, None)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue