;;; mml2015.el --- MIME Security with Pretty Good Privacy (PGP)
-;; Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
;; Keywords: PGP MIME MML
(eval-when-compile (require 'cl))
(require 'mm-decode)
(require 'mm-util)
+(require 'mml)
(defvar mml2015-use (or
(progn
(or (y-or-n-p "Sign the message? ")
'not))))
'never)))
- (mm-with-unibyte-current-buffer-mule4
+ (mm-with-unibyte-current-buffer
(mc-encrypt-generic
(or (message-options-get 'message-recipients)
(message-options-set 'message-recipients
(buffer-string)))
(set-buffer cipher)
(erase-buffer)
- (insert-buffer plain)
+ (insert-buffer-substring plain)
(goto-char (point-min))
(while (search-forward "\r\n" nil t)
(replace-match "\n" t t))))
(goto-char (point-max))
(insert (format "\n--%s\n" boundary))
(insert "Content-Type: application/pgp-signature\n\n")
- (insert-buffer signature)
+ (insert-buffer-substring signature)
(goto-char (point-max))
(insert (format "--%s--\n" boundary))
(goto-char (point-max)))))
(funcall mml-boundary-function (incf mml-multipart-number)))
(text (current-buffer))
cipher)
- (mm-with-unibyte-current-buffer-mule4
+ (mm-with-unibyte-current-buffer
(with-temp-buffer
;; set up a function to call the correct gpg encrypt routine
;; with the right arguments. (FIXME: this should be done
(insert "Version: 1\n\n")
(insert (format "--%s\n" boundary))
(insert "Content-Type: application/octet-stream\n\n")
- (insert-buffer cipher)
+ (insert-buffer-substring cipher)
(goto-char (point-max))
(insert (format "--%s--\n" boundary))
(goto-char (point-max))))))
mm-security-handle 'gnus-details "Quit.")
nil))
(with-current-buffer pgg-output-buffer
+ (goto-char (point-min))
+ (while (search-forward "\r\n" nil t)
+ (replace-match "\n" t t))
(setq handles (mm-dissect-buffer t))
(mm-destroy-parts handle)
(mm-set-handle-multipart-parameter
(buffer-string))))
(progn
(erase-buffer)
- (insert-buffer pgg-output-buffer)
+ (insert-buffer-substring pgg-output-buffer)
+ (goto-char (point-min))
+ (while (search-forward "\r\n" nil t)
+ (replace-match "\n" t t))
(mm-set-handle-multipart-parameter
mm-security-handle 'gnus-info "OK"))
(mm-set-handle-multipart-parameter
(prog1
(pgg-verify-region (point-min) (point-max)
signature-file t)
+ (goto-char (point-min))
+ (while (search-forward "\r\n" nil t)
+ (replace-match "\n" t t))
(mm-set-handle-multipart-parameter
mm-security-handle 'gnus-details
(concat (with-current-buffer pgg-output-buffer
(defun mml2015-pgg-clear-verify ()
(let ((pgg-errors-buffer mml2015-result-buffer)
- (text (current-buffer)))
+ (text (buffer-string))
+ (coding-system buffer-file-coding-system))
(if (condition-case err
(prog1
(mm-with-unibyte-buffer
- (insert-buffer text)
+ (insert (encode-coding-string text coding-system))
(pgg-verify-region (point-min) (point-max) nil t))
+ (goto-char (point-min))
+ (while (search-forward "\r\n" nil t)
+ (replace-match "\n" t t))
(mm-set-handle-multipart-parameter
mm-security-handle 'gnus-details
(concat (with-current-buffer pgg-output-buffer
(defun mml2015-pgg-sign (cont)
(let ((pgg-errors-buffer mml2015-result-buffer)
- (boundary (funcall mml-boundary-function (incf mml-multipart-number))))
+ (boundary (funcall mml-boundary-function (incf mml-multipart-number)))
+ (pgg-default-user-id (or (message-options-get 'mml-sender)
+ pgg-default-user-id)))
(unless (pgg-sign-region (point-min) (point-max))
(pop-to-buffer mml2015-result-buffer)
(error "Sign error"))
(goto-char (point-max))
(insert (format "\n--%s\n" boundary))
(insert "Content-Type: application/pgp-signature\n\n")
- (insert-buffer pgg-output-buffer)
+ (insert-buffer-substring pgg-output-buffer)
(goto-char (point-max))
(insert (format "--%s--\n" boundary))
(goto-char (point-max))))
(insert "Version: 1\n\n")
(insert (format "--%s\n" boundary))
(insert "Content-Type: application/octet-stream\n\n")
- (insert-buffer pgg-output-buffer)
+ (insert-buffer-substring pgg-output-buffer)
(goto-char (point-max))
(insert (format "--%s--\n" boundary))
(goto-char (point-max))))