From 57c0e02239cfee603aec88382d857d03e80ddc33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 11 Nov 2019 14:11:55 +0100 Subject: Add check for repeated VEVENT:s in vdir. --- module/vcomponent/parse.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'module') diff --git a/module/vcomponent/parse.scm b/module/vcomponent/parse.scm index 12d1f011..288ba852 100644 --- a/module/vcomponent/parse.scm +++ b/module/vcomponent/parse.scm @@ -268,6 +268,17 @@ row ~a column ~a ctx = ~a (reduce (lambda (item calendar) (assert (eq? 'VCALENDAR (type calendar))) (assert (eq? 'VCALENDAR (type item))) + + (unless (= 1 (length (filter (lambda (e) (eq? 'VEVENT (type e))) + (children item)))) + (format (current-error-port) + "WARNING: File contains more that 1 VEVENT~%~a~%" + (attr item 'X-HNH-FILENAME))) + + ;; TODO The vdir standard says that each file should contain + ;; EXACTLY one event. It can however contain multiple VEVENT + ;; components, but they are still the same event. Probable exceptions + ;; to a recurrence rule. (for child in (children item) (assert (memv (type child) '(VTIMEZONE VEVENT))) (add-child! calendar child)) -- cgit v1.2.3