]> Pileus Git - lackey/blobdiff - cals/ical.c
Support one-time events
[lackey] / cals / ical.c
index 4336e8157b305539cf50bd6762e5ebcd8942bb5c..3ee3c68b073352239701dc97354066e0c7e48b9c 100644 (file)
@@ -114,6 +114,18 @@ static void add_recur(cal_t *cal,
 
                /* Add all recurrences */
                rrule = icalcomponent_get_first_property(comp, ICAL_RRULE_PROPERTY);
+
+               /* One-time event */
+               if (!rrule) {
+                       icalarray_append(array, &(ical_inst){
+                               .cal   = cal,
+                               .comp  = comp,
+                               .start = cstart,
+                               .end   = cend,
+                       });
+               }
+
+               /* Recurring events */
                while (rrule) {
                        recur = icalproperty_get_rrule(rrule);
                        iter  = icalrecur_iterator_new(recur, cstart);
@@ -350,10 +362,10 @@ void ical_printr(icalcomponent *comp, int depth)
        }
 }
 
-void ical_test(void)
+void ical_test(char *path)
 {
        /* Load ical */
-       FILE *file = fopen("data/all.ics", "r");
+       FILE *file = fopen(path, "r");
        icalparser *parser = icalparser_new();
        icalparser_set_gen_data(parser, file);
        icalcomponent *comp = icalparser_parse(parser, (void*)fgets);