Function: icalendar-attach-validator
icalendar-attach-validator is a byte-compiled function defined in
icalendar-parser.el.gz.
Signature
(icalendar-attach-validator NODE)
Documentation
Additional validator for an icalendar-attach NODE.
Checks that NODE has a correct icalendar-encodingparam and
icalendar-valuetypeparam if its value is an icalendar-binary.
This function is called by icalendar-ast-node-valid-p for
ATTACH 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:attach-validator (node)
"Additional validator for an `icalendar-attach' NODE.
Checks that NODE has a correct `icalendar-encodingparam' and
`icalendar-valuetypeparam' if its value is an `icalendar-binary'.
This function is called by `icalendar-ast-node-valid-p' for
ATTACH nodes; it is not normally necessary to call it directly."
(let* ((value-node (ical:ast-node-value node))
(value-type (ical:ast-node-type value-node))
(valtypeparam (ical:ast-node-first-child-of 'ical:valuetypeparam node))
(encodingparam (ical:ast-node-first-child-of 'ical:encodingparam node)))
(when (eq value-type 'ical:binary)
(unless (and (ical:ast-node-p valtypeparam)
(eq 'ical:binary
(ical:ast-node-value ; unwrap inner printed-value-type
(ical:ast-node-value valtypeparam))))
(ical:signal-validation-error
"`icalendar-binary' attachment requires 'VALUE=BINARY' parameter"
:node node))
(unless (and (ical:ast-node-p encodingparam)
(equal "BASE64" (ical:ast-node-value encodingparam)))
(ical:signal-validation-error
"`icalendar-binary' attachment requires 'ENCODING=BASE64' parameter"
:node node)))
;; success:
node))