]> git.r.bdr.sh - rbdr/olden-mail/blame - src/middleware/find_mailboxes_compatibility.rs
Apply formatting
[rbdr/olden-mail] / src / middleware / find_mailboxes_compatibility.rs
CommitLineData
573aaf2a
RBR
1use log::debug;
2
408fda8d 3/// `MailDrop` can't find folders to sync because it sends FIND MAILBOXES /*
573aaf2a
RBR
4/// which is not understood by modern servers. It instead replaces it with
5/// a LIST command.
6pub fn middleware(input: &[u8]) -> Vec<u8> {
7 let command = String::from_utf8_lossy(input);
a8a71b19
RBR
8 if command.contains("FIND MAILBOXES /*") {
9 if let Some(tag) = command.split("FIND MAILBOXES /*").next() {
10 let replacement = format!("{} LIST \"/INBOX\" \"*\"\r\n", tag.trim());
11 debug!("### {replacement}");
12 return replacement.into_bytes();
13 }
573aaf2a 14 }
408fda8d 15 input.to_vec()
573aaf2a 16}