Author:
Hash:
Timestamp:
+1 -56 +/-2 browse
Kevin Schoon [me@kevinschoon.com]
ae1a8e244fb7d4479384d190d75dfd2449ecc777
Fri, 30 Aug 2024 15:38:41 +0000 (1.2 years ago)
| 1 | diff --git a/maitred/src/lib.rs b/maitred/src/lib.rs |
| 2 | index 8b20e4b..b78d80f 100644 |
| 3 | --- a/maitred/src/lib.rs |
| 4 | +++ b/maitred/src/lib.rs |
| 5 | @@ -55,7 +55,7 @@ mod transport; |
| 6 | mod verify; |
| 7 | mod worker; |
| 8 | |
| 9 | - use smtp_proto::{Request, Response as SmtpResponse}; |
| 10 | + use smtp_proto::Response as SmtpResponse; |
| 11 | use transport::Response; |
| 12 | |
| 13 | pub use delivery::{Delivery, Error as DeliveryError}; |
| 14 | @@ -74,60 +74,6 @@ pub use email_address; |
| 15 | pub use mail_parser; |
| 16 | pub use smtp_proto; |
| 17 | |
| 18 | - /// Chunk is a logical set of SMTP resposnes that might be generated from one |
| 19 | - /// command or "pipelined" as the result of several commands sent by the client |
| 20 | - /// that do not require immediate responses. |
| 21 | - #[derive(Clone, Debug, Default)] |
| 22 | - pub struct Chunk(pub Vec<Response<String>>); |
| 23 | - |
| 24 | - impl PartialEq for Chunk { |
| 25 | - fn eq(&self, other: &Self) -> bool { |
| 26 | - self.0.len() == other.0.len() && self.0.iter().zip(other.0.iter()).all(|(a, b)| a == b) |
| 27 | - } |
| 28 | - } |
| 29 | - |
| 30 | - impl From<crate::verify::Error> for Chunk { |
| 31 | - fn from(value: crate::verify::Error) -> Self { |
| 32 | - match value { |
| 33 | - crate::verify::Error::Server(e) => Chunk(vec![smtp_response!(500, 0, 0, 0, e)]), |
| 34 | - crate::verify::Error::NotFound(e) => Chunk(vec![smtp_response!(500, 0, 0, 0, e)]), |
| 35 | - crate::verify::Error::Ambiguous { |
| 36 | - email, |
| 37 | - alternatives, |
| 38 | - } => { |
| 39 | - let mut result = vec![smtp_response!( |
| 40 | - 500, |
| 41 | - 0, |
| 42 | - 0, |
| 43 | - 0, |
| 44 | - format!("Username {} Ambigious", email) |
| 45 | - )]; |
| 46 | - result.extend( |
| 47 | - alternatives |
| 48 | - .iter() |
| 49 | - .map(|alt| smtp_response!(500, 0, 0, 0, alt.to_string())), |
| 50 | - ); |
| 51 | - Chunk(result) |
| 52 | - } |
| 53 | - } |
| 54 | - } |
| 55 | - } |
| 56 | - |
| 57 | - impl From<crate::expand::Error> for Chunk { |
| 58 | - fn from(value: crate::expand::Error) -> Self { |
| 59 | - match value { |
| 60 | - expand::Error::Server(message) => Chunk(vec![smtp_response!(500, 0, 0, 0, message)]), |
| 61 | - expand::Error::NotFound(name) => Chunk(vec![smtp_response!( |
| 62 | - 500, |
| 63 | - 0, |
| 64 | - 0, |
| 65 | - 0, |
| 66 | - format!("Cannot find: {}", name) |
| 67 | - )]), |
| 68 | - } |
| 69 | - } |
| 70 | - } |
| 71 | - |
| 72 | /// Generate a single smtp_response |
| 73 | macro_rules! smtp_response { |
| 74 | ($code:expr, $e1:expr, $e2:expr, $e3:expr, $name:expr) => { |
| 75 | diff --git a/maitred/src/transport.rs b/maitred/src/transport.rs |
| 76 | index a01704a..e35f8a8 100644 |
| 77 | --- a/maitred/src/transport.rs |
| 78 | +++ b/maitred/src/transport.rs |
| 79 | @@ -96,7 +96,6 @@ impl Display for Command { |
| 80 | #[derive(Default)] |
| 81 | pub(crate) struct Transport { |
| 82 | receiver: Option<Box<Receiver>>, |
| 83 | - prev: Option<Request<String>>, |
| 84 | buf: Vec<u8>, |
| 85 | pipelining: bool, |
| 86 | } |