aboutsummaryrefslogtreecommitdiff
path: root/module/vcomponent.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-10-03 00:46:01 +0200
committerHugo Hörnquist <hugo@hornquist.se>2019-10-03 00:46:01 +0200
commite13f6bb201dff690208b9cc951b5c098b0d63356 (patch)
tree7497e7f8e367ca9cde3aaf588f65f69d31106721 /module/vcomponent.scm
parentRestore directory parsing. (diff)
downloadcalp-e13f6bb201dff690208b9cc951b5c098b0d63356.tar.gz
calp-e13f6bb201dff690208b9cc951b5c098b0d63356.tar.xz
Slowly going through and fixing everything.
Diffstat (limited to 'module/vcomponent.scm')
-rw-r--r--module/vcomponent.scm113
1 files changed, 57 insertions, 56 deletions
diff --git a/module/vcomponent.scm b/module/vcomponent.scm
index a106d993..93449c4b 100644
--- a/module/vcomponent.scm
+++ b/module/vcomponent.scm
@@ -82,59 +82,60 @@
(define* (make-vcomponent #:optional path)
(if (not path)
(make-vcomponent)
- (let* ((root (parse-cal-path path))
- (component
- (case (string->symbol (or (attr root "X-HNH-SOURCETYPE") "no-type"))
- ;; == Single ICS file ==
- ;; Remove the abstract ROOT component,
- ;; returning the wanted VCALENDAR component
- ((file)
- ;; TODO test this when an empty file is given.
- (car (children root)))
-
- ;; == Assume vdir ==
- ;; Also removes the abstract ROOT component, but also
- ;; merges all VCALENDAR's children into the a newly
- ;; created VCALENDAR component, and return that component.
- ;;
- ;; TODO the other VCALENDAR components might not get thrown away,
- ;; this since I protect them from the GC in the C code.
- ((vdir)
- (let ((accum (make-vcomponent))
- (ch (children root)))
- (set! (type accum) "VCALENDAR")
-
- (unless (null? ch)
- (for key in (attributes (car ch))
- (set! (attr accum key) (attr (car ch) key))))
-
- (for cal in ch
- (for component in (children cal)
- (case (type component)
- ((VTIMEZONE)
- (unless (find (lambda (z)
- (string=? (attr z "TZID")
- (attr component "TZID")))
- (children accum 'VTIMEZONE))
- (push-child! accum component)))
- (else (push-child! accum component)))))
- ;; return
- accum))
-
- ((no-type) (throw 'no-type))
-
- (else (throw 'something)))))
-
- (parse-dates! component)
-
- (unless (attr component "NAME")
- (set! (attr component "NAME")
- (or (attr component "X-WR-CALNAME")
- (attr root "NAME"))))
-
- (unless (attr component "COLOR")
- (set! (attr component "COLOR")
- (attr root "COLOR")))
-
- ;; return
- component)))
+ (let ((root (parse-cal-path path)))
+ (format #t "root = ~a~%" root )
+ (let* ((component
+ (case (string->symbol (or (attr root "X-HNH-SOURCETYPE") "no-type"))
+ ;; == Single ICS file ==
+ ;; Remove the abstract ROOT component,
+ ;; returning the wanted VCALENDAR component
+ ((file)
+ ;; TODO test this when an empty file is given.
+ (display "Hello\n")
+ (car (children root)))
+
+ ;; == Assume vdir ==
+ ;; Also removes the abstract ROOT component, but also
+ ;; merges all VCALENDAR's children into the a newly
+ ;; created VCALENDAR component, and return that component.
+ ;;
+ ;; TODO the other VCALENDAR components might not get thrown away,
+ ;; this since I protect them from the GC in the C code.
+ ((vdir)
+ (let ((accum (make-vcomponent))
+ (ch (children root)))
+ (set! (type accum) "VCALENDAR")
+
+ (unless (null? ch)
+ (for key in (attributes (car ch))
+ (set! (attr accum key) (attr (car ch) key))))
+
+ (for cal in ch
+ (for component in (children cal)
+ (case (type component)
+ ((VTIMEZONE)
+ (unless (find (lambda (z)
+ (string=? (attr z "TZID")
+ (attr component "TZID")))
+ (children accum 'VTIMEZONE))
+ (push-child! accum component)))
+ (else (push-child! accum component)))))
+ ;; return
+ accum))
+
+ ((no-type) (throw 'no-type)))))
+
+ (display "Here?\n")
+ (parse-dates! component)
+
+ (unless (attr component "NAME")
+ (set! (attr component "NAME")
+ (or (attr component "X-WR-CALNAME")
+ (attr root "NAME"))))
+
+ (unless (attr component "COLOR")
+ (set! (attr component "COLOR")
+ (attr root "COLOR")))
+
+ ;; return
+ component))))