1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use std::collections::HashSet;

use nson::Message;

use crate::queen::{Sessions, Session};

pub trait Hook: Send + 'static {
    fn accept(&self, _: &Session) -> bool { true }

    fn remove(&self, _: &Session) {}

    fn recv(&self, _: &Session, _: &mut Message) -> bool { true }

    fn send(&self, _: &Session, _: &mut Message) -> bool { true }

    fn auth(&self, _: &Session, _: &mut Message) -> bool { true }

    fn attach(&self, _: &Session, _: &mut Message, _chan: &str, _label: &HashSet<String>) -> bool { true }

    fn detach(&self, _: &Session, _: &mut Message, _chan: &str, _label: &HashSet<String>) -> bool { true }

    fn ping(&self, _: &Session, _: &mut Message) {}

    fn emit(&self, _: &Session, _: &mut Message) -> bool { true }

    fn push(&self, _: &Session, _: &mut Message) -> bool { true }

    fn kill(&self, _: &Session, _: &mut Message) -> bool { true }

    fn query(&self, _: &Sessions, _token: usize, _: &mut Message) {}

    fn custom(&self, _: &Sessions, _token: usize, _: &mut Message) {}
}

impl Hook for () {}