aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/mail
diff options
context:
space:
mode:
authorMiles Bader2008-01-30 07:57:28 +0000
committerMiles Bader2008-01-30 07:57:28 +0000
commitd235ca2ff8fab139ce797757fcb159d1e28fa7e0 (patch)
tree96c5cd1a06a0d9dc26e8470c6eabfc032c0046f3 /lisp/mail
parent3709a060f679dba14df71ae64a0035fa2b5b3106 (diff)
parent02cbe062bee38a6705bafb1699d77e3c44cfafcf (diff)
downloademacs-d235ca2ff8fab139ce797757fcb159d1e28fa7e0.tar.gz
emacs-d235ca2ff8fab139ce797757fcb159d1e28fa7e0.zip
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-324
Diffstat (limited to 'lisp/mail')
-rw-r--r--lisp/mail/hashcash.el2
-rw-r--r--lisp/mail/rmail.el145
2 files changed, 76 insertions, 71 deletions
diff --git a/lisp/mail/hashcash.el b/lisp/mail/hashcash.el
index 36cd17fe6fc..5b292961b98 100644
--- a/lisp/mail/hashcash.el
+++ b/lisp/mail/hashcash.el
@@ -1,6 +1,6 @@
1;;; hashcash.el --- Add hashcash payments to email 1;;; hashcash.el --- Add hashcash payments to email
2 2
3;; Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation 3;; Copyright (C) 2003, 2004, 2005, 2007, 2008 Free Software Foundation
4 4
5;; Written by: Paul Foley <mycroft@actrix.gen.nz> (1997-2002) 5;; Written by: Paul Foley <mycroft@actrix.gen.nz> (1997-2002)
6;; Maintainer: Paul Foley <mycroft@actrix.gen.nz> 6;; Maintainer: Paul Foley <mycroft@actrix.gen.nz>
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 7a6e013e5d0..359088ec2e7 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -1934,7 +1934,7 @@ is non-nil if the user has supplied the password interactively.
1934 (save-restriction 1934 (save-restriction
1935 (while (not (eobp)) 1935 (while (not (eobp))
1936 (setq start (point)) 1936 (setq start (point))
1937 (cond ((looking-at "BABYL OPTIONS:");Babyl header 1937 (cond ((looking-at "BABYL OPTIONS:") ;Babyl header
1938 (if (search-forward "\n\^_" nil t) 1938 (if (search-forward "\n\^_" nil t)
1939 ;; If we find the proper terminator, delete through there. 1939 ;; If we find the proper terminator, delete through there.
1940 (delete-region (point-min) (point)) 1940 (delete-region (point-min) (point))
@@ -1953,75 +1953,80 @@ is non-nil if the user has supplied the password interactively.
1953 (save-excursion 1953 (save-excursion
1954 (skip-chars-forward " \t\n") 1954 (skip-chars-forward " \t\n")
1955 (point))) 1955 (point)))
1956 (save-excursion 1956 ;; The following let* form was wrapped in a `save-excursion'
1957 (let* ((header-end 1957 ;; which in one case caused infinite looping, see:
1958 (progn 1958 ;; http://lists.gnu.org/archive/html/emacs-devel/2008-01/msg00968.html
1959 (save-excursion 1959 ;; Removing that form leaves `point' at the end of the
1960 (goto-char start) 1960 ;; region decoded by `rmail-decode-region' which should
1961 (forward-line 1) 1961 ;; be correct.
1962 (if (looking-at "0") 1962 (let* ((header-end
1963 (forward-line 1) 1963 (progn
1964 (forward-line 2))
1965 (save-restriction
1966 (narrow-to-region (point) (point-max))
1967 (rfc822-goto-eoh)
1968 (point)))))
1969 (case-fold-search t)
1970 (quoted-printable-header-field-end
1971 (save-excursion
1972 (goto-char start)
1973 (re-search-forward
1974 "^content-transfer-encoding:\\(\n?[\t ]\\)*quoted-printable\\(\n?[\t ]\\)*"
1975 header-end t)))
1976 (base64-header-field-end
1977 (save-excursion 1964 (save-excursion
1978 (goto-char start) 1965 (goto-char start)
1979 ;; Don't try to decode non-text data. 1966 (forward-line 1)
1980 (and (re-search-forward 1967 (if (looking-at "0")
1981 "^content-type:\\(\n?[\t ]\\)\\(text\\|message\\)/" 1968 (forward-line 1)
1982 header-end t) 1969 (forward-line 2))
1983 (goto-char start) 1970 (save-restriction
1984 (re-search-forward 1971 (narrow-to-region (point) (point-max))
1985 "^content-transfer-encoding:\\(\n?[\t ]\\)*base64\\(\n?[\t ]\\)*" 1972 (rfc822-goto-eoh)
1986 header-end t))))) 1973 (point)))))
1987 (if quoted-printable-header-field-end 1974 (case-fold-search t)
1975 (quoted-printable-header-field-end
1988 (save-excursion 1976 (save-excursion
1989 (unless 1977 (goto-char start)
1990 (mail-unquote-printable-region header-end (point) nil t t) 1978 (re-search-forward
1991 (message "Malformed MIME quoted-printable message")) 1979 "^content-transfer-encoding:\\(\n?[\t ]\\)*quoted-printable\\(\n?[\t ]\\)*"
1992 ;; Change "quoted-printable" to "8bit", 1980 header-end t)))
1993 ;; to reflect the decoding we just did. 1981 (base64-header-field-end
1994 (goto-char quoted-printable-header-field-end)
1995 (delete-region (point) (search-backward ":"))
1996 (insert ": 8bit")))
1997 (if base64-header-field-end
1998 (save-excursion 1982 (save-excursion
1999 (when 1983 (goto-char start)
2000 (condition-case nil 1984 ;; Don't try to decode non-text data.
2001 (progn 1985 (and (re-search-forward
2002 (base64-decode-region (1+ header-end) 1986 "^content-type:\\(\n?[\t ]\\)\\(text\\|message\\)/"
2003 (- (point) 2)) 1987 header-end t)
2004 t) 1988 (goto-char start)
2005 (error nil)) 1989 (re-search-forward
2006 ;; Change "base64" to "8bit", to reflect the 1990 "^content-transfer-encoding:\\(\n?[\t ]\\)*base64\\(\n?[\t ]\\)*"
2007 ;; decoding we just did. 1991 header-end t)))))
2008 (goto-char base64-header-field-end) 1992 (if quoted-printable-header-field-end
2009 (delete-region (point) (search-backward ":")) 1993 (save-excursion
2010 (insert ": 8bit")))) 1994 (unless
2011 (setq last-coding-system-used nil) 1995 (mail-unquote-printable-region header-end (point) nil t t)
2012 (or rmail-enable-mime 1996 (message "Malformed MIME quoted-printable message"))
2013 (not rmail-enable-multibyte) 1997 ;; Change "quoted-printable" to "8bit",
2014 (let ((mime-charset 1998 ;; to reflect the decoding we just did.
2015 (if (and rmail-decode-mime-charset 1999 (goto-char quoted-printable-header-field-end)
2016 (save-excursion 2000 (delete-region (point) (search-backward ":"))
2017 (goto-char start) 2001 (insert ": 8bit")))
2018 (search-forward "\n\n" nil t) 2002 (if base64-header-field-end
2019 (let ((case-fold-search t)) 2003 (save-excursion
2020 (re-search-backward 2004 (when
2021 rmail-mime-charset-pattern 2005 (condition-case nil
2022 start t)))) 2006 (progn
2023 (intern (downcase (match-string 1)))))) 2007 (base64-decode-region (1+ header-end)
2024 (rmail-decode-region start (point) mime-charset))))) 2008 (- (point) 2))
2009 t)
2010 (error nil))
2011 ;; Change "base64" to "8bit", to reflect the
2012 ;; decoding we just did.
2013 (goto-char base64-header-field-end)
2014 (delete-region (point) (search-backward ":"))
2015 (insert ": 8bit"))))
2016 (setq last-coding-system-used nil)
2017 (or rmail-enable-mime
2018 (not rmail-enable-multibyte)
2019 (let ((mime-charset
2020 (if (and rmail-decode-mime-charset
2021 (save-excursion
2022 (goto-char start)
2023 (search-forward "\n\n" nil t)
2024 (let ((case-fold-search t))
2025 (re-search-backward
2026 rmail-mime-charset-pattern
2027 start t))))
2028 (intern (downcase (match-string 1))))))
2029 (rmail-decode-region start (point) mime-charset))))
2025 ;; Add an X-Coding-System: header if we don't have one. 2030 ;; Add an X-Coding-System: header if we don't have one.
2026 (save-excursion 2031 (save-excursion
2027 (goto-char start) 2032 (goto-char start)
@@ -2051,8 +2056,8 @@ is non-nil if the user has supplied the password interactively.
2051 (save-restriction 2056 (save-restriction
2052 (narrow-to-region start (1- (point))) 2057 (narrow-to-region start (1- (point)))
2053 (goto-char (point-min)) 2058 (goto-char (point-min))
2054 (while (search-forward "\n\^_" nil t); single char "\^_" 2059 (while (search-forward "\n\^_" nil t) ; single char "\^_"
2055 (replace-match "\n^_")))); 2 chars: "^" and "_" 2060 (replace-match "\n^_")))) ; 2 chars: "^" and "_"
2056 (setq last-coding-system-used nil) 2061 (setq last-coding-system-used nil)
2057 (or rmail-enable-mime 2062 (or rmail-enable-mime
2058 (not rmail-enable-multibyte) 2063 (not rmail-enable-multibyte)
@@ -2168,8 +2173,8 @@ is non-nil if the user has supplied the password interactively.
2168 (save-restriction 2173 (save-restriction
2169 (narrow-to-region start (point)) 2174 (narrow-to-region start (point))
2170 (goto-char (point-min)) 2175 (goto-char (point-min))
2171 (while (search-forward "\n\^_" nil t); single char 2176 (while (search-forward "\n\^_" nil t) ; single char
2172 (replace-match "\n^_")))); 2 chars: "^" and "_" 2177 (replace-match "\n^_")))) ; 2 chars: "^" and "_"
2173 ;; This is for malformed messages that don't end in newline. 2178 ;; This is for malformed messages that don't end in newline.
2174 ;; There shouldn't be any, but some users say occasionally 2179 ;; There shouldn't be any, but some users say occasionally
2175 ;; there are some. 2180 ;; there are some.