+2002-04-13 Josh Huber <huber@alum.wpi.edu>
+
+ * mml-sec.el (mml-secure-message): changed to support arbritrary
+ modes.
+ * mml-sec.el (mml-secure-message-encrypt-(smime|pgp|pgpmime)):
+ changed to support "signencrypt" mode.
+ * mml.el (mml-parse-1): changed to support different secure modes
+ more easily. (for signencrypt)
+
2002-04-11 Stefan Monnier <monnier@cs.yale.edu>
* gnus-sum.el (gnus-update-summary-mark-positions)
(mml-secure-part "smime"))
;; defuns that add the proper <#secure ...> tag to the top of the message body
-(defun mml-secure-message (method &optional sign)
- (let ((mode (if sign "sign" "encrypt"))
+(defun mml-secure-message (method &optional modesym)
+ (let ((mode (prin1-to-string modesym))
insert-loc)
(mml-unsecure-message)
(save-excursion
(interactive)
(mml-secure-message "pgpmime" 'sign))
-(defun mml-secure-message-encrypt-smime ()
- "Add MML tag to encrypt/sign the entire message."
- (interactive)
- (mml-secure-message "smime"))
-
-(defun mml-secure-message-encrypt-pgp ()
- "Add MML tag to encrypt/sign the entire message."
- (interactive)
- (mml-secure-message "pgp"))
-
-(defun mml-secure-message-encrypt-pgpmime ()
- "Add MML tag to encrypt/sign the entire message."
- (interactive)
- (mml-secure-message "pgpmime"))
+(defun mml-secure-message-encrypt-smime (&optional dontsign)
+ "Add MML tag to encrypt and sign the entire message.
+If called with a prefix argument, only encrypt (do NOT sign)."
+ (interactive "P")
+ (mml-secure-message "smime" (if dontsign 'encrypt 'signencrypt)))
+
+;;; NOTE: this should be switched to use signencrypt
+;;; once it does something sensible
+(defun mml-secure-message-encrypt-pgp (&optional dontsign)
+ "Add MML tag to encrypt and sign the entire message.
+If called with a prefix argument, only encrypt (do NOT sign)."
+ (interactive "P")
+ (mml-secure-message "pgp" (if dontsign 'encrypt 'encrypt)))
+
+;;; NOTE: this should be switched to use signencrypt
+;;; once it does something sensible
+(defun mml-secure-message-encrypt-pgpmime (&optional dontsign)
+ "Add MML tag to encrypt and sign the entire message.
+If called with a prefix argument, only encrypt (do NOT sign)."
+ (interactive "P")
+ (mml-secure-message "pgpmime" (if dontsign 'encrypt 'encrypt)))
(provide 'mml-sec)
(let* (secure-mode
(taginfo (mml-read-tag))
(recipients (cdr (assq 'recipients taginfo)))
- (location (cdr (assq 'tag-location taginfo))))
+ (location (cdr (assq 'tag-location taginfo)))
+ (mode (cdr (assq 'mode taginfo)))
+ (method (cdr (assq 'method taginfo)))
+ tags)
(save-excursion
(if
(re-search-forward
(goto-char location)
(re-search-forward "<#secure[^\n]*>\n"))
(delete-region (match-beginning 0) (match-end 0))
- (mml-insert-tag secure-mode
- (cdr (assq 'mode taginfo))
- (cdr (assq 'method taginfo))
- (and recipients 'recipients)
- recipients)
+ (cond ((string= mode "sign")
+ (setq tags (list "sign" method)))
+ ((string= mode "encrypt")
+ (setq tags (list "encrypt" method)))
+ ((string= mode "signencrypt")
+ (setq tags (list "sign" method "encrypt" method))))
+ (eval `(mml-insert-tag ,secure-mode
+ ,@tags
+ ,(if recipients 'recipients)
+ ,recipients))
;; restart the parse
(goto-char location)))
((looking-at "<#multipart")