From ee44a162b6231854b7724b52382eb3c00f4d7c53 Mon Sep 17 00:00:00 2001 From: Michael Mc Donnell Date: Tue, 3 Aug 2021 13:52:34 -0700 Subject: [PATCH] Skip Gmail labels Gmail labels are not folders and should be skipped. For example, emails appear in the inbox and under "All Mail" as soon as it is received. The code used to wrongly conclude that the email had already been moved and left it in the inbox. --- src/imap/scan_folders.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/imap/scan_folders.rs b/src/imap/scan_folders.rs index 3ab09bf6d..af6bfb9d5 100644 --- a/src/imap/scan_folders.rs +++ b/src/imap/scan_folders.rs @@ -42,6 +42,15 @@ impl Imap { } }; + // Gmail labels are not folders and should be skipped. For example, + // emails appear in the inbox and under "All Mail" as soon as it is + // received. The code used to wrongly conclude that the email had + // already been moved and left it in the inbox. + let folder_name = folder.name(); + if folder_name.starts_with("[Gmail]") { + continue; + } + let folder_meaning = get_folder_meaning(&folder); let folder_name_meaning = get_folder_meaning_by_name(folder.name());