summaryrefslogtreecommitdiffstats
path: root/src/recur.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/recur.c')
-rw-r--r--src/recur.c328
1 files changed, 177 insertions, 151 deletions
diff --git a/src/recur.c b/src/recur.c
index caa5ec3..f8f04e0 100644
--- a/src/recur.c
+++ b/src/recur.c
@@ -63,7 +63,7 @@ free_exc_list (llist_t *exc)
static int
exc_cmp_day (struct excp *a, struct excp *b)
{
- return (a->st < b->st ? -1 : (a->st == b->st ? 0 : 1));
+ return a->st < b->st ? -1 : (a->st == b->st ? 0 : 1);
}
static void
@@ -93,7 +93,7 @@ exc_dup (llist_t *in, llist_t *exc)
}
void
-recur_event_free_bkp (enum eraseflg flag)
+recur_event_free_bkp (void)
{
if (bkp_cut_recur_event.mesg)
{
@@ -106,11 +106,11 @@ recur_event_free_bkp (enum eraseflg flag)
bkp_cut_recur_event.rpt = 0;
}
free_exc_list (&bkp_cut_recur_event.exc);
- erase_note (&bkp_cut_recur_event.note, flag);
+ erase_note (&bkp_cut_recur_event.note);
}
void
-recur_apoint_free_bkp (enum eraseflg flag)
+recur_apoint_free_bkp (void)
{
if (bkp_cut_recur_apoint.mesg)
{
@@ -123,7 +123,7 @@ recur_apoint_free_bkp (enum eraseflg flag)
bkp_cut_recur_apoint.rpt = 0;
}
free_exc_list (&bkp_cut_recur_apoint.exc);
- erase_note (&bkp_cut_recur_apoint.note, flag);
+ erase_note (&bkp_cut_recur_apoint.note);
}
static void
@@ -214,13 +214,13 @@ recur_event_llist_free (void)
static int
recur_apoint_cmp_start (struct recur_apoint *a, struct recur_apoint *b)
{
- return (a->start < b->start ? -1 : (a->start == b->start ? 0 : 1));
+ return a->start < b->start ? -1 : (a->start == b->start ? 0 : 1);
}
static int
recur_event_cmp_day (struct recur_event *a, struct recur_event *b)
{
- return (a->day < b->day ? -1 : (a->day == b->day ? 0 : 1));
+ return a->day < b->day ? -1 : (a->day == b->day ? 0 : 1);
}
/* Insert a new recursive appointment in the general linked list */
@@ -310,7 +310,7 @@ recur_def2char (enum recur_type define)
return 0;
}
- return (recur_char);
+ return recur_char;
}
/*
@@ -340,7 +340,7 @@ recur_char2def (char type)
EXIT (_("unknown character"));
return 0;
}
- return (recur_def);
+ return recur_def;
}
/* Write days for which recurrent items should not be repeated. */
@@ -360,7 +360,7 @@ recur_write_exc (llist_t *lexc, FILE *f)
st_mon = lt->tm_mon + 1;
st_day = lt->tm_mday;
st_year = lt->tm_year + 1900;
- (void)fprintf (f, " !%02u/%02u/%04u", st_mon, st_day, st_year);
+ fprintf (f, " !%02u/%02u/%04u", st_mon, st_day, st_year);
}
}
@@ -374,7 +374,7 @@ recur_apoint_scan (FILE *f, struct tm start, struct tm end, char type,
time_t tstart, tend, tuntil;
/* Read the appointment description */
- (void)fgets (buf, sizeof buf, f);
+ fgets (buf, sizeof buf, f);
nl = strchr (buf, '\n');
if (nl)
{
@@ -406,8 +406,8 @@ recur_apoint_scan (FILE *f, struct tm start, struct tm end, char type,
EXIT_IF (tstart == -1 || tend == -1 || tstart > tend || tuntil == -1,
_("date error in appointment"));
- return (recur_apoint_new (buf, note, tstart, tend - tstart, state,
- recur_char2def (type), freq, tuntil, exc));
+ return recur_apoint_new (buf, note, tstart, tend - tstart, state,
+ recur_char2def(type), freq, tuntil, exc);
}
/* Load the recursive events from file */
@@ -419,13 +419,13 @@ recur_event_scan (FILE *f, struct tm start, int id, char type, int freq,
time_t tstart, tuntil;
/* Read the event description */
- (void)fgets (buf, sizeof buf, f);
+ fgets (buf, sizeof buf, f);
nl = strchr (buf, '\n');
if (nl)
{
*nl = '\0';
}
- start.tm_hour = until.tm_hour = 12;
+ start.tm_hour = until.tm_hour = 0;
start.tm_min = until.tm_min = 0;
start.tm_sec = until.tm_sec = 0;
start.tm_isdst = until.tm_isdst = -1;
@@ -445,12 +445,12 @@ recur_event_scan (FILE *f, struct tm start, int id, char type, int freq,
EXIT_IF (tstart == -1 || tuntil == -1,
_("date error in event"));
- return recur_event_new (buf, note, tstart, id, recur_char2def (type),
- freq, tuntil, exc);
+ return recur_event_new (buf, note, tstart, id, recur_char2def(type), freq,
+ tuntil, exc);
}
/* Writting of a recursive appointment into file. */
-static void
+void
recur_apoint_write (struct recur_apoint *o, FILE *f)
{
struct tm *lt;
@@ -458,41 +458,39 @@ recur_apoint_write (struct recur_apoint *o, FILE *f)
t = o->start;
lt = localtime (&t);
- (void)fprintf (f, "%02u/%02u/%04u @ %02u:%02u",
- lt->tm_mon + 1, lt->tm_mday, 1900 + lt->tm_year,
- lt->tm_hour, lt->tm_min);
+ fprintf (f, "%02u/%02u/%04u @ %02u:%02u", lt->tm_mon + 1, lt->tm_mday,
+ 1900 + lt->tm_year, lt->tm_hour, lt->tm_min);
t = o->start + o->dur;
lt = localtime (&t);
- (void)fprintf (f, " -> %02u/%02u/%04u @ %02u:%02u",
- lt->tm_mon + 1, lt->tm_mday, 1900 + lt->tm_year,
- lt->tm_hour, lt->tm_min);
+ fprintf (f, " -> %02u/%02u/%04u @ %02u:%02u", lt->tm_mon + 1, lt->tm_mday,
+ 1900 + lt->tm_year, lt->tm_hour, lt->tm_min);
t = o->rpt->until;
if (t == 0)
{ /* We have an endless recurrent appointment. */
- (void)fprintf (f, " {%d%c", o->rpt->freq, recur_def2char (o->rpt->type));
+ fprintf (f, " {%d%c", o->rpt->freq, recur_def2char (o->rpt->type));
}
else
{
lt = localtime (&t);
- (void)fprintf (f, " {%d%c -> %02u/%02u/%04u",
- o->rpt->freq, recur_def2char (o->rpt->type),
- lt->tm_mon + 1, lt->tm_mday, 1900 + lt->tm_year);
+ fprintf (f, " {%d%c -> %02u/%02u/%04u", o->rpt->freq,
+ recur_def2char (o->rpt->type), lt->tm_mon + 1, lt->tm_mday,
+ 1900 + lt->tm_year);
}
recur_write_exc (&o->exc, f);
- (void)fprintf (f, "} ");
+ fputs ("} ", f);
if (o->note != NULL)
- (void)fprintf (f, ">%s ", o->note);
+ fprintf (f, ">%s ", o->note);
if (o->state & APOINT_NOTIFY)
- (void)fprintf (f, "!");
+ fputc ('!', f);
else
- (void)fprintf (f, "|");
- (void)fprintf (f, "%s\n", o->mesg);
+ fputc ('|', f);
+ fprintf (f, "%s\n", o->mesg);
}
/* Writting of a recursive event into file. */
-static void
+void
recur_event_write (struct recur_event *o, FILE *f)
{
struct tm *lt;
@@ -508,9 +506,8 @@ recur_event_write (struct recur_event *o, FILE *f)
t = o->rpt->until;
if (t == 0)
{ /* We have an endless recurrent event. */
- (void)fprintf (f, "%02u/%02u/%04u [%d] {%d%c",
- st_mon, st_day, st_year, o->id, o->rpt->freq,
- recur_def2char (o->rpt->type));
+ fprintf (f, "%02u/%02u/%04u [%d] {%d%c", st_mon, st_day, st_year, o->id,
+ o->rpt->freq, recur_def2char (o->rpt->type));
}
else
{
@@ -518,16 +515,15 @@ recur_event_write (struct recur_event *o, FILE *f)
end_mon = lt->tm_mon + 1;
end_day = lt->tm_mday;
end_year = lt->tm_year + 1900;
- (void)fprintf (f, "%02u/%02u/%04u [%d] {%d%c -> %02u/%02u/%04u",
- st_mon, st_day, st_year, o->id,
- o->rpt->freq, recur_def2char (o->rpt->type),
- end_mon, end_day, end_year);
+ fprintf (f, "%02u/%02u/%04u [%d] {%d%c -> %02u/%02u/%04u", st_mon,
+ st_day, st_year, o->id, o->rpt->freq,
+ recur_def2char (o->rpt->type), end_mon, end_day, end_year);
}
recur_write_exc (&o->exc, f);
- (void)fprintf (f, "} ");
+ fputs ("} ", f);
if (o->note != NULL)
- (void)fprintf (f, ">%s ", o->note);
- (void)fprintf (f, "%s\n", o->mesg);
+ fprintf (f, ">%s ", o->note);
+ fprintf (f, "%s\n", o->mesg);
}
/* Write recursive items to file. */
@@ -553,9 +549,9 @@ recur_save_data (FILE *f)
/*
- * The two following defines together with the diff_days, diff_weeks,
- * diff_months and diff_years functions were provided by Lukas Fleischer to
- * correct the wrong calculation of recurrent dates after a turn of year.
+ * The two following defines together with the diff_days, diff_months and
+ * diff_years functions were provided by Lukas Fleischer to correct the wrong
+ * calculation of recurrent dates after a turn of year.
*/
#define BC(start, end, bs) \
(((end) - (start) + ((start) % bs) - ((end) % bs)) / bs \
@@ -586,13 +582,6 @@ diff_days (struct tm lt_start, struct tm lt_end)
return diff;
}
-/* Calculate the difference in weeks between two dates. */
-static long
-diff_weeks (struct tm lt_start, struct tm lt_end)
-{
- return diff_days (lt_start, lt_end) / WEEKINDAYS;
-}
-
/* Calculate the difference in months between two dates. */
static long
diff_months (struct tm lt_start, struct tm lt_end)
@@ -618,12 +607,12 @@ diff_years (struct tm lt_start, struct tm lt_end)
static int
exc_inday (struct excp *exc, long day_start)
{
- return (exc->st >= day_start && exc->st < day_start + DAYINSEC);
+ return exc->st >= day_start && exc->st < day_start + DAYINSEC;
}
/*
- * Check if the recurrent item belongs to the selected day,
- * and if yes, return the real start time.
+ * Check if the recurrent item belongs to the selected day, and if yes, store
+ * the start date of the occurrence that belongs to the day in a buffer.
*
* This function was improved thanks to Tony's patch.
* Thanks also to youshe for reporting daylight saving time related problems.
@@ -631,92 +620,135 @@ exc_inday (struct excp *exc, long day_start)
* calculation of recurrent dates after a turn of years.
*/
unsigned
-recur_item_inday (long item_start, llist_t *item_exc, int rpt_type,
- int rpt_freq, long rpt_until, long day_start)
+recur_item_find_occurrence (long item_start, long item_dur, llist_t *item_exc,
+ int rpt_type, int rpt_freq, long rpt_until,
+ long day_start, unsigned *occurrence)
{
struct date start_date;
- long day_end, diff;
- struct tm lt_item, lt_day;
+ long diff, span;
+ struct tm lt_day, lt_item, lt_item_day;
time_t t;
- day_end = day_start + DAYINSEC;
- t = day_start;
- lt_day = *localtime (&t);
-
- if (LLIST_FIND_FIRST (item_exc, day_start, exc_inday))
+ if (day_start < item_start - DAYINSEC + 1)
return 0;
- if (rpt_until == 0) /* we have an endless recurrent item */
- rpt_until = day_end;
+ if (rpt_until != 0 && day_start >= rpt_until + item_dur)
+ return 0;
- if (item_start > day_end || rpt_until < day_start)
- return (0);
+ t = day_start;
+ lt_day = *localtime (&t);
t = item_start;
lt_item = *localtime (&t);
+ lt_item_day = lt_item;
+ lt_item_day.tm_sec = lt_item_day.tm_min = lt_item_day.tm_hour = 0;
+
+ span = (item_start - mktime (&lt_item_day) + item_dur - 1) / DAYINSEC;
+
switch (rpt_type)
{
case RECUR_DAILY:
- diff = diff_days (lt_item, lt_day);
- if (diff % rpt_freq != 0)
- return (0);
- lt_item.tm_mday = lt_day.tm_mday;
- lt_item.tm_mon = lt_day.tm_mon;
- lt_item.tm_year = lt_day.tm_year;
+ diff = diff_days (lt_item_day, lt_day) % rpt_freq;
+ lt_item_day.tm_mday = lt_day.tm_mday - diff;
+ lt_item_day.tm_mon = lt_day.tm_mon;
+ lt_item_day.tm_year = lt_day.tm_year;
break;
case RECUR_WEEKLY:
- if (lt_item.tm_wday != lt_day.tm_wday)
- return (0);
- else
- {
- diff = diff_weeks (lt_item, lt_day);
- if (diff % rpt_freq != 0)
- return (0);
- }
- lt_item.tm_mday = lt_day.tm_mday;
- lt_item.tm_mon = lt_day.tm_mon;
- lt_item.tm_year = lt_day.tm_year;
+ diff = diff_days (lt_item_day, lt_day) % (rpt_freq * WEEKINDAYS);
+ lt_item_day.tm_mday = lt_day.tm_mday - diff;
+ lt_item_day.tm_mon = lt_day.tm_mon;
+ lt_item_day.tm_year = lt_day.tm_year;
break;
case RECUR_MONTHLY:
- diff = diff_months (lt_item, lt_day);
- if (diff % rpt_freq != 0)
- return (0);
- lt_item.tm_mon = lt_day.tm_mon;
- lt_item.tm_year = lt_day.tm_year;
+ diff = diff_months (lt_item_day, lt_day) % rpt_freq;
+ if (lt_day.tm_mday < lt_item_day.tm_mday)
+ diff++;
+ lt_item_day.tm_mon = lt_day.tm_mon - diff;
+ lt_item_day.tm_year = lt_day.tm_year;
break;
case RECUR_YEARLY:
- diff = diff_years (lt_item, lt_day);
- if (diff % rpt_freq != 0)
- return (0);
- lt_item.tm_year = lt_day.tm_year;
+ diff = diff_years (lt_item_day, lt_day) % rpt_freq;
+ if (lt_day.tm_mon < lt_item_day.tm_mon ||
+ (lt_day.tm_mon == lt_item_day.tm_mon &&
+ lt_day.tm_mday < lt_item_day.tm_mday))
+ diff++;
+ lt_item_day.tm_year = lt_day.tm_year - diff;
break;
default:
EXIT (_("unknown item type"));
}
- start_date.dd = lt_item.tm_mday;
- start_date.mm = lt_item.tm_mon + 1;
- start_date.yyyy = lt_item.tm_year + 1900;
- item_start = date2sec (start_date, lt_item.tm_hour, lt_item.tm_min);
- if (item_start < day_end && item_start >= day_start)
- return (item_start);
+ lt_item_day.tm_isdst = lt_day.tm_isdst;
+ t = mktime (&lt_item_day);
+
+ if (LLIST_FIND_FIRST (item_exc, t, exc_inday))
+ return 0;
+
+ if (rpt_until != 0 && t > rpt_until)
+ return 0;
+
+ lt_item_day = *localtime (&t);
+ diff = diff_days (lt_item_day, lt_day);
+
+ if (diff <= span)
+ {
+ if (occurrence)
+ {
+ start_date.dd = lt_item_day.tm_mday;
+ start_date.mm = lt_item_day.tm_mon + 1;
+ start_date.yyyy = lt_item_day.tm_year + 1900;
+
+ *occurrence = date2sec (start_date, lt_item.tm_hour, lt_item.tm_min);
+ }
+
+ return 1;
+ }
else
- return (0);
+ return 0;
+}
+
+unsigned
+recur_apoint_find_occurrence (struct recur_apoint *rapt, long day_start,
+ unsigned *occurrence)
+{
+ return recur_item_find_occurrence(rapt->start, rapt->dur, &rapt->exc,
+ rapt->rpt->type, rapt->rpt->freq,
+ rapt->rpt->until, day_start, occurrence);
+}
+
+unsigned
+recur_event_find_occurrence (struct recur_event *rev, long day_start,
+ unsigned *occurrence)
+{
+ return recur_item_find_occurrence(rev->day, DAYINSEC, &rev->exc,
+ rev->rpt->type, rev->rpt->freq,
+ rev->rpt->until, day_start, occurrence);
+}
+
+/* Check if a recurrent item belongs to the selected day. */
+unsigned
+recur_item_inday (long item_start, long item_dur, llist_t *item_exc,
+ int rpt_type, int rpt_freq, long rpt_until, long day_start)
+{
+ /* We do not need the (real) start time of the occurrence here, so just
+ * ignore the buffer. */
+ return recur_item_find_occurrence(item_start, item_dur, item_exc, rpt_type,
+ rpt_freq, rpt_until, day_start, NULL);
}
unsigned
recur_apoint_inday(struct recur_apoint *rapt, long day_start)
{
- return recur_item_inday (rapt->start, &rapt->exc, rapt->rpt->type,
- rapt->rpt->freq, rapt->rpt->until, day_start);
+ return recur_item_inday(rapt->start, rapt->dur, &rapt->exc, rapt->rpt->type,
+ rapt->rpt->freq, rapt->rpt->until, day_start);
}
unsigned
recur_event_inday(struct recur_event *rev, long day_start)
{
- return recur_item_inday (rev->day, &rev->exc, rev->rpt->type, rev->rpt->freq,
- rev->rpt->until, day_start);
+ return recur_item_inday(rev->day, DAYINSEC, &rev->exc, rev->rpt->type,
+ rev->rpt->freq, rev->rpt->until, day_start);
}
/*
@@ -740,12 +772,12 @@ recur_event_erase (long start, unsigned num, unsigned delete_whole,
switch (flag)
{
case ERASE_FORCE_ONLY_NOTE:
- erase_note (&rev->note, flag);
+ erase_note (&rev->note);
break;
case ERASE_CUT:
- recur_event_free_bkp (ERASE_FORCE);
+ recur_event_free_bkp ();
recur_event_dup (rev, &bkp_cut_recur_event);
- erase_note (&rev->note, ERASE_FORCE_KEEP_NOTE);
+ erase_note (&rev->note);
/* FALLTHROUGH */
default:
LLIST_REMOVE (&recur_elist, i);
@@ -756,8 +788,6 @@ recur_event_erase (long start, unsigned num, unsigned delete_whole,
rev->rpt = 0;
}
free_exc_list (&rev->exc);
- if (flag != ERASE_FORCE_KEEP_NOTE && flag != ERASE_CUT)
- erase_note (&rev->note, flag);
mem_free (rev);
break;
}
@@ -791,12 +821,12 @@ recur_apoint_erase (long start, unsigned num, unsigned delete_whole,
switch (flag)
{
case ERASE_FORCE_ONLY_NOTE:
- erase_note (&rapt->note, flag);
+ erase_note (&rapt->note);
break;
case ERASE_CUT:
- recur_apoint_free_bkp (ERASE_FORCE);
+ recur_apoint_free_bkp ();
recur_apoint_dup (rapt, &bkp_cut_recur_apoint);
- erase_note (&rapt->note, ERASE_FORCE_KEEP_NOTE);
+ erase_note (&rapt->note);
/* FALLTHROUGH */
default:
LLIST_TS_REMOVE (&recur_alist_p, i);
@@ -807,8 +837,6 @@ recur_apoint_erase (long start, unsigned num, unsigned delete_whole,
rapt->rpt = 0;
}
free_exc_list (&rapt->exc);
- if (flag != ERASE_FORCE_KEEP_NOTE && flag != ERASE_CUT)
- erase_note (&rapt->note, flag);
mem_free (rapt);
if (need_check_notify)
notify_check_next_app (0);
@@ -867,7 +895,7 @@ recur_repeat_item (struct conf *conf)
if (p->type != APPT && p->type != EVNT)
{
status_mesg (wrong_type_1, wrong_type_2);
- (void)wgetch (win[STA].p);
+ wgetch (win[STA].p);
return;
}
@@ -896,7 +924,7 @@ recur_repeat_item (struct conf *conf)
if (freq == 0)
{
status_mesg (mesg_wrong_freq, wrong_type_2);
- (void)wgetch (win[STA].p);
+ wgetch (win[STA].p);
}
user_input[0] = '\0';
}
@@ -906,8 +934,8 @@ recur_repeat_item (struct conf *conf)
while (!date_entered)
{
- (void)snprintf (outstr, BUFSIZ, mesg_until_1,
- DATEFMT_DESC (conf->input_datefmt));
+ snprintf (outstr, BUFSIZ, mesg_until_1,
+ DATEFMT_DESC (conf->input_datefmt));
status_mesg (_(outstr), "");
if (getstring (win[STA].p, user_input, BUFSIZ, 0, 1) == GETSTRING_VALID)
{
@@ -930,7 +958,7 @@ recur_repeat_item (struct conf *conf)
if (until < p->start)
{
status_mesg (mesg_older, wrong_type_2);
- (void)wgetch (win[STA].p);
+ wgetch (win[STA].p);
date_entered = 0;
}
else
@@ -940,10 +968,10 @@ recur_repeat_item (struct conf *conf)
}
else
{
- (void)snprintf (outstr, BUFSIZ, mesg_wrong_2,
- DATEFMT_DESC (conf->input_datefmt));
+ snprintf (outstr, BUFSIZ, mesg_wrong_2,
+ DATEFMT_DESC (conf->input_datefmt));
status_mesg (mesg_wrong_1, _(outstr));
- (void)wgetch (win[STA].p);
+ wgetch (win[STA].p);
date_entered = 0;
}
}
@@ -955,8 +983,8 @@ recur_repeat_item (struct conf *conf)
date = calendar_get_slctd_day_sec ();
if (p->type == EVNT)
{
- (void)recur_event_new (p->mesg, p->note, p->start, p->evnt_id,
- type, freq, until, NULL);
+ recur_event_new (p->mesg, p->note, p->start, p->evnt_id, type, freq,
+ until, NULL);
}
else if (p->type == APPT)
{
@@ -970,7 +998,7 @@ recur_repeat_item (struct conf *conf)
EXIT (_("wrong item type"));
/* NOTREACHED */
}
- day_erase_item (date, item_nb, ERASE_FORCE_KEEP_NOTE);
+ day_erase_item (date, item_nb, ERASE_FORCE);
}
/*
@@ -986,13 +1014,13 @@ recur_exc_scan (llist_t *lexc, FILE *data_file)
LLIST_INIT (lexc);
while ((c = getc (data_file)) == '!')
{
- (void)ungetc (c, data_file);
+ ungetc (c, data_file);
if (fscanf (data_file, "!%u / %u / %u ",
&day.tm_mon, &day.tm_mday, &day.tm_year) != 3)
{
EXIT (_("syntax error in item date"));
}
- day.tm_hour = 12;
+ day.tm_hour = 0;
day.tm_min = day.tm_sec = 0;
day.tm_isdst = -1;
day.tm_year -= 1900;
@@ -1006,7 +1034,7 @@ recur_exc_scan (llist_t *lexc, FILE *data_file)
static int
recur_apoint_starts_before (struct recur_apoint *rapt, long time)
{
- return (rapt->start < time);
+ return rapt->start < time;
}
/*
@@ -1017,15 +1045,15 @@ struct notify_app *
recur_apoint_check_next (struct notify_app *app, long start, long day)
{
llist_item_t *i;
- long real_recur_start_time;
+ unsigned real_recur_start_time;
LLIST_TS_LOCK (&recur_alist_p);
LLIST_TS_FIND_FOREACH (&recur_alist_p, app->time, recur_apoint_starts_before, i)
{
struct recur_apoint *rapt = LLIST_TS_GET_DATA (i);
- real_recur_start_time = recur_apoint_inday(rapt, day);
- if (real_recur_start_time > start)
+ if (recur_apoint_find_occurrence (rapt, day, &real_recur_start_time) &&
+ real_recur_start_time > start)
{
app->time = real_recur_start_time;
app->txt = mem_strdup (rapt->mesg);
@@ -1035,7 +1063,7 @@ recur_apoint_check_next (struct notify_app *app, long start, long day)
}
LLIST_TS_UNLOCK (&recur_alist_p);
- return (app);
+ return app;
}
/* Returns a structure containing the selected recurrent appointment. */
@@ -1093,7 +1121,7 @@ recur_event_paste_item (void)
long new_start, time_shift;
llist_item_t *i;
- new_start = date2sec (*calendar_get_slctd_day (), 12, 0);
+ new_start = date2sec (*calendar_get_slctd_day (), 0, 0);
time_shift = new_start - bkp_cut_recur_event.day;
bkp_cut_recur_event.day += time_shift;
@@ -1105,13 +1133,12 @@ recur_event_paste_item (void)
exc->st += time_shift;
}
- (void)recur_event_new (bkp_cut_recur_event.mesg, bkp_cut_recur_event.note,
- bkp_cut_recur_event.day, bkp_cut_recur_event.id,
- bkp_cut_recur_event.rpt->type,
- bkp_cut_recur_event.rpt->freq,
- bkp_cut_recur_event.rpt->until,
- &bkp_cut_recur_event.exc);
- recur_event_free_bkp (ERASE_FORCE_KEEP_NOTE);
+ recur_event_new (bkp_cut_recur_event.mesg, bkp_cut_recur_event.note,
+ bkp_cut_recur_event.day, bkp_cut_recur_event.id,
+ bkp_cut_recur_event.rpt->type,
+ bkp_cut_recur_event.rpt->freq,
+ bkp_cut_recur_event.rpt->until, &bkp_cut_recur_event.exc);
+ recur_event_free_bkp ();
}
void
@@ -1134,16 +1161,15 @@ recur_apoint_paste_item (void)
exc->st += time_shift;
}
- (void)recur_apoint_new (bkp_cut_recur_apoint.mesg, bkp_cut_recur_apoint.note,
- bkp_cut_recur_apoint.start, bkp_cut_recur_apoint.dur,
- bkp_cut_recur_apoint.state,
- bkp_cut_recur_apoint.rpt->type,
- bkp_cut_recur_apoint.rpt->freq,
- bkp_cut_recur_apoint.rpt->until,
- &bkp_cut_recur_apoint.exc);
+ recur_apoint_new (bkp_cut_recur_apoint.mesg, bkp_cut_recur_apoint.note,
+ bkp_cut_recur_apoint.start, bkp_cut_recur_apoint.dur,
+ bkp_cut_recur_apoint.state, bkp_cut_recur_apoint.rpt->type,
+ bkp_cut_recur_apoint.rpt->freq,
+ bkp_cut_recur_apoint.rpt->until,
+ &bkp_cut_recur_apoint.exc);
if (notify_bar ())
notify_check_repeated (&bkp_cut_recur_apoint);
- recur_apoint_free_bkp (ERASE_FORCE_KEEP_NOTE);
+ recur_apoint_free_bkp ();
}