Add the first draft of an event handler system
This commit is contained in:
parent
a6b9d18374
commit
2b87c9c3c3
4 changed files with 95 additions and 13 deletions
|
@ -1,7 +1,14 @@
|
|||
use log::debug;
|
||||
use env_logger::{Builder, Env};
|
||||
use opensmtpd::SmtpIn;
|
||||
use opensmtpd::{Entry, EventHandler, MatchEvent, SmtpIn};
|
||||
|
||||
fn on_event(entry: &Entry) -> bool {
|
||||
debug!("Event received: {:?}", entry);
|
||||
true
|
||||
}
|
||||
|
||||
fn main() {
|
||||
Builder::from_env(Env::default().default_filter_or("debug")).init();
|
||||
SmtpIn::new().run();
|
||||
let h = vec![EventHandler::new(MatchEvent::All, on_event)];
|
||||
SmtpIn::new().event_handlers(h).run();
|
||||
}
|
||||
|
|
Reference in a new issue