From 7dc9e082426cd6c81310c2f78088b5b613bd0c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 25 Jun 2020 18:15:32 +0200 Subject: Add structure for importing events. --- module/vcomponent/parse.scm | 6 ++++-- module/vcomponent/parse/component.scm | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'module/vcomponent') diff --git a/module/vcomponent/parse.scm b/module/vcomponent/parse.scm index 960fb6eb..b20fcfc8 100644 --- a/module/vcomponent/parse.scm +++ b/module/vcomponent/parse.scm @@ -105,17 +105,19 @@ ;; Parse a vdir or ics file at the given path. (define-public (parse-cal-path path) + ;; TODO check (access? path R_OK) ? (define st (stat path)) (define cal (case (stat:type st) [(regular) (let ((comp (call-with-input-file path parse-calendar))) - (set! (attr comp 'X-HNH-SOURCETYPE) "file") + (set! (attr comp 'X-HNH-SOURCETYPE) 'file) comp) ] [(directory) (report-time! "Parsing ~a" path) (let ((comp (parse-vdir path))) - (set! (attr comp 'X-HNH-SOURCETYPE) "vdir") + (set! (attr comp 'X-HNH-SOURCETYPE) 'vdir + (attr comp 'X-HNH-DIRECTORY) path) comp)] [(block-special char-special fifo socket unknown symlink) => (lambda (t) (error "Can't parse file of type " t))])) diff --git a/module/vcomponent/parse/component.scm b/module/vcomponent/parse/component.scm index 69b833dd..f7dbdf71 100644 --- a/module/vcomponent/parse/component.scm +++ b/module/vcomponent/parse/component.scm @@ -109,7 +109,7 @@ (cond [(and=> (hashq-ref params 'VALUE) string->symbol) => get-parser] - [(memv key '(COMPLETED DTEND DUE DTSTART RECURRENCE-ID RDATE + [(memv key '(COMPLETED DTEND DUE DTSTART RECURRENCE-ID RDATE CREATED DTSTAMP LAST-MODIFIED ;; only on VALARM ACKNOWLEDGED @@ -142,7 +142,10 @@ (lambda (params value) (let ((v (car ((get-parser 'TEXT) params value)))) (unless (and (string? v) (string=? "2.0" v)) - (warning "File of unsuported version. Proceed with caution"))))] + #f + ;; (warning "File of unsuported version. Proceed with caution") + ) + v))] [(memv key '(TRANSP)) (enum-parser '(OPAQUE TRANSPARENT))] -- cgit v1.2.3