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