feat: implement server-side IMAP LIST and SEARCH filtering in Rust
Add server-side folder filtering using IMAP LIST patterns and enhance message filtering to use IMAP SEARCH with keyword filters when available. Key improvements: - Add list_filtered_mailboxes() method using IMAP LIST with patterns - Use server-side filtering instead of client-side folder filtering - Enhance message search to use IMAP SEARCH for subject/sender keywords - Add has_keyword_filters() method to MessageFilter - Reduce network traffic by leveraging IMAP server capabilities - Remove dependency on client-side filter_folders function This achieves full feature parity with the updated Go implementation and ensures both versions use IMAP standards optimally. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
84faf501f1
commit
ee236db3c1
3 changed files with 140 additions and 15 deletions
|
|
@ -77,6 +77,15 @@ pub struct MessageFilter {
|
|||
pub recipient_keywords: Vec<String>,
|
||||
}
|
||||
|
||||
impl MessageFilter {
|
||||
/// Check if this filter has any keyword-based filters that can use IMAP SEARCH
|
||||
pub fn has_keyword_filters(&self) -> bool {
|
||||
!self.subject_keywords.is_empty() || !self.sender_keywords.is_empty()
|
||||
// Note: recipient_keywords not included as IMAP SEARCH doesn't have a TO field search
|
||||
// that works reliably across all IMAP servers
|
||||
}
|
||||
}
|
||||
|
||||
fn default_mode() -> String {
|
||||
"archive".to_string()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue