Skip to content

Commit

Permalink
bugs(imap): Add SINCE and DELETED support to fix Bluemail client. (#1473
Browse files Browse the repository at this point in the history
)
  • Loading branch information
rnwood authored May 12, 2024
1 parent 6f78f50 commit 37f8b37
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Rnwood.Smtp4dev/Server/Imap/ImapSearchTranslator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Func<Message, bool>> HandleSince(IMAP_Search_Key_Since since)
{
return m => m.ReceivedDate >= since.Date;
}

private Expression<Func<Message, bool>> HandleNone()
{
return m => false;
}

private Expression<Func<Message, bool>> HandleAll(IMAP_Search_Key_All all)
{
return m => true;
Expand Down

0 comments on commit 37f8b37

Please sign in to comment.