]> git.eshelyaron.com Git - emacs.git/commitdiff
(rmail-convert-to-babyl-format): Use mail-unquote-printable-region.
authorRichard M. Stallman <rms@gnu.org>
Mon, 12 Jan 2004 21:59:03 +0000 (21:59 +0000)
committerRichard M. Stallman <rms@gnu.org>
Mon, 12 Jan 2004 21:59:03 +0000 (21:59 +0000)
(rmail-hex-string-to-integer, rmail-decode-quoted-printable):
(rmail-hex-char-to-integer): Functions deleted.

lisp/ChangeLog
lisp/mail/rmail.el

index 7029193eec9995f81d3acdafd3ce536918eff014..47a9afe7a56ad9e732f54808b850ac875a87aeac 100644 (file)
@@ -1,3 +1,14 @@
+2004-01-12  Richard M. Stallman  <rms@gnu.org>
+
+       * mail/rmail.el (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.
+
+       * mail/mail-utils.el (mail-unquote-printable-hexdigit): Upcase CHAR.
+       (mail-unquote-printable-region): New arg NOERROR.
+       For invalid encoding, either signal an error to just return nil.
+
 2004-01-11  Glenn Morris  <gmorris@ast.cam.ac.uk>
 
        * calendar/appt.el: Update copyright and commentary.
index 6185fd12286d2159aa67db36619153ccbbfbc7dc..cc2d595d8a62c6605c3687091bf503ff5e2f32fb 100644 (file)
@@ -1680,7 +1680,9 @@ It returns t if it got any new messages."
                            header-end t))))
                   (if quoted-printable-header-field-end
                       (save-excursion
-                        (rmail-decode-quoted-printable header-end (point))
+                        (unless
+                            (mail-unquote-printable-region header-end (point) nil t)
+                          (message "Malformed MIME quoted-printable message"))
                         ;; Change "quoted-printable" to "8bit",
                         ;; to reflect the decoding we just did.
                         (goto-char quoted-printable-header-field-end)
@@ -1825,7 +1827,10 @@ It returns t if it got any new messages."
                 (setq count (1+ count))
                 (if quoted-printable-header-field-end
                     (save-excursion
-                      (rmail-decode-quoted-printable header-end (point))
+                      (unless
+                          (mail-unquote-printable-region header-end (point) nil t)
+                        
+                        (message "Malformed MIME quoted-printable message"))
                       ;; Change "quoted-printable" to "8bit",
                       ;; to reflect the decoding we just did.
                       (goto-char quoted-printable-header-field-end)
@@ -1887,45 +1892,6 @@ It returns t if it got any new messages."
              (t (error "Cannot convert to babyl format")))))
     count))
 
-(defun rmail-hex-char-to-integer (character)
-  "Return CHARACTER's value interpreted as a hex digit."
-  (if (and (>= character ?0) (<= character ?9))
-      (- character ?0)
-    (let ((ch (logior character 32)))
-      (if (and (>= ch ?a) (<= ch ?f))
-         (- ch (- ?a 10))
-       (error "Invalid hex digit `%c'" ch)))))
-
-(defun rmail-hex-string-to-integer (hex-string)
-  "Return decimal integer for HEX-STRING."
-  (let ((hex-num 0)
-       (index 0))
-    (while (< index (length hex-string))
-      (setq hex-num (+ (* hex-num 16)
-                      (rmail-hex-char-to-integer (aref hex-string index))))
-      (setq index (1+ index)))
-    hex-num))
-
-(defun rmail-decode-quoted-printable (from to)
-  "Decode Quoted-Printable in the region between FROM and TO."
-  (interactive "r")
-  (goto-char from)
-  (or (markerp to)
-      (setq to (copy-marker to)))
-  (while (search-forward "=" to t)
-    (cond ((eq (following-char) ?\n)
-          (delete-char -1)
-          (delete-char 1))
-         ((looking-at "[0-9A-F][0-9A-F]")
-          (let ((byte (rmail-hex-string-to-integer
-                       (buffer-substring (point) (+ 2 (point))))))
-            (delete-region (1- (point)) (+ 2 (point)))
-            (insert byte)))
-         ((looking-at "=")
-          (delete-char 1))
-         (t
-          (message "Malformed MIME quoted-printable message")))))
-
 ;; Delete the "From ..." line, creating various other headers with
 ;; information from it if they don't already exist.  Now puts the
 ;; original line into a mail-from: header line for debugging and for