From f1e4bf064c52e0c9aae97f147088b62ffe83f02a Mon Sep 17 00:00:00 2001 From: yamaoka Date: Mon, 18 Jun 2001 22:45:53 +0000 Subject: [PATCH] Synch with Oort Gnus. --- lisp/ChangeLog | 16 ++++++++++ lisp/message.el | 92 +++++++++++++++++++++++++++++++++++++------------------ lisp/mml.el | 22 ++++++------- lisp/qp.el | 4 ++- 4 files changed, 91 insertions(+), 43 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d35532b..0494dd3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,19 @@ +2001-06-15 Eli Zaretskii + + * qp.el (quoted-printable-decode-region): If called interactively, + use coding-system-for-read. + +2001-06-16 09:00:00 ShengHuo ZHU + + * message.el (message-check-news-header-syntax): Check Reply-To. + +2001-06-16 08:00:00 ShengHuo ZHU + + * mml.el (mml-parse-1): Use message options. + + * message.el (message-do-fcc): Don't do anything if there is no + FCC. + 2001-06-16 Simon Josefsson * nnimap.el (nnimap-split-articles): Support 'junk to-groups. diff --git a/lisp/message.el b/lisp/message.el index d0ab827..1f98726 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -200,7 +200,7 @@ Checks include `subject-cmsg', `multiple-headers', `sendsys', `new-text', `quoting-style', `redirected-followup', `signature', `approved', `sender', `empty', `empty-headers', `message-id', `from', `subject', `shorten-followup-to', `existing-newsgroups', -`buffer-file-name', `unchanged', `newsgroups'." +`buffer-file-name', `unchanged', `newsgroups', `reply-to'." :group 'message-news :type '(repeat sexp)) ; Fixme: improve this @@ -3681,6 +3681,32 @@ This sub function is for exclusive use of `message-send-news'." (message "Denied posting -- the From looks strange: \"%s\"." from) nil) + (t t)))) + ;; Check the Reply-To header. + (message-check 'reply-to + (let* ((case-fold-search t) + (reply-to (message-fetch-field "reply-to")) + ad) + (cond + ((not reply-to) + t) + ((string-match "," reply-to) + (y-or-n-p + (format "Multiple Reply-To addresses: \"%s\". Really post? " + reply-to))) + ((or (not (string-match + "@[^\\.]*\\." + (setq ad (nth 1 (mail-extract-address-components + reply-to))))) ;larsi@ifi + (string-match "\\.\\." ad) ;larsi@ifi..uio + (string-match "@\\." ad) ;larsi@.ifi.uio + (string-match "\\.$" ad) ;larsi@ifi.uio. + (not (string-match "^[^@]+@[^@]+$" ad)) ;larsi.ifi.uio + (string-match "(.*).*(.*)" reply-to)) ;(lars) (lars) + (y-or-n-p + (format + "The Reply-To looks strange: \"%s\". Really post? " + reply-to))) (t t)))))) (defun message-check-news-body-syntax () @@ -3840,37 +3866,43 @@ This sub function is for exclusive use of `message-send-news'." (output-coding-system 'raw-text) list file) (save-excursion - (set-buffer (get-buffer-create " *message temp*")) - (erase-buffer) - (insert-buffer-substring message-encoding-buffer) (save-restriction (message-narrow-to-headers) - (while (setq file (message-fetch-field "fcc")) - (push file list) - (message-remove-header "fcc" nil t))) - (goto-char (point-min)) - (re-search-forward (concat "^" (regexp-quote mail-header-separator) "$")) - (replace-match "" t t) - ;; Process FCC operations. - (while list - (setq file (pop list)) - (if (string-match "^[ \t]*|[ \t]*\\(.*\\)[ \t]*$" file) - ;; Pipe the article to the program in question. - (call-process-region (point-min) (point-max) shell-file-name - nil nil nil shell-command-switch - (match-string 1 file)) - ;; Save the article. - (setq file (expand-file-name file)) - (unless (file-exists-p (file-name-directory file)) - (make-directory (file-name-directory file) t)) - (if (and message-fcc-handler-function - (not (eq message-fcc-handler-function 'rmail-output))) - (funcall message-fcc-handler-function file) - (if (and (file-readable-p file) (mail-file-babyl-p file)) - (rmail-output file 1 nil t) - (let ((mail-use-rfc822 t)) - (rmail-output file 1 t t)))))) - (kill-buffer (current-buffer))))) + (setq file (message-fetch-field "fcc" t))) + (when file + (set-buffer (get-buffer-create " *message temp*")) + (erase-buffer) + (insert-buffer-substring message-encoding-buffer) + (save-restriction + (message-narrow-to-headers) + (while (setq file (message-fetch-field "fcc")) + (push file list) + (message-remove-header "fcc" nil t))) + (goto-char (point-min)) + (when (re-search-forward + (concat "^" (regexp-quote mail-header-separator) "$") + nil t) + (replace-match "" t t)) + ;; Process FCC operations. + (while list + (setq file (pop list)) + (if (string-match "^[ \t]*|[ \t]*\\(.*\\)[ \t]*$" file) + ;; Pipe the article to the program in question. + (call-process-region (point-min) (point-max) shell-file-name + nil nil nil shell-command-switch + (match-string 1 file)) + ;; Save the article. + (setq file (expand-file-name file)) + (unless (file-exists-p (file-name-directory file)) + (make-directory (file-name-directory file) t)) + (if (and message-fcc-handler-function + (not (eq message-fcc-handler-function 'rmail-output))) + (funcall message-fcc-handler-function file) + (if (and (file-readable-p file) (mail-file-babyl-p file)) + (rmail-output file 1 nil t) + (let ((mail-use-rfc822 t)) + (rmail-output file 1 t t)))))) + (kill-buffer (current-buffer)))))) (defun message-output (filename) "Append this article to Unix/babyl mail file FILENAME." diff --git a/lisp/mml.el b/lisp/mml.el index 4622a4d..ad1c450 100644 --- a/lisp/mml.el +++ b/lisp/mml.el @@ -125,14 +125,15 @@ one charsets.") (mm-find-mime-charset-region point (point)))) (when (and (not raw) (memq nil charsets)) (if (or (memq 'unknown-encoding mml-confirmation-set) - (prog1 (y-or-n-p - "\ + (message-options-get 'unknown-encoding) + (and (y-or-n-p "\ Message contains characters with unknown encoding. Really send?") - (set (make-local-variable 'mml-confirmation-set) - (push 'unknown-encoding mml-confirmation-set)))) + (message-options-set 'unknown-encoding t))) (if (setq use-ascii (or (memq 'use-ascii mml-confirmation-set) - (y-or-n-p "Use ASCII as charset?"))) + (message-options-get 'use-ascii) + (and (y-or-n-p "Use ASCII as charset?") + (message-options-set 'use-ascii t)))) (setq charsets (delq nil charsets)) (setq warn nil)) (error "Edit your message to remove those characters"))) @@ -148,14 +149,11 @@ Message contains characters with unknown encoding. Really send?") tag point (point) use-ascii))) (when (and warn (not (memq 'multipart mml-confirmation-set)) - (not - (prog1 (y-or-n-p - (format - "\ + (not (message-options-get 'multipart)) + (not (and (y-or-n-p (format "\ A message part needs to be split into %d charset parts. Really send? " - (length nstruct))) - (set (make-local-variable 'mml-confirmation-set) - (push 'multipart mml-confirmation-set))))) + (length nstruct))) + (message-options-set 'multipart t)))) (error "Edit your message to use only one charset")) (setq struct (nconc nstruct struct))))))) (unless (eobp) diff --git a/lisp/qp.el b/lisp/qp.el index 9875a0b..13882fd 100644 --- a/lisp/qp.el +++ b/lisp/qp.el @@ -36,7 +36,9 @@ "Decode quoted-printable in the region between FROM and TO, per RFC 2045. If CODING-SYSTEM is non-nil, decode bytes into characters with that coding-system." - (interactive "r") + (interactive + ;; Let the user determine the coding system with "C-x RET c". + (list (region-beginning) (region-end) coding-system-for-read)) (unless (mm-coding-system-p coding-system) ; e.g. `ascii' from Gnus (setq coding-system nil)) (save-excursion -- 1.7.10.4