From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 2J4rK1Wp0mGaWAEAgWs5BA (envelope-from ) for ; Mon, 03 Jan 2022 08:44:21 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id iA2IKFWp0mF+GgAA9RJhRA (envelope-from ) for ; Mon, 03 Jan 2022 08:44:21 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D9FA931909 for ; Mon, 3 Jan 2022 08:44:20 +0100 (CET) Received: from localhost ([::1]:39046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4I0x-0006oC-T5 for larch@yhetil.org; Mon, 03 Jan 2022 02:44:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4Hya-0006nh-QO for emacs-orgmode@gnu.org; Mon, 03 Jan 2022 02:41:56 -0500 Received: from mail-sender-5.unibw-hamburg.de ([139.11.10.105]:37308 helo=premail.unibw-hamburg.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4HyY-00069j-Ik for emacs-orgmode@gnu.org; Mon, 03 Jan 2022 02:41:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hsu-hh.de; s=hsu-hh_de; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID: Subject:To:From:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=5QkBiqtGiJPv9ZDyJ+u30D6LVAmWuGVb8kgBYHnyN7U=; t=1641195707; x=1642059707; b=tNW8ryel3TKpL1tlev352B+5KCuhG/059lkUGVSdhvakbTxyrXdq2xVWqLoeVx5tkG237EEGmIE CEXyDSURxuLOjplCH/rP2VEtU2uInyo4OlQV7gZfHqNnnwQPos7F06ccLuvPuXqrbFTR1Qbw9ONjr +Y9OKUb6Bup6XM+Yo1MHPixApwM+Wbyis0aLq6ijCfumgKSO1jAVWWGkA+2hK8emt/TIxHRDUdm5n 69wiSMPULpM8UwF32e0OMwgLMDJAElAlq5VaxfGXmkEM5Oc0DLk7sJou8Nmb5BbEqpA/WMTYBKW5z wVk4AXLAqvNhSPRDag5ZHl1IdsweH4LuOpow==; Received: from rzav4.unibw-hamburg.de ([139.11.12.54]:19442) by premail.unibw-hamburg.de with esmtp (HSU Mailserver) (envelope-from ) id 1n4Hyl-0005fB-FK for emacs-orgmode@gnu.org; Mon, 03 Jan 2022 08:41:46 +0100 X-IronPort-AV: E=Sophos;i="5.88,256,1635199200"; d="scan'208";a="70772653" Received: from mailcluster-1.unibw-hamburg.de (HELO premail.unibw-hamburg.de) ([139.11.5.101]) by rzav4.unibw-hamburg.de with ESMTP; 03 Jan 2022 08:41:46 +0100 Received: from dynamic-077-006-195-116.77.6.pool.telefonica.de ([77.6.195.116]:45652 helo=localhost.localdomain) by premail.unibw-hamburg.de with esmtpsa (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (HSU Mailserver) (envelope-from ) id 1n4Hyl-0005dq-3M; Mon, 03 Jan 2022 08:41:46 +0100 Date: Mon, 3 Jan 2022 08:41:41 +0100 From: Detlef Steuer To: emacs-orgmode@gnu.org Subject: Re: [patch] improved: add TTL as defcustom to ox-icalendar Message-ID: <20220103084141.72d2f384@hsu-hh.de> In-Reply-To: References: <20211230225919.1a660666@hsu-hh.de> <20220102142849.0af72bcb@hsu-hh.de> Organization: HSU X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.31; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/cKjxwX2pi7.I2jPr6Tyrz/v" X-HSU-Virusscan: Routed to first Viruswall X-Brisant: Sender steuer@hsu-hh.de X-HSU-Virusscan: First Viruswall passed X-Authenticated-Sender: 13438/77.6.195.116 X-HSU-Virusscan: Routed to second Viruswall (Cisco Ironport ESAV) X-Brisant: Sender steuer@hsu-hh.de Received-SPF: pass client-ip=139.11.10.105; envelope-from=prvs=000205522c=steuer@hsu-hh.de; helo=premail.unibw-hamburg.de X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1641195861; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=5QkBiqtGiJPv9ZDyJ+u30D6LVAmWuGVb8kgBYHnyN7U=; b=tMW+uKm0zFFVJes4bUy8ntFf8DvteiZQacMt+CxJWe+QhnLsGpRyUuMFzx5SN79hkCz/KW ZaFB23W4LEuVgtwGPnjWlrJHiRZR9KEvZ9MpIwScJss1QeHCeUnqGIUcGRCiidikeDK3iX yEmv+IOkHx0TfhI6RjoKfwBykmbpJXOXo6w1BdJnHqIB+4UkWVCYoR/C11ij0zll1dbkVH YCbSLkJpbD+m4g+PurZLKigBuv8sjGVUWOoC9+FSTa5xrSpIgv/S/rQPlP22dJI8bB8VWC 7wEwKadb3TXp51Bc1imX6v7uG75bcJuWIjf4vAeTKBIsZ/xJoTjxgWUmwbmRGQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641195861; a=rsa-sha256; cv=none; b=S4//Ch/HHKusJ5gWDBESEtPxlHVIlpYv26hguGRGT/9mBAgdavkDedvI9D8gQVHWsl2re2 9lb5zPUXcFHQgtycZnXZ5JUrlKB4taOeCZVBTJGEyAI9tcu6w6XZFRPsBc8KRCHc3DOdGS j3vakw08Dl69Wp3kj5Cb3GHypEsgoWi/yNub2aGb9qoqvhkp2v0ZgwfIZowN3Dlxswp7t6 zZ2NPxPDsI8S8GT6lHU5UhAmI7sC38hfYU/dYcoyXB2TdJhPGAMSFoR/woM6zJIlWse93u 6JIGUgzYK+OeC9uRs/I8h0QSuqiaN2yEfSm0pbV09Er0i/+nO7ChBelnbEFu3g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=hsu-hh.de header.s=hsu-hh_de header.b=tNW8ryel; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.89 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=hsu-hh.de header.s=hsu-hh_de header.b=tNW8ryel; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: D9FA931909 X-Spam-Score: -3.89 X-Migadu-Scanner: scn0.migadu.com X-TUID: EoeWlxrxbl8m --MP_/cKjxwX2pi7.I2jPr6Tyrz/v Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Thank you for the hints. Attached a diff -u version. The patch in principle is unrelated to nextcloud. That's just my use case. The addiditional TTL setting gives a hint to clients when to reload an imported ics file that was exported from org. Is there any document how to setup an org-mode developer environment? Normally I use git, but I even struggled to use org from elpa instead of the built-in version, so I avoided touching this house of cards :-) Probably I should use a git clone instead of elpa, if I want to work on org? Thx for the feedback! Detlef Am Mon, 3 Jan 2022 13:08:54 +0700 schrieb Max Nikulin : > On 02/01/2022 20:28, Detlef Steuer wrote: > > > >> This is my first try ever to contribute anything in elisp. > > Thanks for the patch. It is tracked on https://updates.orgmode.org/ > > It is easier to review and to apply a patch when it it is prepared in > context format ("-u" option of diff). Several additional lines of > code above and below changed ones makes the patch more tolerate to > unrelated changes in the same file. It is a hint for humans as well. > > See info "(diffutils) Tips for Patch Producers" > https://www.gnu.org/software/diffutils/manual/html_node/Tips-for-Patch-Producers.html > or "NOTES FOR PATCH SENDERS" section in "man patch". > > If you have never used git (or other VCS) before then it is likely an > overkill for a single patch, diff output with manually added > description is OK. However you may find such tool rather convenient > as number of changes will grow. See > https://orgmode.org/worg/org-contribute.html for some hints addressed > to contributors. > > I am not a nextcloud or org-icalendar user, so while I expect that > suggested change is an improvement, I can say nothing concerning the > code. > > --MP_/cKjxwX2pi7.I2jPr6Tyrz/v Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=addttl.patch --- 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. --MP_/cKjxwX2pi7.I2jPr6Tyrz/v--