a2590612fbf0b7f08b6a8dd3e3af9cb834ce46ae
[microbotany.git] / delete.scm
1 ;; Delete account
2
3 (lambda (uri)
4   (import (chicken file)
5           (chicken pathname)
6           (chicken string)
7           uri-common)
8   (let ((query (uri-query uri)))
9     (serve-document-header (ext->mime "gmi"))
10     (if (null? query)
11         (print "No account specified.")
12         (let* ((hash (symbol->string (caar query)))
13                (account-file (make-pathname "accounts" hash)))
14           (if (file-exists? account-file)
15               (begin
16                 (delete-file account-file)
17                 (print "Account successfully deleted."))
18               (print "Attempted to delete non-existent account."))))
19     (print "\n=> /microbotany/ Return to μBotany")))