aboutsummaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-11-11 14:11:55 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-11-11 14:11:55 +0100
commit57c0e02239cfee603aec88382d857d03e80ddc33 (patch)
treeb6065e9ca93409696ac9bbe6ea0f756253b368f6 /module
parentWork on ICS output. (diff)
downloadcalp-57c0e02239cfee603aec88382d857d03e80ddc33.tar.gz
calp-57c0e02239cfee603aec88382d857d03e80ddc33.tar.xz
Add check for repeated VEVENT:s in vdir.
Diffstat (limited to 'module')
-rw-r--r--module/vcomponent/parse.scm11
1 files changed, 11 insertions, 0 deletions
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))