From a071bf9a56241aa743e1be21bccbb4cb72b189f2 Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Sat, 22 Aug 2026 16:48:07 -0400 Subject: pim: invite, and a way to say what you mean pim/invite makes an event and, when it names attendees, sends the invitation -- which on a caldav server with auto-schedule is the same act. -p writes the object to standard output instead, so it can go to upas/marshal as iMIP, into a directory an ical/fs is serving, or nowhere in particular. There is no separate verb for inviting because to a calendar there is no separate thing. It writes the tree's own key: value form rather than icalendar. The first version spelled SUMMARY: by hand and got "lunch, then a walk" wrong: a comma is a separator there and wants escaping. Parsing with go-ical and generating by hand is the wrong asymmetry, so calfs grew Compose, and now the same shape the tree emits is the shape it accepts. The one UID we ever mint -- as organiser we own the event -- is minted there too. pim/invites lists what is waiting for an answer, which is what makes pim/rsvp usable: it walks the date tree rather than every event, since an invitation you never answered last March is not news. agenda and show take -d date now, via seconds(1), which parses a human date where date(1) only formats one. Co-Authored-By: Claude Opus 5 --- pim/lib/cal/backend.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'pim/lib/cal/backend.go') diff --git a/pim/lib/cal/backend.go b/pim/lib/cal/backend.go index 6ed488c..91f793a 100644 --- a/pim/lib/cal/backend.go +++ b/pim/lib/cal/backend.go @@ -1,6 +1,10 @@ package cal -import "time" +import ( + "time" + + "github.com/emersion/go-ical" +) // A Backend supplies a calendar's events and, where the protocol allows // it, accepts changes back. @@ -49,6 +53,17 @@ type Identity interface { Me() []string } +// Creator is implemented by a backend that can add an event. +// +// It takes a whole object rather than fields, because that is what the +// protocols underneath take: CalDAV PUTs an entire icalendar object and +// JMAP patches a whole JSCalendar one. Building an event field by field +// and hoping the server knows when you have finished is a shape that +// fits neither. +type Creator interface { + Create(c *ical.Calendar) error +} + // RSVPer is implemented by a backend that can answer an invitation. // // Accepting is two writes: update your own copy, and tell the organiser. -- cgit v1.2.3