aboutsummaryrefslogtreecommitdiff
path: root/module/vcomponent/vdir/save-delete.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-12-21 16:17:28 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-12-22 22:58:30 +0100
commitd00fea566004e67161ee45246b239fff5d416b0e (patch)
tree5641c0c0d0e78b046b6045ed2440512f12259560 /module/vcomponent/vdir/save-delete.scm
parentComplete rewrite of use2dot (diff)
downloadcalp-d00fea566004e67161ee45246b239fff5d416b0e.tar.gz
calp-d00fea566004e67161ee45246b239fff5d416b0e.tar.xz
Cleanup modules.
Primarly this moves all vcompenent input and output code to clearly labeled modules, instead of being spread out. At the same time it also removes a handfull of unused procedures.
Diffstat (limited to 'module/vcomponent/vdir/save-delete.scm')
-rw-r--r--module/vcomponent/vdir/save-delete.scm40
1 files changed, 0 insertions, 40 deletions
diff --git a/module/vcomponent/vdir/save-delete.scm b/module/vcomponent/vdir/save-delete.scm
deleted file mode 100644
index b3c7f9c5..00000000
--- a/module/vcomponent/vdir/save-delete.scm
+++ /dev/null
@@ -1,40 +0,0 @@
-;;; Commentary:
-;;; Module for writing components to the vdir storage format.
-;;; Currently also has some cases for "big" icalendar files,
-;;; but those are currently unsupported.
-
-;;; TODO generalize save-event and remove-event into a general interface,
-;;; which different database backends can implement. Actually, do that for all
-;;; loading and writing.
-
-;;; Code:
-
-(define-module (vcomponent vdir save-delete)
- :use-module (calp util)
- :use-module ((calp util exceptions) :select (assert))
- :use-module (vcomponent ical output)
- :use-module (vcomponent)
- :use-module ((calp util io) :select (with-atomic-output-to-file))
- )
-
-
-(define-public (save-event event)
- (define calendar (parent event))
-
- (assert (eq? 'vdir (prop calendar '-X-HNH-SOURCETYPE)))
-
- (let* ((uid (or (prop event 'UID) (uuidgen))))
- (set! (prop event 'UID) uid
- ;; TODO use existing filename if present?
- (prop event '-X-HNH-FILENAME) (path-append
- (prop calendar '-X-HNH-DIRECTORY)
- (string-append uid ".ics")))
- (with-atomic-output-to-file (prop event '-X-HNH-FILENAME)
- (lambda () (print-components-with-fake-parent (list event))))
- uid))
-
-
-(define-public (remove-event event)
- (define calendar (parent event))
- (assert (eq? 'vdir (prop calendar '-X-HNH-SOURCETYPE)))
- (delete-file (prop event '-X-HNH-FILENAME)))