Fix notification of recurrent appointments
The recur_apoint_starts_before() filter function expected the second parameter to be passed by value, whereas its only caller passed the value by reference. For consistency with apoint_starts_after(), change the signature and the implementation of recur_apoint_starts_before() such that the parameter is passed by reference. Also, add a comment to the only caller of recur_apoint_starts_before() to clarify on why recur_apoint_starts_before() is used. Fixes GitHub issue #25. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
parent
ed6035afb1
commit
2084f353e3
10
src/recur.c
10
src/recur.c
@ -917,9 +917,9 @@ void recur_exc_scan(llist_t * lexc, FILE * data_file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int recur_apoint_starts_before(struct recur_apoint *rapt, long time)
|
static int recur_apoint_starts_before(struct recur_apoint *rapt, long *time)
|
||||||
{
|
{
|
||||||
return rapt->start < time;
|
return rapt->start < *time;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -933,6 +933,12 @@ struct notify_app *recur_apoint_check_next(struct notify_app *app,
|
|||||||
time_t real_recur_start_time;
|
time_t real_recur_start_time;
|
||||||
|
|
||||||
LLIST_TS_LOCK(&recur_alist_p);
|
LLIST_TS_LOCK(&recur_alist_p);
|
||||||
|
/*
|
||||||
|
* Iterate over all recurrent items starting before the current "next"
|
||||||
|
* appointment. We cannot filter by start time because a recurrent item
|
||||||
|
* can actually start (several days) before the current "next" item and
|
||||||
|
* still have an occurrence which is the next item to be notified.
|
||||||
|
*/
|
||||||
LLIST_TS_FIND_FOREACH(&recur_alist_p, &app->time,
|
LLIST_TS_FIND_FOREACH(&recur_alist_p, &app->time,
|
||||||
recur_apoint_starts_before, i) {
|
recur_apoint_starts_before, i) {
|
||||||
struct recur_apoint *rapt = LLIST_TS_GET_DATA(i);
|
struct recur_apoint *rapt = LLIST_TS_GET_DATA(i);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user