Function: message-signed-or-encrypted-p
message-signed-or-encrypted-p is a byte-compiled function defined in
message.el.gz.
Signature
(message-signed-or-encrypted-p &optional DONT-EMULATE-MIME HANDLES)
Documentation
Say whether the current buffer contains signed or encrypted message.
If DONT-EMULATE-MIME is nil, this function does the MIME emulation on messages that don't conform to PGP/MIME described in RFC2015. HANDLES is for the internal use.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/message.el.gz
(defun message-signed-or-encrypted-p (&optional dont-emulate-mime handles)
"Say whether the current buffer contains signed or encrypted message.
If DONT-EMULATE-MIME is nil, this function does the MIME emulation on
messages that don't conform to PGP/MIME described in RFC2015. HANDLES
is for the internal use."
(unless handles
(let ((mm-decrypt-option 'never)
(mm-verify-option 'never))
(if (setq handles (mm-dissect-buffer nil t))
(unless dont-emulate-mime
(mm-uu-dissect-text-parts handles))
(unless dont-emulate-mime
(setq handles (mm-uu-dissect))))))
;; Check text/plain message in which there is a signed or encrypted
;; body that has been encoded by B or Q.
(unless (or handles dont-emulate-mime)
(let ((cur (current-buffer))
(mm-decrypt-option 'never)
(mm-verify-option 'never))
(with-temp-buffer
(insert-buffer-substring cur)
(when (setq handles (mm-dissect-buffer t t))
(if (and (bufferp (car handles))
(equal (mm-handle-media-type handles) "text/plain"))
(progn
(erase-buffer)
(insert-buffer-substring (car handles))
(mm-decode-content-transfer-encoding
(mm-handle-encoding handles))
(mm-destroy-parts handles)
(setq handles (mm-uu-dissect)))
(mm-destroy-parts handles)
(setq handles nil))))))
(when handles
(prog1
(catch 'found
(dolist (handle (if (stringp (car handles))
(if (member (car handles)
'("multipart/signed"
"multipart/encrypted"))
(throw 'found t)
(cdr handles))
(list handles)))
(if (stringp (car handle))
(when (message-signed-or-encrypted-p dont-emulate-mime handle)
(throw 'found t))
(when (and (bufferp (car handle))
(equal (mm-handle-media-type handle)
"message/rfc822"))
(with-current-buffer (mm-handle-buffer handle)
(when (message-signed-or-encrypted-p dont-emulate-mime)
(throw 'found t)))))))
(mm-destroy-parts handles))))