fix: subscription event filtering bugs

Subscriptions properly filter using the authors tag.  Petname/keys are
correctly filtered (previously the event tags were incorrectly used).
This commit is contained in:
Greg Heartsfield
2021-12-14 21:38:26 -06:00
parent 54e6e0e5ce
commit 49598b2c9e
4 changed files with 36 additions and 16 deletions
+5 -5
View File
@@ -45,15 +45,15 @@ impl ClientConn {
self.client_id.to_string().chars().take(8).collect()
}
/// Find the first subscription identifier that matches the event,
/// if any do.
pub fn get_matching_subscription(&self, e: &Event) -> Option<&str> {
/// Find all matching subscriptions.
pub fn get_matching_subscriptions(&self, e: &Event) -> Vec<&str> {
let mut v: Vec<&str> = vec![];
for (id, sub) in self.subscriptions.iter() {
if sub.interested_in_event(e) {
return Some(id);
v.push(id);
}
}
None
return v;
}
/// Add a new subscription for this connection.