Pass item durations to recur_item_inday()
Having item's durations eventually allows for better parsing of recurrent appointments as we might be interested in how many days are covered by a multi-day appointment. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
3e84074ae5
commit
b0a6e1d448
@ -821,7 +821,8 @@ struct recur_event *recur_event_scan (FILE *, struct tm, int, char,
|
|||||||
void recur_apoint_write (struct recur_apoint *, FILE *);
|
void recur_apoint_write (struct recur_apoint *, FILE *);
|
||||||
void recur_event_write (struct recur_event *, FILE *);
|
void recur_event_write (struct recur_event *, FILE *);
|
||||||
void recur_save_data (FILE *);
|
void recur_save_data (FILE *);
|
||||||
unsigned recur_item_inday (long, llist_t *, int, int, long, long);
|
unsigned recur_item_inday (long, long, llist_t *, int, int, long,
|
||||||
|
long);
|
||||||
unsigned recur_apoint_inday(struct recur_apoint *, long);
|
unsigned recur_apoint_inday(struct recur_apoint *, long);
|
||||||
unsigned recur_event_inday(struct recur_event *, long);
|
unsigned recur_event_inday(struct recur_event *, long);
|
||||||
void recur_event_erase (long, unsigned, unsigned,
|
void recur_event_erase (long, unsigned, unsigned,
|
||||||
|
4
src/io.c
4
src/io.c
@ -264,8 +264,8 @@ foreach_date_dump (const long date_end, struct rpt *rpt, llist_t *exc,
|
|||||||
|
|
||||||
while (date <= date_end && date <= rpt->until)
|
while (date <= date_end && date <= rpt->until)
|
||||||
{
|
{
|
||||||
if (recur_item_inday (item_first_date, exc, rpt->type, rpt->freq,
|
if (recur_item_inday (item_first_date, item_dur, exc, rpt->type,
|
||||||
rpt->until, date))
|
rpt->freq, rpt->until, date))
|
||||||
{
|
{
|
||||||
(*cb_dump)(stream, date + item_time, item_dur, item_mesg);
|
(*cb_dump)(stream, date + item_time, item_dur, item_mesg);
|
||||||
}
|
}
|
||||||
|
@ -513,9 +513,9 @@ notify_check_repeated (struct recur_apoint *i)
|
|||||||
|
|
||||||
current_time = time (NULL);
|
current_time = time (NULL);
|
||||||
pthread_mutex_lock (¬ify_app.mutex);
|
pthread_mutex_lock (¬ify_app.mutex);
|
||||||
if ((real_app_time = recur_item_inday (i->start, &i->exc, i->rpt->type,
|
if ((real_app_time = recur_item_inday (i->start, i->dur, &i->exc,
|
||||||
i->rpt->freq, i->rpt->until,
|
i->rpt->type, i->rpt->freq,
|
||||||
get_today ())))
|
i->rpt->until, get_today ())))
|
||||||
{
|
{
|
||||||
if (!notify_app.got_app)
|
if (!notify_app.got_app)
|
||||||
{
|
{
|
||||||
@ -558,7 +558,7 @@ notify_same_recur_item (struct recur_apoint *i)
|
|||||||
int same = 0;
|
int same = 0;
|
||||||
long item_start = 0;
|
long item_start = 0;
|
||||||
|
|
||||||
item_start = recur_item_inday (i->start, &i->exc, i->rpt->type,
|
item_start = recur_item_inday (i->start, i->dur, &i->exc, i->rpt->type,
|
||||||
i->rpt->freq, i->rpt->until, get_today ());
|
i->rpt->freq, i->rpt->until, get_today ());
|
||||||
pthread_mutex_lock (¬ify_app.mutex);
|
pthread_mutex_lock (¬ify_app.mutex);
|
||||||
if (notify_app.got_app && item_start == notify_app.time)
|
if (notify_app.got_app && item_start == notify_app.time)
|
||||||
|
10
src/recur.c
10
src/recur.c
@ -631,8 +631,8 @@ exc_inday (struct excp *exc, long day_start)
|
|||||||
* calculation of recurrent dates after a turn of years.
|
* calculation of recurrent dates after a turn of years.
|
||||||
*/
|
*/
|
||||||
unsigned
|
unsigned
|
||||||
recur_item_inday (long item_start, llist_t *item_exc, int rpt_type,
|
recur_item_inday (long item_start, long item_dur, llist_t *item_exc,
|
||||||
int rpt_freq, long rpt_until, long day_start)
|
int rpt_type, int rpt_freq, long rpt_until, long day_start)
|
||||||
{
|
{
|
||||||
struct date start_date;
|
struct date start_date;
|
||||||
long day_end, diff;
|
long day_end, diff;
|
||||||
@ -708,15 +708,15 @@ recur_item_inday (long item_start, llist_t *item_exc, int rpt_type,
|
|||||||
unsigned
|
unsigned
|
||||||
recur_apoint_inday(struct recur_apoint *rapt, long day_start)
|
recur_apoint_inday(struct recur_apoint *rapt, long day_start)
|
||||||
{
|
{
|
||||||
return recur_item_inday (rapt->start, &rapt->exc, rapt->rpt->type,
|
return recur_item_inday (rapt->start, rapt->dur, &rapt->exc, rapt->rpt->type,
|
||||||
rapt->rpt->freq, rapt->rpt->until, day_start);
|
rapt->rpt->freq, rapt->rpt->until, day_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
recur_event_inday(struct recur_event *rev, long day_start)
|
recur_event_inday(struct recur_event *rev, long day_start)
|
||||||
{
|
{
|
||||||
return recur_item_inday (rev->day, &rev->exc, rev->rpt->type, rev->rpt->freq,
|
return recur_item_inday (rev->day, DAYINSEC, &rev->exc, rev->rpt->type,
|
||||||
rev->rpt->until, day_start);
|
rev->rpt->freq, rev->rpt->until, day_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user