aboutsummaryrefslogtreecommitdiff
path: root/vcalendar.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-03-08 13:14:34 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-03-08 13:14:34 +0100
commite7c471cb50bf92debc6e28ef5e45d0c5e4b3da3c (patch)
treec6f59fc9464d5c9ea704c1c05a6b6f57be13bd2f /vcalendar.scm
parentGot DAILY repeating event! (diff)
downloadcalp-e7c471cb50bf92debc6e28ef5e45d0c5e4b3da3c.tar.gz
calp-e7c471cb50bf92debc6e28ef5e45d0c5e4b3da3c.tar.xz
Made DTSTART have <time> instead of <date> type.
Diffstat (limited to 'vcalendar.scm')
-rw-r--r--vcalendar.scm49
1 files changed, 30 insertions, 19 deletions
diff --git a/vcalendar.scm b/vcalendar.scm
index 1bf0a1bb..03817957 100644
--- a/vcalendar.scm
+++ b/vcalendar.scm
@@ -1,27 +1,38 @@
(define-module (vcalendar)
#:use-module (vcalendar primitive)
+ #:use-module (vcalendar datetime)
#:use-module (srfi srfi-1)
- #:use-module (srfi srfi-26))
+ #:use-module (srfi srfi-26)
+ #:use-module (util))
+
+(define (parse-dates! cal)
+;;; Parse all start times into scheme date objects.
+ (for-each-in (children cal 'VEVENT)
+ (lambda (ev)
+ (transform-attr! ev "DTSTART" parse-datetime)
+ (transform-attr! ev "DTEND" parse-datetime)))
+ cal)
(define-public (make-vcomponent path)
- (if (string-ci=? ".ics" (string-take-right path 4))
- ;; == Single ICS file ==
- ;; Remove the abstract ROOT component,
- ;; returning the wanted VCALENDAR component
- (car (%vcomponent-children
- (%vcomponent-make path)))
- ;; == Assume vdir ==
- ;; Also removes the abstract ROOT component, but also
- ;; merges all VCALENDAR's children into the first
- ;; VCALENDAR, and return that VCALENDAR.
- ;;
- ;; TODO the other VCALENDAR components might not get thrown away,
- ;; this since I protect them from the GC in the C code.
- (reduce (lambda (cal accum)
- (for-each (cut %vcomponent-push-child! accum <>)
- (%vcomponent-children cal))
- accum)
- '() (%vcomponent-children (%vcomponent-make path)))))
+ (parse-dates!
+ (if (string-ci=? ".ics" (string-take-right path 4))
+ ;; == Single ICS file ==
+ ;; Remove the abstract ROOT component,
+ ;; returning the wanted VCALENDAR component
+ (car (%vcomponent-children
+ (%vcomponent-make path)))
+ ;; == Assume vdir ==
+ ;; Also removes the abstract ROOT component, but also
+ ;; merges all VCALENDAR's children into the first
+ ;; VCALENDAR, and return that VCALENDAR.
+ ;;
+ ;; TODO the other VCALENDAR components might not get thrown away,
+ ;; this since I protect them from the GC in the C code.
+ (reduce (lambda (cal accum)
+ (for-each (cut %vcomponent-push-child! accum <>)
+ (%vcomponent-children cal))
+ accum)
+ '() (%vcomponent-children (%vcomponent-make path))))))
(define-public (type-filter t lst)
(filter (lambda (e) (eqv? t (type e)))