agendafs

A filesystem for your calendar.

git clone git://mccd.space/agendafs
commit f364188230c71eb72a1453ad9792bd4f8df3cc54
parent 1f355502c3832b03440cd0f5fd04afee90617c4f
Author: Marc Coquand <marc@coquand.email>
Date:   Mon,  2 Jun 2025 11:47:59 +0100

Add tip

Diffstat:
MREADME.md | 50++++++++++++++++++++++++++++++++++++++++++++++++++
Mmain.c | 9+++++----
2 files changed, 55 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
@@ -82,8 +82,58 @@ mkdir /tmp/journal
 export CALDAVFS_ICS_DIR=~/.calendars/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/
 # -d -f to launch in debug mode, see libfuse for more options
 mount_caldavfs -d -f /tmp/journal
+# Or if you are for some reason not using rc-shell, replace
+# `{date +'...'} with $(date +'...')
+new_file=/tmp/journal/`{date +'%Y%m%d-%H:%M.txt'}
+touch $new_file
+$EDITOR $new_file
 ```
 
+The last part can be moved to a separate file.
+
+### VJOURNAL support
+
+To have vjournal support on Nextcloud, I needed to create the calendar manually...
+
+```
+curl -X MKCALENDAR \
+  -u me:me \
+  -H 'Content-Type: application/xml; charset=utf-8' \
+  -d "<?xml version='1.0' encoding='UTF-8'?>
+<mkcalendar xmlns='urn:ietf:params:xml:ns:caldav'>
+  <set>
+    <prop>
+      <displayname xmlns='DAV:'>Journal</displayname>
+      <calendar-description xmlns='urn:ietf:params:xml:ns:caldav'>Calendar with VJOURNAL support</calendar-description>
+      <supported-calendar-component-set xmlns='urn:ietf:params:xml:ns:caldav'>
+        <comp name='VEVENT'/>
+        <comp name='VTODO'/>
+        <comp name='VJOURNAL'/>
+      </supported-calendar-component-set>
+    </prop>
+  </set>
+</mkcalendar>" \
+  'https://my-nextcloud-server/remote.php/dav/calendars/me/journal'
+```
+
+
+## Format
+
+### VJOURNAL
+
+`VJOURNAL` entries have the following format
+
+file name: creation date (`%Y%m%d-%H:%M.txt`)
+
+```
+summary
+---
+Longer text
+```
+
+The `---` are mandatory.
+
+
 ## Status
 
 POC stage, still very early alpha.
diff --git a/main.c b/main.c
@@ -682,6 +682,7 @@ journal_entry_to_ical(const journal_entry *entry)
 	asprintf(&ical,
 		 "BEGIN:VCALENDAR\n"
 		 "PRODID:caldavfs\n"
+		 "VERSION:2.0\n"
 		 "BEGIN:VJOURNAL\n"
 		 "UID:%s\n"
 		 "DTSTAMP:%s\n"
@@ -1147,14 +1148,14 @@ load_caldavfs_environment()
 		return -1;
 	}
 
-	wordexp_t p;
-	if (wordexp(ics_dir_env, &p, 0) != 0 || p.we_wordc == 0) {
+	wordexp_t expanded;
+	if (wordexp(ics_dir_env, &expanded, 0) != 0 || expanded.we_wordc == 0) {
 		fprintf(stderr, "Failed to expand CALDAVFS_ICS_DIR\n");
-		wordfree(&p);
+		wordfree(&expanded);
 		return -1;
 	}
 
-	char *expanded_path = p.we_wordv[0];
+	char *expanded_path = expanded.we_wordv[0];
 
 	struct stat s;
 	if (stat(expanded_path, &s) == 0 && S_ISDIR(s.st_mode)) {