+
+;;; @ Internal method for application/pgp-encrypted
+;;;
+;;; It is based on RFC 2015.
+
+(defun mime-article/decrypt-pgp (beg end cal)
+ (let* ((cnum (mime-article/point-content-number beg))
+ (rcnum (reverse cnum))
+ (rmcnum (cdr rcnum))
+ (knum (car rcnum))
+ (onum (if (> knum 0)
+ (1- knum)
+ (1+ knum)))
+ (oinfo (mime-article/rcnum-to-cinfo (cons onum rmcnum)
+ mime::article/content-info))
+ (obeg (mime::content-info/point-min oinfo))
+ (oend (mime::content-info/point-max oinfo))
+ )
+ (mime-article/view-application/pgp obeg oend cal)
+ ))
+
+(set-atype 'mime/content-decoding-condition
+ '((type . "application/pgp-encrypted")
+ (method . mime-article/decrypt-pgp)
+ ))
+
+
+;;; @ Internal method for application/pgp-keys
+;;;
+;;; It is based on RFC 2015.
+
+(defun mime-article/add-pgp-keys (beg end cal)
+ (let* ((cnum (mime-article/point-content-number beg))
+ (cur-buf (current-buffer))
+ (new-name (format "%s-%s" (buffer-name) cnum))
+ (mother mime::article/preview-buffer)
+ (charset (cdr (assoc "charset" cal)))
+ (encoding (cdr (assq 'encoding cal)))
+ (mode major-mode)
+ str)
+ (setq str (buffer-substring beg end))
+ (switch-to-buffer new-name)
+ (setq buffer-read-only nil)
+ (erase-buffer)
+ (insert str)
+ (goto-char (point-min))
+ (if (re-search-forward "^\n" nil t)
+ (delete-region (point-min) (match-end 0))
+ )
+ (mime-decode-region (point-min)(point-max) encoding)
+ (funcall (pgp-function 'snarf-keys))
+ (kill-buffer (current-buffer))
+ ))
+
+(set-atype 'mime/content-decoding-condition
+ '((type . "application/pgp-keys")
+ (method . mime-article/add-pgp-keys)
+ ))
+