From a0129d67510f60fadbd272252624a352f5c9f8b6 Mon Sep 17 00:00:00 2001
From: Lars Henriksen <LarsHenriksen@get2net.dk>
Date: Wed, 11 Dec 2019 09:57:02 +0100
Subject: Fix next recurrent appointment deleted

If the notify bar displays a recurrent appointment after midnight as next
upcoming appointment, the bar is not updated when the appointment/occurrence is
deleted.  The problem is not seen in 4.3.0 because of the bug described in
commit 8cbd456, Fix next recurring appointment.  The problem and the solution is
the same, this time in the function notify_same_recur_item().

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
---
 src/notify.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/notify.c b/src/notify.c
index 334468b..549a2be 100644
--- a/src/notify.c
+++ b/src/notify.c
@@ -537,11 +537,20 @@ int notify_same_item(time_t time)
 	return same;
 }
 
+/*
+ * Check if an occurrence of a recurrent appointment is currently the "next
+ * upcoming appointment" in the notify bar.
+ */
 int notify_same_recur_item(struct recur_apoint *i)
 {
 	int same = 0;
-	time_t item_start = 0;
+	time_t item_start;
 
+	/* Tomorrow? */
+	recur_item_find_occurrence(i->start, i->dur, &i->exc, i->rpt->type,
+				   i->rpt->freq, i->rpt->until,
+				   NEXTDAY(get_today()), &item_start);
+	/* Today? */
 	recur_item_find_occurrence(i->start, i->dur, &i->exc, i->rpt->type,
 				   i->rpt->freq, i->rpt->until,
 				   get_today(), &item_start);
-- 
cgit v1.2.3-70-g09d2