Fix next recurring appointment

Recurring appointments do not show up in the notification bar as next
appointment. This was partly corrected by 2084f35 (Fix notification of
recurrent appointments, 2017-02-09) and 5aa7a09 (Fix another error in
the notification code, 2017-02-11).

The search function recur_apoint_starts_before() had a wrong second
argument, but is really of no use: the start time of a recurring
appointment is the start time of the very first occurrence (in the
past). A comparison against the item in the notify_app structure tells
nothing of the start time of the current day; at most it eliminates some
future recurring appointments. The function can be dropped, and the
entire recurring appointment list looked through.

The proper start time is found in the main search loop (and called
real_recur_start_time) and must be compared against the item in the
notify_app structure.

But because recur_apoint_find_occurrence() is limited to a particular
day (second argument), two searches are necessary to cover 24 hours.

Unrelated cleanups: removed function return value; changed long to
time_t.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lars Henriksen
2018-07-15 10:30:41 +02:00
committed by Lukas Fleischer
parent f2ca5980e9
commit 8cbd456640
3 changed files with 18 additions and 27 deletions

View File

@@ -231,8 +231,7 @@ static void next_arg(void)
next_app.got_app = 0;
next_app.txt = NULL;
next_app = *recur_apoint_check_next(&next_app, current_time,
get_today());
recur_apoint_check_next(&next_app, current_time, get_today());
next_app = *apoint_check_next(&next_app, current_time);
if (next_app.got_app) {