Add a Response object

This object will abstract the filter response. For now, it only allow
not to respond. This will change in a future version.
This commit is contained in:
Rodolphe Breard 2019-01-06 16:03:49 +01:00
parent 21efb88331
commit 4ed4609272
3 changed files with 16 additions and 9 deletions

View file

@ -1,17 +1,17 @@
use env_logger::{Builder, Env};
use log::{debug, info};
use opensmtpd::{event, handlers, Entry, SmtpIn};
use opensmtpd::{event, handlers, Entry, Response, SmtpIn};
#[event(Any)]
fn on_event(entry: &Entry) -> bool {
fn on_event(entry: &Entry) -> Response {
debug!("Event received: {:?}", entry);
true
Response::None
}
#[event(LinkConnect)]
fn on_connect(entry: &Entry) -> bool {
fn on_connect(entry: &Entry) -> Response {
info!("New client on session {:x}.", entry.session_id);
true
Response::None
}
fn main() {