- (raw-buf (current-buffer))
- (oinfo (mime-article/rcnum-to-cinfo (cons onum rmcnum)
- mime::article/content-info))
- kbuf
- (basename (expand-file-name "tm" mime-temp-directory))
- (orig-file (make-temp-name basename))
- (sig-file (concat orig-file ".sig"))
- )
- (save-excursion
- (let ((p-min (mime-entity-info-point-min oinfo))
- (p-max (mime-entity-info-point-max oinfo))
- )
- (set-buffer (get-buffer-create mime-temp-buffer-name))
- (insert-buffer-substring raw-buf p-min p-max)
- )
- (goto-char (point-min))
- (while (re-search-forward "\n" nil t)
- (replace-match "\r\n")
- )
- (as-binary-output-file (write-file orig-file))
- (kill-buffer (current-buffer))
- )
- (save-excursion (mime-show-echo-buffer))
- (save-excursion
- (let ((p-min (save-excursion
- (goto-char beg)
- (and (search-forward "\n\n")
- (match-end 0))
- )))
- (set-buffer (setq kbuf (get-buffer-create mime-temp-buffer-name)))
- (insert-buffer-substring raw-buf p-min end)
- )
- (mime-decode-region (point-min)(point-max) encoding)
- (as-binary-output-file (write-file sig-file))
- (or (mime::article/call-pgp-to-check-signature
- mime-echo-buffer-name orig-file)
- (let (pgp-id)
- (save-excursion
- (set-buffer mime-echo-buffer-name)
- (goto-char (point-min))
- (let ((regexp (cdr (assq (or mime-pgp-default-language 'en)
- mime-pgp-key-expected-regexp-alist))))
- (cond ((not (stringp regexp))
- (message
- "Please specify right regexp for specified language")
- )
- ((re-search-forward regexp nil t)
- (setq pgp-id
- (concat "0x" (buffer-substring-no-properties
- (match-beginning 1)
- (match-end 1))))
- ))))
- (if (and pgp-id
- (y-or-n-p
- (format "Key %s not found; attempt to fetch? " pgp-id))
- )
- (progn
- (funcall (pgp-function 'fetch-key) (cons nil pgp-id))
- (mime::article/call-pgp-to-check-signature
- mime-echo-buffer-name orig-file)
- ))
- ))
- (let ((other-window-scroll-buffer mime-echo-buffer-name))
- (scroll-other-window 8)
- )
- (kill-buffer kbuf)
- (delete-file orig-file)
- (delete-file sig-file)
- )))
-
-(set-atype 'mime-acting-condition
- '((type . "application/pgp-signature")
- (method . mime-article/check-pgp-signature)
- ))
+ (orig-entity (nth onum (mime-entity-children mother)))
+ (basename (expand-file-name "tm" temporary-file-directory))
+ (sig-file (concat (make-temp-name basename) ".asc"))
+ status)
+ (save-excursion
+ (mime-show-echo-buffer)
+ (set-buffer mime-echo-buffer-name)
+ (set-window-start
+ (get-buffer-window mime-echo-buffer-name)
+ (point-max)))
+ (mime-write-entity-content entity sig-file)
+ (unwind-protect
+ (with-temp-buffer
+ (mime-insert-entity orig-entity)
+ (goto-char (point-min))
+ (while (progn (end-of-line) (not (eobp)))
+ (insert "\r")
+ (forward-line 1))
+ (setq status (pgg-verify-region (point-min)(point-max)
+ sig-file 'fetch))
+ (save-excursion
+ (set-buffer mime-echo-buffer-name)
+ (insert-buffer-substring (if status pgg-output-buffer
+ pgg-errors-buffer))))
+ (delete-file sig-file))))