blob: cf4f6c8d05ceb525c103865eb09254334fb70e60 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
;;; Commentary:
;;; Module for writing components to the vdir storage format.
;;; Currently also has some cases for "big" icalendar files,
;;; but those are currently unsupported.
;;; Code:
(define-module (output vdir)
:use-module (util)
:use-module (output ical)
:use-module (vcomponent)
:use-module ((util io) :select (with-atomic-output-to-file))
)
(define / file-name-separator-string)
(define-public (save-event event)
(define calendar (parent event))
(case (prop calendar '-X-HNH-SOURCETYPE)
[(file)
(error "Importing into direct calendar files not supported")]
[(vdir)
(let* ((uid (or (prop event 'UID) (uuidgen))))
(set! (prop event 'UID) uid)
(with-atomic-output-to-file
(string-append (prop calendar '-X-HNH-DIRECTORY) / uid ".ics")
(lambda () (print-components-with-fake-parent (list event))))
uid)]
[else
(error "Source of calendar unknown, aborting.")
]))
|