feat(events): support RRULE recurrence in create/update/list#94
feat(events): support RRULE recurrence in create/update/list#94realitix wants to merge 1 commit into
Conversation
- createEvent accepts an optional 'recurrence' parameter taking an iCal RRULE string (the 'RRULE:' prefix is optional). Builds a calIRecurrenceInfo via XPCOM (@mozilla.org/calendar/recurrence-info;1 and @mozilla.org/calendar/recurrence-rule;1) and attaches it to the event before saving. Invalid rules are rejected with a clear error. - updateEvent accepts the same 'recurrence' parameter. An empty string or null clears the existing recurrence and turns the event into a one-shot; a non-empty string replaces the rule. - listEvents: formatEvent now exposes the RRULE in clear text (without the 'RRULE:' prefix) under a 'recurrence' field on the master event, alongside the existing 'isRecurring' boolean. Implementation note: cal.createRecurrenceInfo() and cal.createRecurrenceRule() are not exposed on the cal namespace in Thunderbird's calUtils, so we use the XPCOM contracts directly like the rest of the codebase already does for other calIxxx instances.
7966ee5 to
72170ea
Compare
|
Thanks @realitix. Few items before merge:
Holding #95 until this lands since it stacks on top. |
|
Thanks @realitix. Still need the items from the review above plus a rebase onto current main (showAs/categories/onlineMeeting landed since). The one that's a real bug rather than polish:
The rest: trim the trailing CRLF off the icalString, tighten RRULE normalization (a lowercase |
Summary
Adds RRULE recurrence support to
createEvent,updateEvent, andlistEvents.Changes
createEventaccepts an optionalrecurrenceparameter taking aniCal RRULE string (e.g.
FREQ=WEEKLY;BYDAY=MO,TU,TH,FRorRRULE:FREQ=DAILY;COUNT=10). TheRRULE:prefix is optional and addedautomatically if missing. Invalid rules are rejected with a clear error.
updateEventaccepts the samerecurrenceparameter. Empty stringor
nullclears the existing recurrence and turns the event into aone-shot; a non-empty string replaces the rule.
listEvents/formatEventnow exposes the RRULE in clear text(without the
RRULE:prefix) under arecurrencefield on the masterevent, alongside the existing
isRecurringboolean.Implementation notes
cal.createRecurrenceInfo()andcal.createRecurrenceRule()are notexposed on the
calnamespace in Thunderbird'scalUtils. The PR usesthe XPCOM contracts (
@mozilla.org/calendar/recurrence-info;1and@mozilla.org/calendar/recurrence-rule;1) like the rest of the codebasealready does for other
calIxxxinstances.createEvent/updateEvent/formatEventreadable:setRecurrenceOnItem(item, recurrence)extractRRuleFromItem(item)Test plan
createEventwithrecurrence: "FREQ=WEEKLY;BYDAY=MO": event appearsevery Monday in Thunderbird's calendar UI.
createEventwithrecurrence: "RRULE:FREQ=DAILY;COUNT=5": 5occurrences only.
createEventwithrecurrence: "GARBAGE": returns{ error: "Invalid recurrence rule: ..." }.updateEventwithrecurrence: "": existing recurring event becomesa one-shot.
listEventson a recurring master returnsrecurrence: "FREQ=WEEKLY;BYDAY=MO"(noRRULE:prefix) on theexpanded occurrences.
recurrence: null.