Synch with Oort Gnus.
[elisp/gnus.git-] / lisp / nndoc.el
index 21bd245..fcedf9f 100644 (file)
@@ -706,14 +706,35 @@ from the document.")
   (nndoc-oe-dbx-generate-article article 'head))
 
 (defun nndoc-mail-in-mail-type-p ()
-  (save-excursion
-    (and (search-forward "\n\n" nil t)
-        (re-search-forward "^[-A-Za-z0-9]+: .*\n\\([ \t]?.*\n\\)*\\(^[-A-Za-z0-9]+: .*\n\\([ \t]?.*\n\\)*\\)+\n" nil t)
-        t)))
+  (let (found)
+    (save-excursion
+      (catch 'done
+       (while (re-search-forward "\n\n[-A-Za-z0-9]+:" nil t)
+         (setq found 0)
+         (forward-line)
+         (while (looking-at "[ \t]\\|[-A-Za-z0-9]+:")
+           (if (looking-at "[-A-Za-z0-9]+:")
+               (setq found (1+ found)))
+           (forward-line))
+         (if (and (> found 0) (looking-at "\n"))
+             (throw 'done 9999)))
+       nil))))
 
 (defun nndoc-mail-in-mail-article-begin ()
-  (when (re-search-forward "^[-A-Za-z0-9]+: .*\n\\([ \t]?.*\n\\)*\\(^[-A-Za-z0-9]+: .*\n\\([ \t]?.*\n\\)*\\)+\n" nil t)
-    (goto-char (match-beginning 0))))
+  (let (point found)
+    (if (catch 'done
+         (while (re-search-forward "\n\n\\([-A-Za-z0-9]+:\\)" nil t)
+           (setq found 0)
+           (setq point (match-beginning 1))
+           (forward-line)
+           (while (looking-at "[ \t]\\|[-A-Za-z0-9]+:")
+             (if (looking-at "[-A-Za-z0-9]+:")
+                 (setq found (1+ found)))
+             (forward-line))
+           (if (and (> found 0) (looking-at "\n"))
+               (throw 'done t)))
+         nil)
+       (goto-char point))))
 
 (deffoo nndoc-request-accept-article (group &optional server last)
   nil)