X-Git-Url: https://git.r.bdr.sh/rbdr/olden-mail/blobdiff_plain/573aaf2a8ccdb6c8c917b2d88a39c9c8103f64ef..8ef3566a8961e2305ab701fce160de0dba1d050c:/src/middleware/find_mailboxes_compatibility.rs diff --git a/src/middleware/find_mailboxes_compatibility.rs b/src/middleware/find_mailboxes_compatibility.rs index f1a450b..6a9b341 100644 --- a/src/middleware/find_mailboxes_compatibility.rs +++ b/src/middleware/find_mailboxes_compatibility.rs @@ -1,14 +1,16 @@ use log::debug; -/// MailDrop can't find folders to sync because it sends FIND MAILBOXES /* +/// `MailDrop` can't find folders to sync because it sends FIND MAILBOXES /* /// which is not understood by modern servers. It instead replaces it with /// a LIST command. pub fn middleware(input: &[u8]) -> Vec { let command = String::from_utf8_lossy(input); - if let Some(tag) = command.split("FIND MAILBOXES /*").next() { - let replacement = format!("{} LIST \"/INBOX\" \"*\"\r\n", tag.trim()); - debug!("### {replacement}"); - return replacement.into_bytes(); + if command.contains("FIND MAILBOXES /*") { + if let Some(tag) = command.split("FIND MAILBOXES /*").next() { + let replacement = format!("{} LIST \"\" \"*\"\r\n", tag.trim()); + debug!("### {replacement}"); + return replacement.into_bytes(); + } } - return input.to_vec(); + input.to_vec() }