summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2006-09-11 13:42:57 +0000
committerFrederic Culot <calcurse@culot.org>2006-09-11 13:42:57 +0000
commitb44651364f7038b5936fed6140dc0c3eefa75cec (patch)
tree29ba69ae44cab8dbbd220ff5150025b18a576e0b
parentdd0053a14681af16cb4b02accd022d354434b72f (diff)
downloadcalcurse-b44651364f7038b5936fed6140dc0c3eefa75cec.tar.gz
calcurse-b44651364f7038b5936fed6140dc0c3eefa75cec.zip
apoint_check_next() created
-rwxr-xr-xsrc/apoint.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/apoint.c b/src/apoint.c
index 5cbc62e..84663d0 100755
--- a/src/apoint.c
+++ b/src/apoint.c
@@ -1,4 +1,4 @@
-/* $calcurse: apoint.c,v 1.1 2006/07/31 21:00:03 culot Exp $ */
+/* $calcurse: apoint.c,v 1.2 2006/09/11 13:42:57 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -37,6 +37,7 @@
#include "day.h"
#include "custom.h"
#include "utils.h"
+#include "notify.h"
struct apoint_s *apointlist;
@@ -233,3 +234,33 @@ void scroll_pad_up(int item_nb, int nb_events_inday)
if (item_first_line < apad->first_onscreen)
apad->first_onscreen = item_first_line;
}
+
+/*
+ * Look in the appointment list if we have an item which starts before the item
+ * stored in the notify_app structure (which is the next item to be notified).
+ */
+struct notify_app_s *apoint_check_next(struct notify_app_s *app, long start)
+{
+ struct apoint_s *i;
+
+ if (!apointlist)
+ return app;
+ for (i = apointlist; i != 0; i = i->next) {
+ if (i->start > app->time) {
+ return app;
+ } else {
+ if (i->start > start) {
+ app->time = i->start;
+ if (strlen(i->mesg) < NOTIFY_FIELD_LENGTH) {
+ strncpy(app->txt, i->mesg,
+ strlen(i->mesg) + 1);
+ } else {
+ strncpy(app->txt, i->mesg,
+ NOTIFY_FIELD_LENGTH-3);
+ strncat(app->txt, "..", 2);
+ }
+ }
+ }
+ }
+ return app;
+}