Commit graph

17 commits

Author SHA1 Message Date
Rodolphe Bréard
e83af3d3e5 Switch to tab indentation 2021-02-28 13:56:40 +01:00
Rodolphe Bréard
4598fb33e4 Add the opensmtpd_derive crate 2020-12-20 17:24:08 +01:00
Rodolphe Bréard
a6d4dd21c1 Rewrite the project
The previous project architecture was far too complicated and hard to
maintain. The new one is much more simple. Although procedural macros
are cools, they are a no-go on Rust-OpenSMTPD.

Reports and filter are implemented (except data-line) but untested.
2020-11-25 18:04:16 +01:00
Rodolphe Breard
fdc8bd3dc4 Add filter-level and session-level contexts 2019-09-18 20:43:46 +02:00
Rodolphe Breard
789a41b51e Add the filter proc macro 2019-09-17 20:22:07 +02:00
Rodolphe Breard
2dff22062c Move OpenSmtpdAttributes to a dedicated module 2019-09-17 19:59:06 +02:00
Rodolphe Breard
dfa61a9eaa Replace .find().is_some() by .any() 2019-09-17 17:45:59 +02:00
Rodolphe Breard
45639f18c0 Refactor the library
Threads are a bad idea because for now the filter API is not guaranteed
to be state-less. The interface is now synchronous, which should be
enough for most filters.
The refactoring brought other changes, the most important being the
concept of modular input sources and output destination and the complete
rewrite of the procedural macro.
2019-09-17 16:45:04 +02:00
Rodolphe Breard
a9e4a697f7 Fix clippy warning 2019-06-29 17:35:56 +02:00
Rodolphe Breard
22c376930b Format code with cargo fmt 2019-01-18 19:10:12 +01:00
Rodolphe Breard
8173cb282a Switch to the MIT or Apache 2.0 license 2019-01-18 19:08:40 +01:00
Rodolphe Breard
c20fadf99d Alias event as report
This alias is made so people with OpenSMTPD filters knowledge will
directly understand that events are reports.
2019-01-17 20:05:31 +01:00
Rodolphe Breard
4b1f99db7e Allow the use of custom context
The main goal of events/reports is to update a context object, which
will be used in filters to generate a response. It is now possible to
use any object implementing both Clone and Default as a context object.
It is also possible to define no context at all.
2019-01-12 23:43:02 +01:00
Rodolphe Breard
11f3712138 Add a context object the callbacks
Many filters requires to keep a state within a session. Although it not
currently possible to do so, the callback now accept a mutable object of
type NoContext. This is the first step, the next one will be to accept
any type that implements both Clone and Default.
An other step will be to allow the user to define different callback
parameters depending on his/her needs.
2019-01-12 00:17:59 +01:00
Rodolphe Breard
ea710408d4 Cleanup the code 2019-01-06 17:07:00 +01:00
Rodolphe Breard
21efb88331 Move the EventHandler from the client to the proc macro 2019-01-06 15:45:58 +01:00
Rodolphe Breard
789455668c Use procedural macros to define events
The construction of an EventHandler object should not be directly done
by the client. Instead, it is easier to use procedural macro to
automatize the process, hence exposing a nice and simple interface. Such
use of procedural macros requires to crate an additional crate.
2019-01-06 15:41:30 +01:00