Function: gnus-icalendar-event-from-ical
gnus-icalendar-event-from-ical is a byte-compiled function defined in
gnus-icalendar.el.gz.
Signature
(gnus-icalendar-event-from-ical VCALENDAR &optional IDS)
Documentation
Initialize an event instance with the first icalendar-vevent in VCALENDAR.
IDS should be a list of strings representing names and email addresses
by which to identify an icalendar-attendee in the event as the
recipient.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-icalendar.el.gz
(defun gnus-icalendar-event-from-ical (vcalendar &optional ids)
"Initialize an event instance with the first `icalendar-vevent' in VCALENDAR.
IDS should be a list of strings representing names and email addresses
by which to identify an `icalendar-attendee' in the event as the
recipient."
(ical:with-component vcalendar
((ical:vevent vevent)
(ical:method :value method))
(ical:with-component vevent
((ical:organizer :value organizer)
(ical:attendee :all attendees)
(ical:summary :value summary)
(ical:description :value description)
(ical:dtstart :value dtstart)
(ical:dtend :value dtend)
(ical:location :value location)
(ical:rrule :value rrule)
(ical:uid :value uid))
(let* ((attendee (when ids (gnus-icalendar-event--find-attendee attendees ids)))
(rsvp-p (ical:with-param-of attendee 'ical:rsvpparam))
;; RFC5546: default ROLE is REQ-PARTICIPANT
(role (when attendee
(or (ical:with-param-of attendee 'ical:roleparam)
"REQ-PARTICIPANT")))
(participation-type (pcase role
("REQ-PARTICIPANT" 'required)
("OPT-PARTICIPANT" 'optional)
(_ 'non-participant)))
(req/opt (gnus-icalendar-event--attendees-by-type attendees))
(args
(list :method method
:organizer (when organizer (ical:strip-mailto organizer))
:summary summary
:description description
:location location
:recur rrule
:start-time (encode-time dtstart)
:end-time (encode-time dtend)
:rsvp rsvp-p
:participation-type participation-type
:req-participants (car req/opt)
:opt-participants (cadr req/opt)
:uid (or uid ""))) ; UID must be a string
(event-class (pcase method
("REQUEST" 'gnus-icalendar-event-request)
("CANCEL" 'gnus-icalendar-event-cancel)
("REPLY" 'gnus-icalendar-event-reply)
(_ 'gnus-icalendar-event))))
;; Initialize and return the instance:
(apply
#'make-instance
event-class
(cl-loop for slot in (eieio-class-slots event-class)
for keyword = (intern
(format ":%s" (eieio-slot-descriptor-name slot)))
when (plist-member args keyword)
append (list keyword (plist-get args keyword))))))))