diff options
| author | Jakub Ječmínek <kuba@kubajecminek.cz> | 2025-08-25 19:41:51 +0200 |
|---|---|---|
| committer | Robert Pluim <rpluim@gmail.com> | 2025-09-26 16:03:11 +0200 |
| commit | d3333cb1b255efc19d862320dbbb8134714eedae (patch) | |
| tree | 0cfd4fc144251d5bbb50b8e9c171adb9930a1540 | |
| parent | bf750adc4e637d871d551bab5b5c6ff9240797ed (diff) | |
nnmbox-read-mbox: fix Xref header parsing
* lisp/gnus/nnmbox.el (nnmbox-read-mbox): Use the 'mail-fetch-field'
function instead of a broken regexp which matched Date-like headers.
(Bug#79167)
| -rw-r--r-- | lisp/gnus/nnmbox.el | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/lisp/gnus/nnmbox.el b/lisp/gnus/nnmbox.el index fb024bf9ef8..f8575445b65 100644 --- a/lisp/gnus/nnmbox.el +++ b/lisp/gnus/nnmbox.el @@ -683,19 +683,24 @@ ;; headers). In this case, there is an Xref line which ;; provides the relevant information to construct the ;; missing header(s). - (save-excursion - (save-restriction - (narrow-to-region start end) - (if (re-search-forward "\nXref: [^ ]+" end-header t) - ;; generate headers from Xref: - (let (alist) - (while (re-search-forward " \\([^:]+\\):\\([0-9]+\\)" end-header t) - (push (cons (match-string 1) - (string-to-number (match-string 2))) alist)) - (nnmbox-insert-newsgroup-line alist)) - ;; this is really a new article - (nnmbox-save-mail - (nnmail-article-group 'nnmbox-active-number)))))) + (save-excursion + (save-restriction + (narrow-to-region start end) + (let ((xref (with-restriction start end-header + (mail-fetch-field "Xref"))) + alist) + (if (null xref) + ;; this is a new article + (nnmbox-save-mail + (nnmail-article-group 'nnmbox-active-number)) + ;; generate headers from Xref + ;; the first element is hostname so we skip it + (dolist (xref-entry (cdr (split-string xref " "))) + (push (cons + (car (setq xref-entry (split-string xref-entry ":"))) + (string-to-number (cadr xref-entry))) + alist)) + (nnmbox-insert-newsgroup-line alist)))))) (goto-char end)) ;; put article lists in order (setq alist nnmbox-group-active-articles) |
