--- ox-icalendar.el.orig 2022-01-02 13:38:17.586027624 +0100 +++ ox-icalendar.el 2022-01-02 14:12:10.446157056 +0100 @@ -265,6 +265,19 @@ (const :tag "Universal time" ":%Y%m%dT%H%M%SZ") (string :tag "Explicit format"))) +(defcustom org-icalendar-ttl "PT1H" + "The time to life for the exported calendar. +Subscribing clients to the exported ics file can derive the time interval +to read the file again from the server. One example of such a client is +the nextcloud calendar, which respects the setting of +X-PUBLISHED-TTL, i.e. X-PUBLISHED-TTL:PT1H . + +See https://icalendar.org/iCalendar-RFC-5545/3-8-2-5-duration.html +for a complete description of possiblee values of this option. I.e. +PT1H stands for 1 hour, PT0H27M34S for 0 hours, 27 minutes and 34 seconds." + :group 'org-export-icalendar + :type 'string) + (defvar org-icalendar-after-save-hook nil "Hook run after an iCalendar file has been saved. This hook is run with the name of the file as argument. A good @@ -300,7 +313,8 @@ (:icalendar-store-UID nil nil org-icalendar-store-UID) (:icalendar-timezone nil nil org-icalendar-timezone) (:icalendar-use-deadline nil nil org-icalendar-use-deadline) - (:icalendar-use-scheduled nil nil org-icalendar-use-scheduled)) + (:icalendar-use-scheduled nil nil org-icalendar-use-scheduled) + (:icalendar-ttl nil nil org-icalendar-ttl)) :filters-alist '((:filter-headline . org-icalendar-clear-blank-lines)) :menu-entry @@ -828,24 +842,29 @@ (cadr (current-time-zone))) ;; Description. (org-export-data (plist-get info :title) info) + ;; TTL + org-icalendar-ttl contents)) -(defun org-icalendar--vcalendar (name owner tz description contents) +(defun org-icalendar--vcalendar (name owner tz description ttl contents) "Create a VCALENDAR component. -NAME, OWNER, TZ, DESCRIPTION and CONTENTS are all strings giving, +NAME, OWNER, TZ, DESCRIPTION, TTL and CONTENTS are all strings giving, respectively, the name of the calendar, its owner, the timezone -used, a short description and the other components included." +used, a short description, the time-to-live resp. refresh period and +the other components included." (concat (format "BEGIN:VCALENDAR VERSION:2.0 X-WR-CALNAME:%s PRODID:-//%s//Emacs with Org mode//EN X-WR-TIMEZONE:%s X-WR-CALDESC:%s +X-PUBLISHED-TTL:%s CALSCALE:GREGORIAN\n" (org-icalendar-cleanup-string name) (org-icalendar-cleanup-string owner) (org-icalendar-cleanup-string tz) - (org-icalendar-cleanup-string description)) + (org-icalendar-cleanup-string description) + (org-icalendar-cleanup-string ttl)) contents "END:VCALENDAR\n")) @@ -974,6 +993,7 @@ user-full-name (or (org-string-nw-p org-icalendar-timezone) (cadr (current-time-zone))) org-icalendar-combined-description + org-icalendar-ttl contents))) (run-hook-with-args 'org-icalendar-after-save-hook file))) @@ -998,6 +1018,8 @@ (cadr (current-time-zone))) ;; Description. org-icalendar-combined-description + ;; TTL (Refresh period) + org-icalendar-ttl ;; Contents. (concat ;; Agenda contents.