(nnrss-ignore-article-fields): New variable. List of fields that
authorMichaël Cadilhac <michael@cadilhac.name>
Fri, 20 Jul 2007 13:50:19 +0000 (13:50 +0000)
committerMichaël Cadilhac <michael@cadilhac.name>
Fri, 20 Jul 2007 13:50:19 +0000 (13:50 +0000)
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.

lisp/ChangeLog
lisp/nnrss.el

index dd3fad0..a4de9ba 100644 (file)
@@ -1,3 +1,12 @@
+2007-07-20  Micha\e,Ak\e(Bl Cadilhac <michael@cadilhac.name>
+
+       * 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  <yamaoka@jpl.org>
 
        * gnus-agent.el (gnus-agent-group-pathname): Take notice of the method.
 
        * nnrss.el (nnrss-check-group): Bind hash-index.
 
-2006-05-23  Michael Cadilhac  <michael.cadilhac@lrde.org>
+2006-05-23  Micha\e,Ak\e(Bl Cadilhac  <michael.cadilhac@lrde.org>
 
        * nnrss.el (nnrss-check-group): Use the md5sum of the whole RSS item as
        its hash index.  Store this hash in `nnrss-group-data'.
index 2e6ac31..e65c338 100644 (file)
 (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