2001-06-03 Dale Hagglund <rdh@best.com>
[gnus] / lisp / nnrss.el
1 ;;; nnrss.el --- interfacing with RSS
2 ;; Copyright (C) 2001  Free Software Foundation, Inc.
3
4 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
5 ;; Keywords: RSS
6
7 ;; This file is part of GNU Emacs.
8
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published
11 ;; by the Free Software Foundation; either version 2, or (at your
12 ;; option) any later version.
13
14 ;; GNU Emacs is distributed in the hope that it will be useful, but
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 ;; General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
23
24 ;;; Commentary:
25
26 ;;; Code:
27
28 (eval-when-compile (require 'cl))
29
30 (require 'nnoo)
31 (require 'nnmail)
32 (require 'message)
33 (require 'mm-util)
34 (require 'gnus-util)
35 (require 'time-date)
36 (require 'rfc2231)
37 (eval-when-compile
38   (ignore-errors
39     (require 'xml)
40     (require 'w3)
41     (require 'w3-forms)
42     (require 'nnweb)))
43 ;; Report failure to find w3 at load time if appropriate.
44 (eval '(progn
45          (require 'xml)
46          (require 'w3)
47          (require 'w3-forms)
48          (require 'nnweb)))
49
50 (nnoo-declare nnrss)
51
52 (defvoo nnrss-directory (nnheader-concat gnus-directory "rss/")
53   "Where nnrss will save its files.")
54
55 ;; (group max rss-url)
56 (defvoo nnrss-server-data nil)
57
58 ;; (num timestamp url subject author date extra)
59 (defvoo nnrss-group-data nil)
60 (defvoo nnrss-group-max 0)
61 (defvoo nnrss-group-min 1)
62 (defvoo nnrss-group nil)
63 (defvoo nnrss-group-hashtb nil)
64 (defvoo nnrss-status-string "")
65
66 (defconst nnrss-version "nnrss 1.0")
67
68 (defvar nnrss-group-alist
69   '(("MacWeek"
70      "http://macweek.zdnet.com/macweek.xml"
71      "The Macintosh news authority.")
72     ("Linux.Weekly.News"
73      "http://lwn.net/headlines/rss")
74     ("Motley.Fool"
75      "http://www.fool.com/About/headlines/rss_headlines.asp")
76     ("NewsForge.rdf"
77      "http://www.newsforge.com/newsforge.rdf")
78     ("Slashdot"
79      "http://www.slashdot.com/slashdot.rdf")
80     ("CNN"
81      "http://www.cnn.com/cnn.rss"
82      "The world's news leader.")
83     ("FreshMeat"
84      "http://freshmeat.net/backend/fm.rdf"
85      "The one-stop-shop for all your Linux software needs.")
86     ("The.Guardian.newspaper"
87      "http://www.guardianunlimited.co.uk/rss/1,,,00.xml"
88      "Intelligent news and comment throughout the day from The Guardian newspaper.")
89     ("MonkeyFist.rdf"
90      "http://monkeyfist.com/rdf.php3"
91      "News and opinion on politics, technology, and eclectic miscellany.")
92     ("NewsForge"
93      "http://www.newsforge.com/newsforge.rss")
94     ("Reuters.Health"
95      "http://www.reutershealth.com/eline.rss"
96      "Consumer-oriented health-related news stories.")
97     ("Salon"
98      "http://www.salon.com/feed/RDF/salon_use.rdf")
99     ("Wired"
100      "http://www.wired.com/news_drop/netcenter/netcenter.rdf")
101     ("ITN"
102      "http://www.itn.co.uk/itn.rdf")
103     ("Meerkat"
104      "http://www.oreillynet.com/meerkat/?_fl=rss10"
105      "An Open Wire Service")
106     ("MonkeyFist"
107      "http://monkeyfist.com/rss1.php3"
108      "News and opinion on politics, technology, and eclectic miscellany.")
109     ("Reuters.Health.rdf"
110      "http://www.reutershealth.com/eline.rdf"
111      "Consumer-oriented health-related news stories.")
112     ;;("4xt" "http://4xt.org/news/general.rss10" "Resources for XT users.")
113     ("Aaronland" "http://aaronland.net/xml/abhb.rdf" "A boy and his basement.")
114     ("Art of the Mix" "http://www.artofthemix.org/xml/rss.asp" "A website devoted to the art of making mixed tapes and cds.")
115     ("Dave Beckett's RDF Resource Guide" "http://www.ilrt.bristol.ac.uk/discovery/rdf/resources/rss.rdf" "A comprehensive guide to resources about RDF.")
116     ("David Chess" "http://www.davidchess.com/words/log.rss" "Mostly-daily musings on philosophy, children, culture, technology, the emergence of life from matter, chocolate, Nomic, and all that sort of thing.")
117     ;;("Dublin Core Metadata Intitiative" "http://www.dublincore.org/news.rss" "Latest news from DCMI.")
118     ("Figby Articles" "http://www.figby.com/index-rss.php" "A weblog with daily stories about technology, books and publishing, privacy, science, and occasional humor.")
119     ;;("Figby News" "http://www.figby.com/news.php" "Categorized RSS feeds from various sources.")
120     ("Figby Quickies" "http://www.figby.com/quickies-rss.php" "Quick commented links to other sites from Figby.com.")
121     ("Flutterby!" "http://www.flutterby.com/main.rdf" "News and views from Dan Lyke.")
122     ("Groovelog" "http://groovelog.agora.co.uk/groove+log/groovelog.nsf/today.rss.xml" "The open-access groove users' weblog.")
123     ;;("Groovelog.rss10" "http://groovelog.agora.co.uk/groove+log/groovelog.nsf/today.rss10.xml" "The open-access groove users' weblog.")
124     ("Hit or Miss" "http://hit-or-miss.org/rss/" "Daily weblog and journal.")
125     ;;("Internet.com Feeds" "http://www.webreference.com/services/news/" "News from ")
126     ("Larkfarm News" "http://www.larkfarm.com/Larkfarm.rdf" "Mike Gunderloy's web site.")
127     ("Latest RFCs" "http://x42.com/rss/rfc.rss")
128     ("Linux Today" "http://linuxtoday.com/backend/biglt.rss")
129     ("Linux Today.rdf" "http://linuxtoday.com/backend/my-netscape10.rdf")
130     ("More Like This WebLog" "http://www.whump.com/moreLikeThis/RSS" "Because the more you know, the more jokes you get.")
131     ("Motivational Quotes of the Day" "http://www.quotationspage.com/data/mqotd.rss" "Four motivational quotations each day from the Quotations Page.")
132     ;;("My Netscape Network" "http://www.dmoz.org/Netscape/My_Netscape_Network/")
133     ;;("My UserLand" "http://my.userland.com/choose")
134     ("Network World Fusion NetFlash" "http://www.nwfusion.com/netflash.rss" "Daily breaking news about networking products, technologies and services.")
135     ;;("News Feeds" "http://newsfeeds.manilasites.com/" "Jeff Barr highlights high quality RSS feeds.")
136     ;;("News Is Free Export" "http://www.newsisfree.com/export.php3")
137     ("News Is Free" "http://www.newsisfree.com/news.rdf.php3")
138     ;;("News is Free XML Export" "http://www.newsisfree.com/ocs/directory.xml")
139     ("O'Reilly Network Articles" "http://www.oreillynet.com/cs/rss/query/q/260?x-ver=1.0")
140     ("Quotes of the Day" "http://www.quotationspage.com/data/qotd.rss" "Four humorous quotations each day from the Quotations Page.")
141     ("RDF Interest Group" "http://ilrt.org/discovery/rdf-dev/roads/cgi-bin/desire/ig2rss?list=www-rdf-interest" "An experimental channel scraped from the RDF Interest Group mail archives.")
142     ("RDF Logic List" "http://ilrt.org/discovery/rdf-dev/roads/cgi-bin/desire/ig2rss?list=www-rdf-logic" "An experimental channel scraped from the RDF Logic mail archives.")
143     ("RSS Info" "http://www.blogspace.com/rss/rss10" "News and information on the RSS format")
144     ;;("RSS-DEV listing" "http://www.egroups.com/links/rss-dev/Feeds_000966335046/" "A listing of RSS files from the RSS-DEV list.")
145     ("Semantic Web List" "http://ilrt.org/discovery/rdf-dev/roads/cgi-bin/desire/ig2rss?list=semantic-web" "An experimental channel scraped from the W3C's Semantic Web mail archives.")
146     ;;("Sherch!" "http://www.sherch.com/~pldms/cgi-bin/sherch.pl" "Sherlock for the rest of us.")
147     ;;("Street Fusion Archived Financial Webcasts" "http://partners.streetfusion.com/rdf/archive.rdf")
148     ;;("Street Fusion Upcoming Financial Webcasts" "http://partners.streetfusion.com/rdf/live.rdf")
149     ;;("TNL.net newsletter" "http://www.tnl.net/newsletter/channel100.asp" "A newsletter about Internet technology and issues.")
150     ("W3C" "http://www.w3.org/2000/08/w3c-synd/home.rss" "The latest news at the World Wide Web Consortium.")
151     ;;("XML News: RSS Live Content" "http://www.xmlnews.org/RSS/content.html" "A listing of well-known RSS feeds.")
152     ("XMLfr" "http://xmlfr.org/actualites/general.rss10" "French speaking portal site dedicated to XML.")
153     ("XMLhack" "http://xmlhack.com/rss10.php" "Developer news from the XML community.")))
154
155 (defvar nnrss-use-local nil)
156
157 (defvar nnrss-description-field 'X-Gnus-Description
158   "Field name used for DESCRIPTION.
159 To use the description in headers, put this name into `nnmail-extra-headers'.")
160
161 (nnoo-define-basics nnrss)
162
163 ;;; Interface functions
164
165 (deffoo nnrss-retrieve-headers (articles &optional group server fetch-old)
166   (nnrss-possibly-change-group group server)
167   (let (e)
168     (save-excursion
169       (set-buffer nntp-server-buffer)
170       (erase-buffer)
171       (dolist (article articles)
172         (if (setq e (assq article nnrss-group-data))
173             (insert (number-to-string (car e)) "\t" ;; number
174                     (if (nth 3 e)
175                         (nnrss-format-string (nth 3 e)) "")
176                     "\t" ;; subject
177                     (if (nth 4 e)
178                         (nnrss-format-string (nth 4 e))
179                         "(nobody)")
180                     "\t" ;;from
181                     (or (nth 5 e) "")
182                     "\t" ;; date
183                     (format "<%d@%s.nnrss>" (car e) group)
184                     "\t" ;; id
185                     "\t" ;; refs
186                     "0" "\t" ;; chars
187                     "0" "\t" ;; lines
188                     "" "\t" ;; Xref
189                     (if (memq nnrss-description-field nnmail-extra-headers)
190                         (concat (symbol-name nnrss-description-field)
191                                 ": "
192                                 (nnrss-format-string (nth 6 e)) "\t")
193                       "")
194                     "\n")))))
195   'nov)
196
197 (deffoo nnrss-request-group (group &optional server dont-check)
198   (nnrss-possibly-change-group group server)
199   (if dont-check
200       t
201     (nnrss-check-group group server)
202     (nnheader-report 'nnrss "Opened group %s" group)
203     (nnheader-insert
204      "211 %d %d %d %s\n" nnrss-group-max nnrss-group-min nnrss-group-max
205      (prin1-to-string group)
206      t)))
207
208 (deffoo nnrss-close-group (group &optional server)
209   t)
210
211 (deffoo nnrss-request-article (article &optional group server buffer)
212   (nnrss-possibly-change-group group server)
213   (let ((e (assq article nnrss-group-data))
214         (nntp-server-buffer (or buffer nntp-server-buffer))
215         post err)
216     (when e
217       (catch 'error
218         (with-current-buffer nntp-server-buffer
219           (erase-buffer)
220           (goto-char (point-min))
221           (if (nth 3 e)
222               (insert "Subject: " (nnrss-format-string (nth 3 e)) "\n"))
223           (if (nth 4 e)
224               (insert "From: " (nnrss-format-string (nth 4 e)) "\n"))
225           (if (nth 5 e)
226               (insert "Date: " (nnrss-format-string (nth 5 e)) "\n"))
227           (insert "Message-ID: " (format "<%d@%s.nnrss>" (car e) group) "\n")
228           (insert "\n")
229           (if (nth 6 e)
230               (let ((point (point)))
231                 (insert (nnrss-string-as-multibyte (nth 6 e)) "\n\n")
232                 (fill-region point (point))))
233           (if (nth 2 e)
234               (insert (nth 2 e) "\n")))))
235     (cond
236      (err
237       (nnheader-report 'nnrss err))
238      ((not e)
239       (nnheader-report 'nnrss "No such id: %d" article))
240      (t
241       (nnheader-report 'nnrss "Article %s retrieved" (car e))
242       ;; We return the article number.
243       (cons nnrss-group (car e))))))
244
245 (deffoo nnrss-request-list (&optional server)
246   (nnrss-possibly-change-group nil server)
247   (nnrss-generate-active)
248   t)
249
250 (deffoo nnrss-open-server (server &optional defs connectionless)
251   (nnrss-read-server-data server)
252   (nnoo-change-server 'nnrss server defs)
253   t)
254
255 (deffoo nnrss-request-expire-articles
256     (articles group &optional server force)
257   (nnrss-possibly-change-group group server)
258   (let (e days not-expirable changed)
259     (dolist (art articles)
260       (if (and (setq e (assq art nnrss-group-data))
261                (nnmail-expired-article-p
262                 group
263                 (if (listp (setq days (nth 1 e))) days 
264                   (days-to-time (- days (time-to-days '(0 0)))))
265                 force))
266           (setq nnrss-group-data (delq e nnrss-group-data)
267                 changed t)
268         (push art not-expirable)))
269     (if changed
270         (nnrss-save-group-data group server))
271     not-expirable))
272
273 (deffoo nnrss-request-delete-group (group &optional force server)
274   (nnrss-possibly-change-group group server)
275   (setq nnrss-server-data
276         (delq (assoc group nnrss-server-data) nnrss-server-data))
277   (nnrss-save-server-data server)
278   (let ((file (expand-file-name 
279                (nnrss-translate-file-chars
280                 (concat group (and server
281                                    (not (equal server ""))
282                                    "-")
283                         server ".el")) nnrss-directory)))
284     (ignore-errors
285       (delete-file file)))
286   t)
287
288 (deffoo nnrss-request-list-newsgroups (&optional server)
289   (nnrss-possibly-change-group nil server)
290   (save-excursion
291     (set-buffer nntp-server-buffer)
292     (erase-buffer)
293     (dolist (elem nnrss-group-alist)
294       (if (third elem)
295           (insert (car elem) "\t" (third elem) "\n"))))
296   t)
297
298 (nnoo-define-skeleton nnrss)
299
300 ;;; Internal functions
301
302 (defun nnrss-possibly-change-group (&optional group server)
303   (when (and server
304              (not (nnrss-server-opened server)))
305     (nnrss-open-server server))
306   (when (and group (not (equal group nnrss-group)))
307     (nnrss-read-group-data group server)
308     (setq nnrss-group group)))
309
310 (defvar nnrss-extra-categories '(nnrss-snarf-moreover-categories))
311
312 (defun nnrss-generate-active ()
313   (if (y-or-n-p "Fetch extra categories?")
314       (dolist (func nnrss-extra-categories)
315         (funcall func)))
316   (save-excursion
317     (set-buffer nntp-server-buffer)
318     (erase-buffer)
319     (dolist (elem nnrss-group-alist)
320       (insert (prin1-to-string (car elem)) " 0 1 y\n"))
321     (dolist (elem nnrss-server-data)
322       (unless (assoc (car elem) nnrss-group-alist)
323         (insert (prin1-to-string (car elem)) " 0 1 y\n")))))
324
325 ;;; Data functions
326
327 (defun nnrss-read-server-data (server)
328   (setq nnrss-server-data nil)
329   (let ((file (expand-file-name 
330                (nnrss-translate-file-chars
331                 (concat "nnrss" (and server
332                                      (not (equal server ""))
333                                      "-")
334                         server
335                         ".el"))
336                nnrss-directory)))
337     (when (file-exists-p file)
338       (with-temp-buffer
339         (let ((coding-system-for-read 'binary))
340           (insert-file-contents file))
341         (emacs-lisp-mode)
342         (goto-char (point-min))
343         (eval-buffer)))))
344
345 (defun nnrss-save-server-data (server)
346   (gnus-make-directory nnrss-directory)
347   (let ((file (expand-file-name 
348                (nnrss-translate-file-chars
349                 (concat "nnrss" (and server
350                                      (not (equal server ""))
351                                      "-")
352                         server ".el"))
353                nnrss-directory)))
354     (let ((coding-system-for-write 'binary))
355       (with-temp-file file
356         (insert "(setq nnrss-server-data '"
357                 (prin1-to-string nnrss-server-data)
358                 ")\n")))))
359
360 (defun nnrss-read-group-data (group server)
361   (setq nnrss-group-data nil)
362   (setq nnrss-group-hashtb (gnus-make-hashtable))
363   (let ((pair (assoc group nnrss-server-data)))
364     (setq nnrss-group-max (or (cadr pair) 0))
365     (setq nnrss-group-min (+ nnrss-group-max 1)))
366   (let ((file (expand-file-name 
367                (nnrss-translate-file-chars
368                 (concat group (and server
369                                    (not (equal server ""))
370                                    "-")
371                         server ".el"))
372                nnrss-directory)))
373     (when (file-exists-p file)
374       (with-temp-buffer
375         (let ((coding-system-for-read 'binary))
376           (insert-file-contents file))
377         (emacs-lisp-mode)
378         (goto-char (point-min))
379         (eval-buffer))
380       (dolist (e nnrss-group-data)
381         (gnus-sethash (nth 2 e) e nnrss-group-hashtb)
382         (if (and (car e) (> nnrss-group-min (car e)))
383             (setq nnrss-group-min (car e)))
384         (if (and (car e) (< nnrss-group-max (car e)))
385             (setq nnrss-group-max (car e)))))))
386
387 (defun nnrss-save-group-data (group server)
388   (gnus-make-directory nnrss-directory)
389   (let ((file (expand-file-name 
390                (nnrss-translate-file-chars
391                 (concat group (and server
392                                    (not (equal server ""))
393                                    "-")
394                         server ".el"))
395                nnrss-directory)))
396     (let ((coding-system-for-write 'binary))
397       (with-temp-file file
398         (insert "(setq nnrss-group-data '"
399                 (prin1-to-string nnrss-group-data)
400                 ")\n")))))
401
402 ;;; URL interface
403
404 (defun nnrss-no-cache (url)
405   "")
406
407 ;; TODO:: disable cache.
408 ;;
409 ;; (defun nnrss-insert-w3 (url)
410 ;;   (require 'url)
411 ;;   (require 'url-cache)
412 ;;   (let ((url-cache-creation-function 'nnrss-no-cache))
413 ;;     (mm-with-unibyte-current-buffer
414 ;;       (nnweb-insert url))))
415
416 (defun nnrss-insert-w3 (url)
417   (mm-with-unibyte-current-buffer
418     (nnweb-insert url)))
419
420 (defun nnrss-decode-entities-unibyte-string (string)
421   (mm-with-unibyte-buffer
422     (insert string)
423     (nnweb-decode-entities)
424     (buffer-substring (point-min) (point-max))))
425
426 (defalias 'nnrss-insert 'nnrss-insert-w3)
427
428 (if (featurep 'xemacs)
429     (defalias 'nnrss-string-as-multibyte 'identity)
430   (defalias 'nnrss-string-as-multibyte 'string-as-multibyte))
431
432 ;;; Snarf functions
433
434 (defun nnrss-check-group (group server)
435   (let ((w3-html-entities (cons '(nbsp . 32) w3-html-entities))
436         file xml subject url extra changed author date)
437     (condition-case err
438         (mm-with-unibyte-buffer
439           (if (and nnrss-use-local
440                    (file-exists-p (setq file (expand-file-name
441                                           (nnrss-translate-file-chars
442                                            (concat group ".xml"))
443                                           nnrss-directory))))
444               (insert-file-contents file)
445             (setq url (or (nth 2 (assoc group nnrss-server-data))
446                           (second (assoc group nnrss-group-alist))))
447             (unless url
448               (setq url
449                 (read-string (format "RSS url of %s: " group "http://")))
450               (let ((pair (assoc group nnrss-server-data)))
451                 (if pair
452                     (setcdr (cdr pair) (list url))
453                   (push (list group nnrss-group-max url) nnrss-server-data)))
454               (setq changed t))
455             (nnrss-insert url))
456           (goto-char (point-min))
457           (while (re-search-forward "\r\n?" nil t)
458             (replace-match "\n"))
459           (goto-char (point-min))
460           (if (re-search-forward "<rdf\\|<rss" nil t)
461               (goto-char (match-beginning 0)))
462           (setq xml (xml-parse-region (point) (point-max))))
463       (error 
464        (nnheader-message 1 "Error in group %s: %s" group (cadr err))))
465     (while (and xml (not (assq 'item xml)))
466       (unless (listp (car (setq xml (cddar xml))))
467         (setq xml nil)))
468     (dolist (item (nreverse xml))
469        (when (and (listp item)
470                   (eq 'item (car item))
471                   (setq url (nnrss-node-text (assq 'link (cddr item))))
472                   (setq url (nnrss-decode-entities-unibyte-string url))
473                   (not (gnus-gethash url nnrss-group-hashtb)))
474          (setq subject (nnrss-node-text (assq 'title (cddr item))))
475          (setq extra (or (nnrss-node-text (assq 'description (cddr item)))
476                          (nnrss-node-text (assq 'dc:description (cddr item)))))
477          (setq author (nnrss-node-text (assq 'dc:creator (cddr item))))
478          (setq date (or (nnrss-node-text (assq 'dc:date (cddr item)))
479                         (message-make-date)))
480          (push
481           (list
482            (incf nnrss-group-max)
483            (current-time)
484            url
485            (and subject (nnrss-decode-entities-unibyte-string subject))
486            (and author (nnrss-decode-entities-unibyte-string author))
487            date
488            (and extra (nnrss-decode-entities-unibyte-string extra)))
489           nnrss-group-data)
490          (gnus-sethash url (car nnrss-group-data) nnrss-group-hashtb)
491          (setq changed t)))
492     (when changed
493       (nnrss-save-group-data group server)
494       (let ((pair (assoc group nnrss-server-data)))
495         (if pair
496             (setcar (cdr pair) nnrss-group-max)
497           (push (list group nnrss-group-max) nnrss-server-data)))
498       (nnrss-save-server-data server))))
499
500 (defun nnrss-generate-download-script ()
501   "Generate a download script in the current buffer.
502 It is useful when `(setq nnrss-use-local t)'."
503   (interactive)
504   (insert "#!/bin/sh\n")
505   (insert "WGET=wget\n")
506   (insert "RSSDIR='" (expand-file-name nnrss-directory) "'\n")
507   (dolist (elem nnrss-server-data)
508     (let ((url (or (nth 2 elem)
509                    (second (assoc (car elem) nnrss-group-alist)))))
510     (insert "$WGET -q -O \"$RSSDIR\"/'" 
511             (nnrss-translate-file-chars (concat (car elem) ".xml"))
512             "' '" url "'\n"))))
513
514 (defun nnrss-translate-file-chars (name)
515   (let ((nnheader-file-name-translation-alist
516          (append nnheader-file-name-translation-alist '((?' . ?_)))))
517     (nnheader-translate-file-chars name)))
518
519 (defvar nnrss-moreover-url 
520   "http://w.moreover.com/categories/category_list_rss.html"
521   "The url of moreover.com categories.")
522
523 (defun nnrss-snarf-moreover-categories ()
524   "Snarf RSS links from moreover.com."
525   (interactive)
526   (let (category name url changed)
527     (with-temp-buffer
528       (nnrss-insert nnrss-moreover-url)
529       (goto-char (point-min))
530       (while (re-search-forward 
531               "<A NAME=\"\\([^\"]+\\)\">\\|<A HREF=\"\\(http://[^\"]*moreover\\.com[^\"]+page\\?c=\\([^\"&]+\\)&o=rss\\)" nil t)
532         (if (match-string 1)
533             (setq category (match-string 1))
534           (setq url (match-string 2)
535                 name (nnweb-decode-entities-string
536                       (rfc2231-decode-encoded-string 
537                        (match-string 3))))
538           (if category
539               (setq name (concat category "." name)))
540           (unless (assoc name nnrss-server-data)
541             (setq changed t)
542             (push (list name 0 url) nnrss-server-data)))))
543     (if changed
544         (nnrss-save-server-data ""))))
545
546 (defun nnrss-format-string (string)
547   (nnweb-replace-in-string (nnrss-string-as-multibyte string) " *\n *" " "))
548
549 (defun nnrss-node-text (node)
550   (if (stringp node) node
551     (mapconcat 'nnrss-node-text (xml-node-children node) "")))
552
553 (provide 'nnrss)
554
555 ;;; nnrss.el ends here