]> git.eshelyaron.com Git - emacs.git/commitdiff
allow party crashers to respond to ical events
authorAlexandre Duret-Lutz <adl@lrde.epita.fr>
Wed, 22 Sep 2021 14:38:42 +0000 (16:38 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 1 Oct 2021 12:07:35 +0000 (14:07 +0200)
If an ical invitation is sent to a mailing list, the recipients
are probably not listed as attendees.  However there are
legitimate situations where these unlisted (or indirectly listed)
recipients are still expected to respond.  RFC5546 allows that,
calling those respondents "party crashers".

* lisp/gnus/gnus-icalendar.el
(gnus-icalendar-event:inline-reply-buttons): Display the response
buttons even if the user was not found in the list of attendees,
but change the labels of those buttons to make clear they are
not explicitly invited.
(gnus-icalendar-event--build-reply-event-body): Add an attendee
line for the user in case one was not found.

lisp/gnus/gnus-icalendar.el

index 514feff284713e177965d4e6b0278517ee996b85..348da12db110016d96b7c696107814e332d7c427 100644 (file)
@@ -345,10 +345,16 @@ status will be retrieved from the first matching attendee record."
 
       (mapc #'process-event-line (split-string ical-request "\n"))
 
+      ;; RFC5546 refers to uninvited attendees as "party crashers".
+      ;; This situation is common if the invitation is sent to a group
+      ;; of people via a mailing list.
       (unless (gnus-icalendar-find-if (lambda (x) (string-match "^ATTENDEE" x))
                                      reply-event-lines)
         (lwarn 'gnus-icalendar :warning
-               "Could not find an event attendee matching given identity"))
+               "Could not find an event attendee matching given identity")
+        (push (format "ATTENDEE;RSVP=TRUE;PARTSTAT=%s;CN=%s:MAILTO:%s"
+                      attendee-status user-full-name user-mail-address)
+              reply-event-lines))
 
       (mapconcat #'identity `("BEGIN:VEVENT"
                               ,@(nreverse reply-event-lines)
@@ -902,10 +908,16 @@ These will be used to retrieve the RSVP information from ical events."
   (gnus-icalendar-event:sync-to-org event gnus-icalendar-reply-status))
 
 (cl-defmethod gnus-icalendar-event:inline-reply-buttons ((event gnus-icalendar-event) handle)
-  (when (gnus-icalendar-event:rsvp event)
-    `(("Accept" gnus-icalendar-reply (,handle accepted ,event))
-      ("Tentative" gnus-icalendar-reply (,handle tentative ,event))
-      ("Decline" gnus-icalendar-reply (,handle declined ,event)))))
+  (let ((accept-btn "Accept")
+        (tentative-btn "Tentative")
+        (decline-btn "Decline"))
+    (unless (gnus-icalendar-event:rsvp event)
+      (setq accept-btn "Uninvited Accept"
+            tentative-btn "Uninvited Tentative"
+            decline-btn "Uninvited Decline"))
+    `((,accept-btn gnus-icalendar-reply (,handle accepted ,event))
+      (,tentative-btn gnus-icalendar-reply (,handle tentative ,event))
+      (,decline-btn gnus-icalendar-reply (,handle declined ,event)))))
 
 (cl-defmethod gnus-icalendar-event:inline-reply-buttons ((_event gnus-icalendar-event-reply) _handle)
   "No buttons for REPLY events."