*** empty log message ***
[elisp/flim.git] / eword-decode.el
index 08ca6d6..49e2761 100644 (file)
@@ -724,8 +724,7 @@ such as a version of Net$cape)."
   (let* ((field-name (make-string (1- start-column) ?X))
         (field-body (ew-lf-crlf-to-crlf string))
         (ew-decode-field-default-syntax '(ew-scan-unibyte-std11))
-        (decoded (ew-decode-field field-name field-body
-                                  (if must-unfold 'ew-cut-cr-lf))))
+        (decoded (ew-decode-field field-name field-body)))
     (unless (equal field-body decoded)
       (setq decoded (ew-crlf-refold decoded start-column max-column)))
     (ew-crlf-to-lf decoded)))
@@ -740,10 +739,8 @@ If an encoded-word is broken or your emacs implementation can not
 decode the charset included in it, it is not decoded."
   (rotate-memo args-eword-decode-and-unfold-structured-field (list string))
   (let* ((ew-decode-field-default-syntax '(ew-scan-unibyte-std11))
-        (decoded (ew-decode-field ""
-                                  (ew-lf-crlf-to-crlf string)
-                                  'ew-cut-cr-lf)))
-    (ew-cut-cr-lf decoded)))
+        (decoded (ew-decode-field "" (ew-lf-crlf-to-crlf string))))
+    (ew-crlf-to-lf (ew-crlf-unfold decoded))))
 
 (defun eword-decode-structured-field-body (string &optional must-unfold
                                                  start-column max-column)
@@ -763,18 +760,13 @@ such as a version of Net$cape)."
   (rotate-memo args-eword-decode-structured-field-body
               (list string must-unfold start-column max-column))
   (if start-column
-      ;; fold with max-column (folding is not implemented.)
-      (let* ((ew-decode-field-default-syntax '(ew-scan-unibyte-std11))
-            (decoded (ew-decode-field (make-string (1- start-column) ?X)
-                                      (ew-lf-crlf-to-crlf string)
-                                      (if must-unfold 'ew-cut-cr-lf))))
-       (if must-unfold (ew-cut-cr-lf decoded) (ew-crlf-to-lf decoded)))
+      ;; fold with max-column
+      (eword-decode-and-fold-structured-field
+       string start-column max-column must-unfold)
     ;; Don't fold
     (let* ((ew-decode-field-default-syntax '(ew-scan-unibyte-std11))
-          (decoded (ew-decode-field ""
-                                    (ew-lf-crlf-to-crlf string)
-                                    (if must-unfold 'ew-cut-cr-lf))))
-      (if must-unfold (ew-cut-cr-lf decoded) (ew-crlf-to-lf decoded)))))
+          (decoded (ew-decode-field "" (ew-lf-crlf-to-crlf string))))
+      (ew-crlf-to-lf decoded))))
 
 (defun eword-decode-unstructured-field-body (string &optional must-unfold)
   "Decode non us-ascii characters in STRING as unstructured field body.
@@ -792,10 +784,8 @@ if there are in decoded encoded-words (generated by bad manner MUA
 such as a version of Net$cape)."
   (rotate-memo args-eword-decode-unstructured-field-body
               (list string must-unfold))
-  (let ((decoded (ew-decode-field ""
-                                 (ew-lf-crlf-to-crlf string)
-                                 (if must-unfold 'ew-cut-cr-lf))))
-    (if must-unfold (ew-cut-cr-lf decoded) (ew-crlf-to-lf decoded))))
+  (let ((decoded (ew-decode-field "" (ew-lf-crlf-to-crlf string))))
+    (ew-crlf-to-lf (ew-crlf-unfold decoded))))
 
 (defun eword-extract-address-components (string)
   "Extract full name and canonical address from STRING.