emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100343: Small mail-utils fix for


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100343: Small mail-utils fix for bug 7760.
Date: Sat, 01 Jan 2011 18:35:23 -0800
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100343
committer: Glenn Morris <address@hidden>
branch nick: emacs-23
timestamp: Sat 2011-01-01 18:35:23 -0800
message:
  Small mail-utils fix for bug 7760.
  
  * lisp/mail/mail-utils.el (mail-mbox-from): Handle From: headers with
  multiple addresses.
modified:
  lisp/ChangeLog
  lisp/mail/mail-utils.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-12-31 20:17:53 +0000
+++ b/lisp/ChangeLog    2011-01-02 02:35:23 +0000
@@ -1,3 +1,8 @@
+2011-01-02  Glenn Morris  <address@hidden>
+
+       * mail/mail-utils.el (mail-mbox-from): Handle From: headers with
+       multiple addresses.  (Bug#7760)
+
 2010-12-31  Michael Albinus  <address@hidden>
 
        * net/tramp.el (tramp-methods): Add recursive options to "scpc",
@@ -12324,7 +12329,7 @@
 ;; coding: utf-8
 ;; End:
 
-    Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+  Copyright (C) 2009, 2010, 2011  Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 

=== modified file 'lisp/mail/mail-utils.el'
--- a/lisp/mail/mail-utils.el   2010-10-09 00:41:03 +0000
+++ b/lisp/mail/mail-utils.el   2011-01-02 02:35:23 +0000
@@ -1,7 +1,7 @@
 ;;; mail-utils.el --- utility functions used both by rmail and rnews
 
 ;; Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-;;   2009, 2010  Free Software Foundation, Inc.
+;;   2009, 2010, 2011  Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: mail, news
@@ -398,13 +398,19 @@
 (defun mail-mbox-from ()
   "Return an mbox \"From \" line for the current message.
 The buffer should be narrowed to just the header."
-  (let ((from (or (mail-fetch-field "from")
-                 (mail-fetch-field "really-from")
-                 (mail-fetch-field "sender")
-                 (mail-fetch-field "return-path")
-                 "unknown"))
-       (date (mail-fetch-field "date")))
-    (format "From %s %s\n" (mail-strip-quoted-names from)
+  (let* ((from (mail-strip-quoted-names (or (mail-fetch-field "from")
+                                           (mail-fetch-field "really-from")
+                                           (mail-fetch-field "sender")
+                                           (mail-fetch-field "return-path")
+                                           "unknown")))
+        (date (mail-fetch-field "date"))
+        ;; A From: header can contain multiple addresses, a "From "
+        ;; line must contain only one.  (Bug#7760)
+        ;; See eg RFC 5322, 3.6.2. Originator Fields.
+        (end (string-match "[ \t]*[,\n]" from)))
+    (format "From %s %s\n" (if end
+                              (substring from 0 end)
+                            from)
            (or (and date
                     (ignore-errors
                      (current-time-string (date-to-time date))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]