Function: nnfeed--parse-feed
nnfeed--parse-feed is a byte-compiled function defined in
nnfeed.el.gz.
Signature
(nnfeed--parse-feed FEED &optional GROUP)
Documentation
Parse GROUP from FEED into a new or existing server.
If GROUP is omitted or nil, parse the entire FEED.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/nnfeed.el.gz
;; The following function uses the parsing functions defined in the last
;; section to parse a feed (or just one group from it).
;; This is the only place where these parsing functions are used; the Gnus
;; backend interface extracts all required information from the parsed feed.
(defun nnfeed--parse-feed (feed &optional group)
"Parse GROUP from FEED into a new or existing server.
If GROUP is omitted or nil, parse the entire FEED."
(let* ((feed (nnfeed--server-address feed))
(s (or (gethash feed nnfeed-servers) (nnfeed--read-server feed)
(make-hash-table :test 'equal)))
(name group) ; (Maybe) fake name (or nil)
(group (aref (gethash group s `[,group]) 0)) ; Real name (or nil)
data)
(when (setq data (funcall nnfeed-read-feed-function feed group))
(while-let ((cg (or (and name (cons data)) ; `data' is a single group
(funcall nnfeed-read-group-function data)))
(cg (prog1 (car cg) (setq data (cdr cg)))))
(let* ((name (funcall nnfeed-read-title-function cg)) ; Real name
(group (gethash name nnfeed-group-names name)) ; (Maybe) fake name
(info (gnus-get-info
(concat (symbol-name nnfeed-backend) "+" feed ":" group)))
(g (or (gethash group s)
`[ ,name ,(make-hash-table :test 'equal)
,(make-hash-table :test 'eql) nil 1 ""]))
(desc (funcall nnfeed-read-description-function cg))
(ids (aref g 1))
(articles (aref g 2))
(max (aref g 3))
(max (if max max
(setq max 0) ; Find max article number
(dolist ; remembered by Gnus.
( r (cons (gnus-info-read info)
(gnus-info-marks info))
max)
(mapc (lambda (x)
(let ((x (if (consp x)
(if (< (car x) (cdr x))
(cdr x) (car x))
x)))
(when (< max x) (setq max x))))
(if (symbolp (car r)) (cdr r) r)))))
(group-author (funcall nnfeed-read-group-author-function cg))
stale)
(and desc (aset g 5 desc))
(while-let ((article (funcall nnfeed-read-article-function cg stale))
(article (prog1 (car article) (setq cg (cdr article)))))
(when-let* ((id (funcall nnfeed-read-id-function article))
(id (format "<%s@%s.%s>" id name nnfeed-backend)))
(let* ((num (gethash id ids))
(update (funcall nnfeed-read-update-date-function article))
(prev-update (aref (gethash num articles
'[nil nil nil nil nil])
4)))
(if (or (null num) ; New article ID.
(and (null prev-update) update)
(and prev-update update
(time-less-p prev-update update)))
(let* ((num (or num (aset g 3 (setq max (1+ max)))))
(publish (funcall nnfeed-read-publish-date-function
article)))
(setf
(gethash id (aref g 1)) num
(gethash num (aref g 2))
`[ ,id
,(or (funcall nnfeed-read-author-function article)
group-author group)
,(or (funcall nnfeed-read-subject-function article)
"no subject")
,(or publish update '(0 0)) ; published
,(or update publish '(0 0)) ; updated
,(funcall nnfeed-read-links-function article)
,(funcall nnfeed-read-parts-function article)
,(funcall nnfeed-read-headers-function article)]
stale nil))
(setq stale t)))))
(puthash group g s)))
(puthash feed s nnfeed-servers))))