From 37f8b370624e295235d7ac40de1060967cf6dbff Mon Sep 17 00:00:00 2001 From: Rob Wood Date: Sun, 12 May 2024 09:15:26 +0100 Subject: [PATCH] bugs(imap): Add SINCE and DELETED support to fix Bluemail client. (#1473) --- .../Server/Imap/ImapSearchTranslator.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Rnwood.Smtp4dev/Server/Imap/ImapSearchTranslator.cs b/Rnwood.Smtp4dev/Server/Imap/ImapSearchTranslator.cs index de1062fdc..fc231228c 100644 --- a/Rnwood.Smtp4dev/Server/Imap/ImapSearchTranslator.cs +++ b/Rnwood.Smtp4dev/Server/Imap/ImapSearchTranslator.cs @@ -26,10 +26,24 @@ public class ImapSearchTranslator IMAP_Search_Key_Subject subject => HandleSubject(subject), IMAP_Search_Key_Or or => HandleOr(or), IMAP_Search_Key_All all => HandleAll(all), + IMAP_Search_Key_Draft => HandleNone(), + IMAP_Search_Key_Flagged => HandleNone(), + IMAP_Search_Key_Deleted => HandleNone(), + IMAP_Search_Key_Since since => HandleSince(since), { } unknown => throw new ImapSearchCriteriaNotSupportedException($"The criteria '{unknown} is not supported'") }; } + private Expression> HandleSince(IMAP_Search_Key_Since since) + { + return m => m.ReceivedDate >= since.Date; + } + + private Expression> HandleNone() + { + return m => false; + } + private Expression> HandleAll(IMAP_Search_Key_All all) { return m => true;