Function: icalendar-vevent-validator

icalendar-vevent-validator is a byte-compiled function defined in icalendar-parser.el.gz.

Signature

(icalendar-vevent-validator NODE)

Documentation

Additional validator for an icalendar-vevent NODE.

Checks that NODE has does not have both icalendar-duration and icalendar-dtend properties, and calls icalendar-rrule-validator.

This function is called by icalendar-ast-node-valid-p for VEVENT nodes; it is not normally necessary to call it directly.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/icalendar-parser.el.gz
(defun ical:vevent-validator (node)
  "Additional validator for an `icalendar-vevent' NODE.
Checks that NODE has does not have both `icalendar-duration' and
`icalendar-dtend' properties, and calls `icalendar-rrule-validator'.

This function is called by `icalendar-ast-node-valid-p' for
VEVENT nodes; it is not normally necessary to call it directly."
  (let* ((duration (ical:ast-node-first-child-of 'ical:duration node))
         (dur-value (when duration (ical:ast-node-value
                                     (ical:ast-node-value duration))))
         (dtend (ical:ast-node-first-child-of 'ical:dtend node))
         (dtstart (ical:ast-node-first-child-of 'ical:dtstart node)))
    (when (and dtend duration)
      (ical:signal-validation-error
       (concat "`icalendar-dtend' and `icalendar-duration' properties must "
               "not appear in the same `icalendar-vevent'")
       :node node))
    ;; don't allow time-based durations with dates
    ;; TODO: check that the standard disallows this...?
    (when (and dtstart duration
               (eq 'ical:date (ical:ast-node-type dtstart))
               (or (not (integerp dur-value))
                   (decoded-time-hour dur-value)
                   (decoded-time-minute dur-value)
                   (decoded-time-second dur-value)))
      (ical:signal-validation-error
       (concat "Event with `icalendar-date' value in `icalendar-dtstart' "
               "cannot have time units in `icalendar-duration'")
       :node node))

  (ical:rrule-validator node)
  ;; success:
  node))