feat: implement comprehensive wildcard folder selection and keyword filtering
## Wildcard Folder Selection
- Add support for wildcard patterns (`*`, `?`, `[abc]`) using filepath.Match
- Implement special case: `"*"` selects ALL available folders
- Support for complex include/exclude pattern combinations
- Maintain backwards compatibility with exact string matching
- Enable subfolder pattern matching (e.g., `Work/*`, `*/Drafts`)
## Keyword Filtering
- Add SubjectKeywords, SenderKeywords, RecipientKeywords to MessageFilter config
- Implement case-insensitive keyword matching across message fields
- Support multiple keywords per filter type with inclusive OR logic
- Add ShouldProcessMessage method for message-level filtering
## Enhanced Test Environment
- Create comprehensive wildcard pattern test scenarios
- Add 12 test folders covering various pattern types: Work/*, Important/*, Archive/*, exact matches
- Implement dedicated wildcard test script (test-wildcard-patterns.sh)
- Update test configurations to demonstrate real-world wildcard usage patterns
- Enhance test data generation with folder-specific messages for validation
## Documentation
- Create FOLDER_PATTERNS.md with comprehensive wildcard examples and use cases
- Update CLAUDE.md to reflect all implemented features and current status
- Enhance test README with detailed wildcard pattern explanations
- Provide configuration examples for common email organization scenarios
## Message Origin Tracking
- Verify all messages in CouchDB properly tagged with origin folder in `mailbox` field
- Maintain per-account database isolation for better organization
- Document ID format: `{folder}_{uid}` ensures uniqueness across folders
Key patterns supported:
- `["*"]` - All folders (with excludes)
- `["Work*", "Important*"]` - Prefix matching
- `["Work/*", "Archive/*"]` - Subfolder patterns
- `["INBOX", "Sent"]` - Exact matches
- Complex include/exclude combinations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
ea6235b674
commit
357cd06264
10 changed files with 602 additions and 84 deletions
|
|
@ -7,7 +7,7 @@
|
|||
},
|
||||
"mailSources": [
|
||||
{
|
||||
"name": "Test User 1",
|
||||
"name": "Wildcard All Folders Test",
|
||||
"enabled": true,
|
||||
"protocol": "imap",
|
||||
"host": "localhost",
|
||||
|
|
@ -16,13 +16,16 @@
|
|||
"password": "password123",
|
||||
"mode": "archive",
|
||||
"folderFilter": {
|
||||
"include": ["INBOX", "Sent"],
|
||||
"exclude": []
|
||||
"include": ["*"],
|
||||
"exclude": ["Drafts", "Trash"]
|
||||
},
|
||||
"messageFilter": {}
|
||||
"messageFilter": {
|
||||
"subjectKeywords": ["meeting", "important"],
|
||||
"senderKeywords": ["@company.com"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Test Sync User",
|
||||
"name": "Work Pattern Test",
|
||||
"enabled": true,
|
||||
"protocol": "imap",
|
||||
"host": "localhost",
|
||||
|
|
@ -31,13 +34,15 @@
|
|||
"password": "syncpass",
|
||||
"mode": "sync",
|
||||
"folderFilter": {
|
||||
"include": ["INBOX"],
|
||||
"exclude": []
|
||||
"include": ["Work*", "Important*", "INBOX"],
|
||||
"exclude": ["*Temp*"]
|
||||
},
|
||||
"messageFilter": {}
|
||||
"messageFilter": {
|
||||
"recipientKeywords": ["support@", "team@"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Test Archive User",
|
||||
"name": "Specific Folders Only",
|
||||
"enabled": true,
|
||||
"protocol": "imap",
|
||||
"host": "localhost",
|
||||
|
|
@ -46,8 +51,23 @@
|
|||
"password": "archivepass",
|
||||
"mode": "archive",
|
||||
"folderFilter": {
|
||||
"include": [],
|
||||
"exclude": ["Drafts"]
|
||||
"include": ["INBOX", "Sent", "Personal"],
|
||||
"exclude": []
|
||||
},
|
||||
"messageFilter": {}
|
||||
},
|
||||
{
|
||||
"name": "Subfolder Pattern Test",
|
||||
"enabled": false,
|
||||
"protocol": "imap",
|
||||
"host": "localhost",
|
||||
"port": 3143,
|
||||
"user": "testuser2",
|
||||
"password": "password456",
|
||||
"mode": "archive",
|
||||
"folderFilter": {
|
||||
"include": ["Work/*", "Archive/*"],
|
||||
"exclude": ["*/Drafts"]
|
||||
},
|
||||
"messageFilter": {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue