diff lisp/gnus/message.el @ 76267:96573486524e

Merge from gnus--rel--5.10 Patches applied: * gnus--rel--5.10 (patch 203-205) - Merge from emacs--devo--0 - Update from CVS 2007-02-28 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/message.el (message-make-in-reply-to): Quote name containing non-ASCII characters. It will make the RFC2047 encoder cause an error if there are special characters. Reported by NAKAJI Hiroyuki <nakaji@kankyo-u.ac.jp>. 2007-02-27 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/nntp.el (nntp-never-echoes-commands) (nntp-open-connection-functions-never-echo-commands): New variables. (nntp-send-command): Use them. 2007-02-27 Katsumi Yamaoka <yamaoka@jpl.org> * man/gnus.texi (NNTP): Mention nntp-never-echoes-commands and nntp-open-connection-functions-never-echo-commands. Revision: emacs@sv.gnu.org/emacs--devo--0--patch-658
author Miles Bader <miles@gnu.org>
date Thu, 01 Mar 2007 23:41:53 +0000
parents e3694f1cb928
children 52354deba43e ec58e5c426ef
line wrap: on
line diff
--- a/lisp/gnus/message.el	Thu Mar 01 23:19:31 2007 +0000
+++ b/lisp/gnus/message.el	Thu Mar 01 23:41:53 2007 +0000
@@ -4864,13 +4864,32 @@
 	  (msg-id (mail-header-message-id message-reply-headers)))
       (when from
 	(let ((name (mail-extract-address-components from)))
-	  (concat msg-id (if msg-id " (")
-		  (or (car name)
-		      (nth 1 name))
-		  "'s message of \""
-		  (if (or (not date) (string= date ""))
-		      "(unknown date)" date)
-		  "\"" (if msg-id ")")))))))
+	  (concat
+	   msg-id (if msg-id " (")
+	   (if (car name)
+	       (if (string-match "[^\000-\177]" (car name))
+		   ;; Quote a string containing non-ASCII characters.
+		   ;; It will make the RFC2047 encoder cause an error
+		   ;; if there are special characters.
+		   (let ((default-enable-multibyte-characters t))
+		     (with-temp-buffer
+		       (insert (car name))
+		       (goto-char (point-min))
+		       (while (search-forward "\"" nil t)
+			 (when (prog2
+				   (backward-char)
+				   (zerop (% (skip-chars-backward "\\\\") 2))
+				 (goto-char (match-beginning 0)))
+			   (insert "\\"))
+			 (forward-char))
+		       ;; Those quotes will be removed by the RFC2047 encoder.
+		       (concat "\"" (buffer-string) "\"")))
+		 (car name))
+	     (nth 1 name))
+	   "'s message of \""
+	   (if (or (not date) (string= date ""))
+	       "(unknown date)" date)
+	   "\"" (if msg-id ")")))))))
 
 (defun message-make-distribution ()
   "Make a Distribution header."