Refactor function calls: recurrence parameters as a single argument
The recurrence parameters are type, frequency, until date and exception list (in RFC 5545 parlance FREQ, INTERVAL, UNTIL and EXDATE's). When these are passed in a function call, the argument list becomes long and not very readable. When support for extended recurrence rules is implemented, the number of recurrence parameters increases, and function signatures must be amended. Solution: The "struct rpt" is extended with the exception list; any future recurrence parameters are added here. A pointer to this structure replaces the recurrence parameters in function calls. Note: Each recurrent event and appoinment instance has (a pointer to) a "struct rpt" and in addition an exception list. The latter is retained to avoid the derived changes, and the exception list in the structure is initialized to an empty list when the recurrent instance is created. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
committed by
Lukas Fleischer
parent
3f7bd331c8
commit
ce81c0fa63
10
src/ui-day.c
10
src/ui-day.c
@@ -975,16 +975,20 @@ void ui_day_item_repeat(void)
|
||||
|
||||
/* Set the selected APP item. */
|
||||
struct day_item d = empty_day;
|
||||
struct rpt rpt;
|
||||
rpt.type = type;
|
||||
rpt.freq = freq;
|
||||
rpt.until = until;
|
||||
LLIST_INIT(&rpt.exc);
|
||||
if (p->type == EVNT) {
|
||||
struct event *ev = p->item.ev;
|
||||
d.item.rev = recur_event_new(ev->mesg, ev->note, ev->day,
|
||||
ev->id, type, freq, until, NULL);
|
||||
ev->id, &rpt);
|
||||
} else if (p->type == APPT) {
|
||||
struct apoint *apt = p->item.apt;
|
||||
d.item.rapt = ra = recur_apoint_new(apt->mesg, apt->note,
|
||||
apt->start, apt->dur,
|
||||
apt->state, type, freq,
|
||||
until, NULL);
|
||||
apt->state, &rpt);
|
||||
if (notify_bar())
|
||||
notify_check_repeated(ra);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user