* fix: prevent CalDAV duplicate invitations with RFC-compliant SCHEDULE-AGENT
Fixes#9485
Adds SCHEDULE-AGENT=CLIENT to ATTENDEE lines in CalDAV createEvent and
updateEvent operations per RFC 6638 Section 7.1. This tells CalDAV servers
(Fastmail, NextCloud, etc.) that the client handles scheduling, preventing
duplicate invitation emails.
Implementation includes:
- RFC 5545 compliant line folding (max 75 octets per line)
- UTF-8 aware byte counting for international names
- Proper handling of :mailto: format in ATTENDEE lines
- Skips lines that already have SCHEDULE-AGENT parameter
* fix: address Cubic review - unfold lines and case-insensitive matching
- Add unfoldLines() to handle RFC 5545 folded lines before processing
- Use case-insensitive regex (gim flag) per RFC 5545 spec
- Simplify regex to properly capture params and value separately
* fix: only unfold/refold ATTENDEE lines, preserve other lines
- Match ATTENDEE lines including folded continuations
- Unfold only the matched ATTENDEE line
- Re-fold after adding SCHEDULE-AGENT=CLIENT
- Other iCal lines remain untouched (no RFC 5545 violation)
* fix: check SCHEDULE-AGENT only in params, not value
Only check for existing SCHEDULE-AGENT in the params portion,
not the value (which contains email/CN). This prevents false
positives when email contains "schedule-agent" substring.
* fix: handle quoted colons and exact SCHEDULE-AGENT matching
1. Colon parsing: Match :mailto:/:http:/:urn: patterns, or fallback
to finding colon not inside quotes
2. SCHEDULE-AGENT check: Use regex to match exact parameter name
(preceded by ; or at start), not substring match
* add tests
* Update .env.example
---------
Co-authored-by: Anik Dhabal Babu <adhabal2002@gmail.com>
Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>