summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2017-02-09 08:32:29 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2017-02-09 08:43:32 +0100
commit2084f353e3d224bbc21148f25ab2f2539892d386 (patch)
treeca94f8b3a5b0e979ed5a1fdec40d091a474d2726
parented6035afb16e563b3bce9044fdf6fb1163119e70 (diff)
downloadcalcurse-2084f353e3d224bbc21148f25ab2f2539892d386.zip
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>
-rw-r--r--src/recur.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/recur.c b/src/recur.c
index 7f253f0..95a45ca 100644
--- a/src/recur.c
+++ b/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;
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,
recur_apoint_starts_before, i) {
struct recur_apoint *rapt = LLIST_TS_GET_DATA(i);