aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2006-12-08 08:42:43 +0000
committerFrederic Culot <calcurse@culot.org>2006-12-08 08:42:43 +0000
commit69ca78cd189d4769ca3bd93910485b6b239f4490 (patch)
treeb1d9d6ec9136d9ea325da422a2a36839ae8f07f8
parent99e4193f5eccaac787b2d2b172505633a86a694c (diff)
downloadcalcurse-69ca78cd189d4769ca3bd93910485b6b239f4490.tar.gz
calcurse-69ca78cd189d4769ca3bd93910485b6b239f4490.zip
recur_get_apoint() and recur_get_event() created
-rwxr-xr-xsrc/recur.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/src/recur.c b/src/recur.c
index 4bff8db..6f4b860 100755
--- a/src/recur.c
+++ b/src/recur.c
@@ -1,4 +1,4 @@
-/* $calcurse: recur.c,v 1.16 2006/11/02 13:43:10 culot Exp $ */
+/* $calcurse: recur.c,v 1.17 2006/12/08 08:42:43 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -608,7 +608,7 @@ void recur_repeat_item(int sel_year, int sel_month, int sel_day,
}
date = date2sec(sel_year, sel_month, sel_day, 0, 0);
- day_erase_item(date, item_nb);
+ day_erase_item(date, item_nb, 0);
if (p->type == EVNT) {
re = recur_event_new(p->mesg, p->start, p->evnt_id,
type, freq, until, NULL);
@@ -688,3 +688,45 @@ struct notify_app_s *recur_apoint_check_next(
return app;
}
+
+/* Returns a structure containing the selected recurrent appointment. */
+recur_apoint_llist_node_t *recur_get_apoint(long date, int num)
+{
+ recur_apoint_llist_node_t *o;
+ int n = 0;
+
+ pthread_mutex_lock(&(recur_alist_p->mutex));
+ for (o = recur_alist_p->root; o != 0; o = o->next) {
+ if (recur_item_inday(o->start, o->exc, o->rpt->type,
+ o->rpt->freq, o->rpt->until, date)) {
+ if (n == num) {
+ pthread_mutex_unlock(&(recur_alist_p->mutex));
+ return o;
+ }
+ n++;
+ }
+ }
+ /* NOTREACHED */
+ fputs(_("FATAL ERROR in recur_get_apoint: no such item\n"), stderr);
+ exit(EXIT_FAILURE);
+}
+
+/* Returns a structure containing the selected recurrent event. */
+struct recur_event_s *recur_get_event(long date, int num)
+{
+ struct recur_event_s *o;
+ int n = 0;
+
+ for (o = recur_elist; o != 0; o = o->next) {
+ if (recur_item_inday(o->day, o->exc, o->rpt->type,
+ o->rpt->freq, o->rpt->until, date)) {
+ if (n == num) {
+ return o;
+ }
+ n++;
+ }
+ }
+ /* NOTREACHED */
+ fputs(_("FATAL ERROR in recur_get_event: no such item\n"), stderr);
+ exit(EXIT_FAILURE);
+}