recur_apoint_check_next() created

This commit is contained in:
Frederic Culot 2006-09-11 13:34:48 +00:00
parent c7cba56126
commit d04b0151ba

View File

@ -1,4 +1,4 @@
/* $calcurse: recur.c,v 1.9 2006/09/11 13:16:39 culot Exp $ */
/* $calcurse: recur.c,v 1.10 2006/09/11 13:34:48 culot Exp $ */
/*
* Calcurse - text-based organizer
@ -36,6 +36,7 @@
#include "apoint.h"
#include "event.h"
#include "recur.h"
#include "notify.h"
#include "args.h"
#include "day.h"
#include "vars.h"
@ -638,3 +639,34 @@ struct days_s *recur_exc_scan(FILE *data_file)
}
return exc_head;
}
/*
* 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 *recur_apoint_check_next(
struct notify_app_s *app, long start)
{
struct recur_apoint_s *i;
if (!recur_alist)
return app;
for (i = recur_alist; 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;
}