Function: mh-insert-mime-security-button

mh-insert-mime-security-button is a byte-compiled function defined in mh-mime.el.gz.

Signature

(mh-insert-mime-security-button HANDLE)

Documentation

Display buttons for PGP message, HANDLE.

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-mime.el.gz
(defun mh-insert-mime-security-button (handle)
  "Display buttons for PGP message, HANDLE."
  (let* ((protocol (mm-handle-multipart-ctl-parameter handle 'protocol))
         (crypto-type (or (nth 2 (assoc protocol mm-verify-function-alist))
                          (nth 2 (assoc protocol mm-decrypt-function-alist))
                          "Unknown"))
         begin end face)
    ;; These vars are passed by dynamic-scoping to
    ;; mh-mime-security-button-line-format-alist via gnus-eval-format.
    (mh-dlet* ((type (concat crypto-type
                             (if (equal (car handle) "multipart/signed")
                                 " Signed" " Encrypted")
                             " Part"))
               (info (or (mm-handle-multipart-ctl-parameter
                          handle 'gnus-info)
                         "Undecided"))
               (details (mm-handle-multipart-ctl-parameter
                         handle 'gnus-details))
               pressed-details)
      (setq details (if details (concat "\n" details) ""))
      (setq pressed-details (if mh-mime-security-button-pressed details ""))
      (setq face (mh-mime-security-button-face info))
      (unless (bolp) (insert "\n"))
      (setq begin (point))
      (gnus-eval-format
       mh-mime-security-button-line-format
       mh-mime-security-button-line-format-alist
       `(keymap ,mh-mime-security-button-map
                mh-button-pressed ,mh-mime-security-button-pressed
                mh-callback mh-mime-security-press-button
                mh-line-format ,mh-mime-security-button-line-format
                mh-data ,handle))
      (setq end (point))
      (widget-convert-button 'link begin end
                             :mime-handle handle
                             :action 'mh-widget-press-button
                             :button-keymap mh-mime-security-button-map
                             :button-face face
                             :help-echo "Mouse-2 click or press RET (in show buffer) to see security details.")
      (dolist (ov (overlays-in begin end))
        (overlay-put ov 'evaporate t))
      (when (equal info "Failed")
        (let* ((type (if (equal (car handle) "multipart/signed")
                         "verification" "decryption"))
               (warning (if (equal type "decryption")
                            "(passphrase may be incorrect)" "")))
          (message "%s %s failed %s" crypto-type type warning))))))