mirror of
https://github.com/spartanz51/tutabridge.git
synced 2026-06-24 10:54:32 +02:00
style: rustfmt the server, parsing and APPEND changes
This commit is contained in:
@@ -40,7 +40,8 @@ pub async fn serve(
|
||||
{
|
||||
Ok(Ok(tls_stream)) => {
|
||||
if let Err(e) =
|
||||
handle_connection(tls_stream, store, backend, local_store, pw_hash).await
|
||||
handle_connection(tls_stream, store, backend, local_store, pw_hash)
|
||||
.await
|
||||
{
|
||||
error!("IMAP connection error: {}", e);
|
||||
}
|
||||
|
||||
@@ -1115,7 +1115,10 @@ fn append_first_token(args: &str) -> Option<String> {
|
||||
fn append_literal_size(args: &str) -> Option<usize> {
|
||||
let open = args.rfind('{')?;
|
||||
let close = args[open..].find('}')? + open;
|
||||
args[open + 1..close].trim_end_matches('+').parse::<usize>().ok()
|
||||
args[open + 1..close]
|
||||
.trim_end_matches('+')
|
||||
.parse::<usize>()
|
||||
.ok()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -512,7 +512,10 @@ mod tests {
|
||||
#[test]
|
||||
fn qp_non_utf8_byte_is_decoded_not_echoed() {
|
||||
let out = decode_quoted_printable("caf=E9");
|
||||
assert!(!out.contains("=E9"), "QP source must be decoded, not echoed");
|
||||
assert!(
|
||||
!out.contains("=E9"),
|
||||
"QP source must be decoded, not echoed"
|
||||
);
|
||||
assert!(out.starts_with("caf"), "got {out:?}");
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,8 @@ pub async fn serve(
|
||||
{
|
||||
Ok(Ok(tls_stream)) => {
|
||||
if let Err(e) =
|
||||
handle_connection(tls_stream, tuta, pw_hash, SmtpLimits::default()).await
|
||||
handle_connection(tls_stream, tuta, pw_hash, SmtpLimits::default())
|
||||
.await
|
||||
{
|
||||
error!("SMTP connection error: {}", e);
|
||||
}
|
||||
@@ -509,7 +510,10 @@ mod tests {
|
||||
assert!(size_param_exceeds("MAIL FROM:<a@b.com> size=30000000", max)); // case-insensitive
|
||||
assert!(!size_param_exceeds("MAIL FROM:<a@b.com> SIZE=1000", max));
|
||||
assert!(!size_param_exceeds("MAIL FROM:<a@b.com>", max)); // no SIZE param
|
||||
assert!(!size_param_exceeds("MAIL FROM:<a@b.com> SIZE=notanumber", max));
|
||||
assert!(!size_param_exceeds(
|
||||
"MAIL FROM:<a@b.com> SIZE=notanumber",
|
||||
max
|
||||
));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -672,9 +676,13 @@ mod tests {
|
||||
let backend = Arc::new(CountingBackend::default());
|
||||
let b = backend.clone();
|
||||
let h = tokio::spawn(async move {
|
||||
let _ =
|
||||
handle_connection(server, b as Arc<dyn MailBackend>, None, SmtpLimits::default())
|
||||
.await;
|
||||
let _ = handle_connection(
|
||||
server,
|
||||
b as Arc<dyn MailBackend>,
|
||||
None,
|
||||
SmtpLimits::default(),
|
||||
)
|
||||
.await;
|
||||
});
|
||||
|
||||
run_to_data(&mut client).await;
|
||||
|
||||
@@ -458,7 +458,10 @@ pub async fn run_syncer(
|
||||
Ok(Some(rfc)) => {
|
||||
let text = extract_body_text(&rfc);
|
||||
if let Err(e) = ls.index_body(&meta.element_id, &text) {
|
||||
warn!("FTS backfill failed for {}: {e}", meta.element_id);
|
||||
warn!(
|
||||
"FTS backfill failed for {}: {e}",
|
||||
meta.element_id
|
||||
);
|
||||
ok = false;
|
||||
} else {
|
||||
indexed += 1;
|
||||
@@ -466,7 +469,10 @@ pub async fn run_syncer(
|
||||
}
|
||||
Ok(None) => {}
|
||||
Err(e) => {
|
||||
warn!("FTS backfill read failed for {}: {e}", meta.element_id);
|
||||
warn!(
|
||||
"FTS backfill read failed for {}: {e}",
|
||||
meta.element_id
|
||||
);
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user