emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 16e51ad 2/3: allow party crashers to respond to ical events


From: Lars Ingebrigtsen
Subject: master 16e51ad 2/3: allow party crashers to respond to ical events
Date: Fri, 1 Oct 2021 08:09:24 -0400 (EDT)

branch: master
commit 16e51ad6bfa9275ebf9fc2df49eb724099ca2764
Author: Alexandre Duret-Lutz <adl@lrde.epita.fr>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    allow party crashers to respond to ical events
    
    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 | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el
index 514feff..348da12 100644
--- a/lisp/gnus/gnus-icalendar.el
+++ b/lisp/gnus/gnus-icalendar.el
@@ -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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]