From: Michaƫl Cadilhac Date: Fri, 20 Jul 2007 13:50:19 +0000 (+0000) Subject: (nnrss-ignore-article-fields): New variable. List of fields that X-Git-Url: http://cgit.sxemacs.org/?p=gnus;a=commitdiff_plain;h=348a91cb4b4531c86c0d86a65cb83a5c25e8a3f1 (nnrss-ignore-article-fields): New variable. List of fields that should be ignored when comparing distant RSS articles with local ones. (nnrss-make-hash-index): New function. Create a hash index according to the ignored fields. (nnrss-check-group): Use it. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index dd3fad083..a4de9bad7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2007-07-20 Micha,Ak(Bl Cadilhac + + * nnrss.el (nnrss-ignore-article-fields): New variable. List of fields + that should be ignored when comparing distant RSS articles with local + ones. + (nnrss-make-hash-index): New function. Create a hash index according + to the ignored fields. + (nnrss-check-group): Use it. + 2007-07-20 Katsumi Yamaoka * gnus-agent.el (gnus-agent-group-pathname): Take notice of the method. @@ -2083,7 +2092,7 @@ * nnrss.el (nnrss-check-group): Bind hash-index. -2006-05-23 Michael Cadilhac +2006-05-23 Micha,Ak(Bl Cadilhac * nnrss.el (nnrss-check-group): Use the md5sum of the whole RSS item as its hash index. Store this hash in `nnrss-group-data'. diff --git a/lisp/nnrss.el b/lisp/nnrss.el index 2e6ac31d5..e65c3380a 100644 --- a/lisp/nnrss.el +++ b/lisp/nnrss.el @@ -50,6 +50,15 @@ (defvoo nnrss-directory (nnheader-concat gnus-directory "rss/") "Where nnrss will save its files.") +(defvoo nnrss-ignore-article-fields '(slash:comments) + "*List of fields that should be ignored when comparing RSS articles. +Some RSS feeds update article fields during their lives, e.g. to +indicate the number of comments or the number of times the +articles have been seen. However, if there is a difference +between the local article and the distant one, the latter is +considered to be new. To avoid this and discard some fields, set +this variable to the list of fields to be ignored.") + ;; (group max rss-url) (defvoo nnrss-server-data nil) @@ -670,6 +679,16 @@ which RSS 2.0 allows." ;;; Snarf functions +(defun nnrss-make-hash-index (item) + (setq item (remove-if + (lambda (field) + (when (listp field) + (memq (car field) nnrss-ignore-article-fields))) + item)) + (md5 (gnus-prin1-to-string item) + nil nil + nnrss-file-coding-system)) + (defun nnrss-check-group (group server) (let (file xml subject url extra changed author date feed-subject enclosure comments rss-ns rdf-ns content-ns dc-ns @@ -705,9 +724,7 @@ which RSS 2.0 allows." (dolist (item (nreverse (nnrss-find-el (intern (concat rss-ns "item")) xml))) (when (and (listp item) (string= (concat rss-ns "item") (car item)) - (progn (setq hash-index (md5 (gnus-prin1-to-string item) - nil nil - nnrss-file-coding-system)) + (progn (setq hash-index (nnrss-make-hash-index item)) (not (gethash hash-index nnrss-group-hashtb)))) (setq subject (nnrss-node-text rss-ns 'title item)) (setq url (nnrss-decode-entities-string