summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-06-28 07:10:30 +0000
committerRichard M. Stallman <rms@gnu.org>1996-06-28 07:10:30 +0000
commitd0b3708b1cda3ab83c7425f970647be3ff0f0904 (patch)
tree7eeb30adc85126fa8e3e7e99d49230190cfc792a
parentb0ef30a9a89bfda54ae7924cae43fa8dd325304c (diff)
downloademacs-d0b3708b1cda3ab83c7425f970647be3ff0f0904.tar.gz
(rmail-unix-mail-delimiter):
Accept more user names, since they can be mangled badly by modern Unix mailers (e.g. Solaris 2.5 mail.local). Be a little more picky about dates to compensate. Match all the digits of a year, as per RFC 1123 section 5.2.14. (rmail-nuke-pinhead-header): Adjust to regexp renumbering in rmail-unix-mail-delimiter.
-rw-r--r--lisp/mail/rmail.el33
1 files changed, 21 insertions, 12 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 9e6593427df..e08fb569d97 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -221,25 +221,34 @@ Called with region narrowed to the message, including headers.")
(concat
"From "
- ;; Username, perhaps with a quoted section that can contain spaces.
- "\\("
- "[^ \n]*"
- "\\(\\|\".*\"[^ \n]*\\)"
- "\\|<[^<>\n]+>"
- "\\) ?"
+ ;; Many things can happen to an RFC 822 mailbox before it is put into
+ ;; a `From' line. The leading phrase can be stripped, e.g.
+ ;; `Joe <@w.x:joe@y.z>' -> `<@w.x:joe@y.z>'. The <> can be stripped, e.g.
+ ;; `<@x.y:joe@y.z>' -> `@x.y:joe@y.z'. Everything starting with a CRLF
+ ;; can be removed, e.g.
+ ;; From: joe@y.z (Joe K
+ ;; User)
+ ;; can yield `From joe@y.z (Joe K Fri Mar 22 08:11:15 1996', and
+ ;; From: Joe User
+ ;; <joe@y.z>
+ ;; can yield `From Joe User Fri Mar 22 08:11:15 1996'.
+ ;; We want to match the results of any of these manglings.
+ ;; The following regexp rejects names whose first characters are
+ ;; obviously bogus, but after that anything goes.
+ "\\([^\0-\r \^?].*\\)? "
;; The time the message was sent.
- "\\([^ \n]*\\) *" ; day of the week
- "\\([^ \n]*\\) *" ; month
- "\\([0-9]*\\) *" ; day of month
- "\\([0-9:]*\\) *" ; time of day
+ "\\([^\0-\r \^?]+\\) +" ; day of the week
+ "\\([^\0-\r \^?]+\\) +" ; month
+ "\\([0-3]?[0-9]\\) +" ; day of month
+ "\\([0-2][0-9]:[0-5][0-9]\\(:[0-6][0-9]\\)?\\) *" ; time of day
;; Perhaps a time zone, specified by an abbreviation, or by a
;; numeric offset.
time-zone-regexp
;; The year.
- " [0-9][0-9]\\([0-9]*\\) *"
+ " \\([0-9][0-9]+\\) *"
;; On some systems the time zone can appear after the year, too.
time-zone-regexp
@@ -1273,7 +1282,7 @@ Optional DEFAULT is password to start with."
(if has-date
""
(concat
- "Date: \\3, \\5 \\4 \\9 \\6 "
+ "Date: \\2, \\4 \\3 \\9 \\5 "
;; The timezone could be matched by group 7 or group 10.
;; If neither of them matched, assume EST, since only