]> git.r.bdr.sh - rbdr/olden-mail/blobdiff - src/middleware/find_mailboxes_compatibility.rs
Don't use a prefix
[rbdr/olden-mail] / src / middleware / find_mailboxes_compatibility.rs
index f1a450b514e8b41856bbfc736a211153a22f6847..6a9b34120a8e42700ed7bb81d6d39a4b34103750 100644 (file)
@@ -1,14 +1,16 @@
 use log::debug;
 
 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<u8> {
     let command = String::from_utf8_lossy(input);
 /// which is not understood by modern servers. It instead replaces it with
 /// a LIST command.
 pub fn middleware(input: &[u8]) -> Vec<u8> {
     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()
 }
 }