aboutsummaryrefslogtreecommitdiff
path: root/module/output
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-12-24 01:06:43 +0100
committerHugo Hörnquist <hugo@hornquist.se>2019-12-24 01:06:43 +0100
commit54bc4d547361a065f283720e6c0aee5fcb9268a8 (patch)
tree2f0cd3b1814bc036301a63880d0740b447af4143 /module/output
parentFix ical outuput for with recurrence-id:s. (diff)
downloadcalp-54bc4d547361a065f283720e6c0aee5fcb9268a8.tar.gz
calp-54bc4d547361a065f283720e6c0aee5fcb9268a8.tar.xz
ICAL handling of events different from display handling.
Previously repeating events where always instantiated to a stream of all events to come (possibly infinite), and then zipped with the list of regular events to create a stream of all events in the world. This commit allows access to the raw lists of parsed regular and repeating events before they are extrapolated and merged.
Diffstat (limited to 'module/output')
-rw-r--r--module/output/ical.scm18
1 files changed, 12 insertions, 6 deletions
diff --git a/module/output/ical.scm b/module/output/ical.scm
index 146afc8c..d2f5800c 100644
--- a/module/output/ical.scm
+++ b/module/output/ical.scm
@@ -98,7 +98,8 @@ CALSCALE:GREGORIAN\r
(define (print-footer)
(format #t "END:VCALENDAR\r\n"))
-(define-public (ical-main calendars events start end)
+;; list x list x list x time x time →
+(define-public (ical-main calendars regular-events repeating-events start end)
(print-header)
(let ((tzs (make-hash-table)))
@@ -109,11 +110,16 @@ CALSCALE:GREGORIAN\r
(hash-for-each (lambda (key component) (component->ical-string component))
tzs))
- ;; TODO this contains repeated events multiple times
- (stream-for-each
+ ;; TODO add support for running without a range limiter, emiting all objects.
+ (for-each
component->ical-string
- (filter-sorted-stream (lambda (ev) ((in-date-range? start end)
- (time-utc->date (attr ev 'DTSTART))))
- events))
+ (filter-sorted (lambda (ev) ((in-date-range? start end)
+ (time-utc->date (attr ev 'DTSTART))))
+ regular-events))
+
+ ;; TODO RECCURENCE-ID exceptions
+ ;; We just dump all repeating objects, since it's much cheaper to do it this way than
+ ;; to actually figure out which are applicable for the given date range.
+ (for-each component->ical-string repeating-events)
(print-footer))