aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman2004-01-12 21:59:03 +0000
committerRichard M. Stallman2004-01-12 21:59:03 +0000
commit09843470aa062fcb16932767008a0217639b1120 (patch)
treeac991caaf727d533c187c2fa4efb846fdfafe865 /lisp
parent1c81a393d55076cea5ffb7d4cb440b687b52904a (diff)
downloademacs-09843470aa062fcb16932767008a0217639b1120.tar.gz
emacs-09843470aa062fcb16932767008a0217639b1120.zip
(rmail-convert-to-babyl-format): Use mail-unquote-printable-region.
(rmail-hex-string-to-integer, rmail-decode-quoted-printable): (rmail-hex-char-to-integer): Functions deleted.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/mail/rmail.el48
2 files changed, 18 insertions, 41 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7029193eec9..47a9afe7a56 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
12004-01-12 Richard M. Stallman <rms@gnu.org>
2
3 * mail/rmail.el (rmail-convert-to-babyl-format): Use
4 mail-unquote-printable-region.
5 (rmail-hex-string-to-integer, rmail-decode-quoted-printable):
6 (rmail-hex-char-to-integer): Functions deleted.
7
8 * mail/mail-utils.el (mail-unquote-printable-hexdigit): Upcase CHAR.
9 (mail-unquote-printable-region): New arg NOERROR.
10 For invalid encoding, either signal an error to just return nil.
11
12004-01-11 Glenn Morris <gmorris@ast.cam.ac.uk> 122004-01-11 Glenn Morris <gmorris@ast.cam.ac.uk>
2 13
3 * calendar/appt.el: Update copyright and commentary. 14 * calendar/appt.el: Update copyright and commentary.
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 6185fd12286..cc2d595d8a6 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -1680,7 +1680,9 @@ It returns t if it got any new messages."
1680 header-end t)))) 1680 header-end t))))
1681 (if quoted-printable-header-field-end 1681 (if quoted-printable-header-field-end
1682 (save-excursion 1682 (save-excursion
1683 (rmail-decode-quoted-printable header-end (point)) 1683 (unless
1684 (mail-unquote-printable-region header-end (point) nil t)
1685 (message "Malformed MIME quoted-printable message"))
1684 ;; Change "quoted-printable" to "8bit", 1686 ;; Change "quoted-printable" to "8bit",
1685 ;; to reflect the decoding we just did. 1687 ;; to reflect the decoding we just did.
1686 (goto-char quoted-printable-header-field-end) 1688 (goto-char quoted-printable-header-field-end)
@@ -1825,7 +1827,10 @@ It returns t if it got any new messages."
1825 (setq count (1+ count)) 1827 (setq count (1+ count))
1826 (if quoted-printable-header-field-end 1828 (if quoted-printable-header-field-end
1827 (save-excursion 1829 (save-excursion
1828 (rmail-decode-quoted-printable header-end (point)) 1830 (unless
1831 (mail-unquote-printable-region header-end (point) nil t)
1832
1833 (message "Malformed MIME quoted-printable message"))
1829 ;; Change "quoted-printable" to "8bit", 1834 ;; Change "quoted-printable" to "8bit",
1830 ;; to reflect the decoding we just did. 1835 ;; to reflect the decoding we just did.
1831 (goto-char quoted-printable-header-field-end) 1836 (goto-char quoted-printable-header-field-end)
@@ -1887,45 +1892,6 @@ It returns t if it got any new messages."
1887 (t (error "Cannot convert to babyl format"))))) 1892 (t (error "Cannot convert to babyl format")))))
1888 count)) 1893 count))
1889 1894
1890(defun rmail-hex-char-to-integer (character)
1891 "Return CHARACTER's value interpreted as a hex digit."
1892 (if (and (>= character ?0) (<= character ?9))
1893 (- character ?0)
1894 (let ((ch (logior character 32)))
1895 (if (and (>= ch ?a) (<= ch ?f))
1896 (- ch (- ?a 10))
1897 (error "Invalid hex digit `%c'" ch)))))
1898
1899(defun rmail-hex-string-to-integer (hex-string)
1900 "Return decimal integer for HEX-STRING."
1901 (let ((hex-num 0)
1902 (index 0))
1903 (while (< index (length hex-string))
1904 (setq hex-num (+ (* hex-num 16)
1905 (rmail-hex-char-to-integer (aref hex-string index))))
1906 (setq index (1+ index)))
1907 hex-num))
1908
1909(defun rmail-decode-quoted-printable (from to)
1910 "Decode Quoted-Printable in the region between FROM and TO."
1911 (interactive "r")
1912 (goto-char from)
1913 (or (markerp to)
1914 (setq to (copy-marker to)))
1915 (while (search-forward "=" to t)
1916 (cond ((eq (following-char) ?\n)
1917 (delete-char -1)
1918 (delete-char 1))
1919 ((looking-at "[0-9A-F][0-9A-F]")
1920 (let ((byte (rmail-hex-string-to-integer
1921 (buffer-substring (point) (+ 2 (point))))))
1922 (delete-region (1- (point)) (+ 2 (point)))
1923 (insert byte)))
1924 ((looking-at "=")
1925 (delete-char 1))
1926 (t
1927 (message "Malformed MIME quoted-printable message")))))
1928
1929;; Delete the "From ..." line, creating various other headers with 1895;; Delete the "From ..." line, creating various other headers with
1930;; information from it if they don't already exist. Now puts the 1896;; information from it if they don't already exist. Now puts the
1931;; original line into a mail-from: header line for debugging and for 1897;; original line into a mail-from: header line for debugging and for