Function: gnus-icalendar-event--build-reply
gnus-icalendar-event--build-reply is a byte-compiled function defined
in gnus-icalendar.el.gz.
Signature
(gnus-icalendar-event--build-reply VCALENDAR STATUS IDS &optional COMMENT)
Documentation
Return an icalendar-vcalendar based on VCALENDAR with updated STATUS.
STATUS should one of 'accepted, 'declined, or 'tentative. The
recipient whose participation status is updated to STATUS is identified
in EVENT by finding an icalendar-attendee whose name or email address
matches one of the strings in IDS. If no such attendee is found, a new
icalendar-attendee is added from the values of user-mail-address and
user-full-name(var)/user-full-name(fun). COMMENT, if provided, will be added as an
icalendar-comment to the returned event.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-icalendar.el.gz
;;;
;;; gnus-icalendar-event-reply
;;;
(defun gnus-icalendar-event--build-reply (vcalendar status ids &optional comment)
"Return an `icalendar-vcalendar' based on VCALENDAR with updated STATUS.
STATUS should one of \\='accepted, \\='declined, or \\='tentative. The
recipient whose participation status is updated to STATUS is identified
in EVENT by finding an `icalendar-attendee' whose name or email address
matches one of the strings in IDS. If no such attendee is found, a new
`icalendar-attendee' is added from the values of `user-mail-address' and
`user-full-name'. COMMENT, if provided, will be added as an
`icalendar-comment' to the returned event."
(let ((summary-status (capitalize (symbol-name status)))
(attendee-status (upcase (symbol-name status)))
recipient)
(ical:with-component vcalendar
((ical:vtimezone :all tz-nodes)
(ical:vevent :first vevent))
(ical:with-component vevent
((ical:summary :value summary)
(ical:attendee :all attendees)
(ical:uid :value uid)
(ical:comment :value old-comment)
;; The nodes below are copied unchanged to the reply. Not all
;; of them are mandatory, but they are often present in other
;; clients' replies. Can be helpful for debugging, too.
(ical:organizer :first organizer-node)
(ical:dtstart :first dtstart-node)
(ical:dtend :first dtend-node)
(ical:duration :first duration-node)
(ical:location :first location-node)
(ical:sequence :first sequence-node)
(ical:recurrence-id :first recid-node))
(setq recipient (gnus-icalendar-event--find-attendee attendees ids))
(if recipient
(ical:with-property recipient
((ical:partstatparam :first partstat-node))
(ical:ast-node-set-value partstat-node attendee-status))
;; 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.
(lwarn 'gnus-icalendar :warning
"Could not find a matching event attendee; creating new.")
(setq recipient
(ical:make-property ical:attendee
(concat "mailto:" user-mail-address)
(ical:partstatparam attendee-status)
(ical:cnparam user-full-name)))
(push recipient attendees))
;; Build the reply:
(ical:make-vcalendar
(ical:method "REPLY")
(@ tz-nodes)
(ical:vevent
(ical:uid uid)
recid-node
sequence-node
organizer-node
dtstart-node
dtend-node
duration-node
location-node
(ical:summary
(if (string-match "^[^:]+:" summary)
(replace-match (format "\\&%s: " summary-status) t nil summary)
summary))
(ical:comment (or comment old-comment))
(@ attendees)))))))