Mercurial > emacs
annotate lisp/net/newst-backend.el @ 100125:e41ac6b691bb
(doprnt1): Fix size of charbuf.
author | Andreas Schwab <schwab@suse.de> |
---|---|
date | Tue, 02 Dec 2008 22:34:12 +0000 |
parents | 7161bac8c5a8 |
children | afc7ba4fff7a |
rev | line source |
---|---|
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1 ;;; newst-backend.el --- Retrieval backend for newsticker. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
5 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
6 ;; Author: Ulf Jasper <ulf.jasper@web.de> |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
7 ;; Filename: newst-backend.el |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
8 ;; URL: http://www.nongnu.org/newsticker |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
9 ;; Keywords: News, RSS, Atom |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
10 ;; Time-stamp: "24. November 2008, 19:39:24 (ulf)" |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
11 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
12 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
13 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
14 ;; This file is part of GNU Emacs. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
15 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
16 ;; GNU Emacs is free software: you can redistribute it and/or modify |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
17 ;; it under the terms of the GNU General Public License as published by |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
18 ;; the Free Software Foundation, either version 3 of the License, or |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
19 ;; (at your option) any later version. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
20 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
21 ;; GNU Emacs is distributed in the hope that it will be useful, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
22 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
24 ;; GNU General Public License for more details. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
25 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
26 ;; You should have received a copy of the GNU General Public License |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
27 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
28 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
29 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
30 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
31 ;;; Commentary: |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
32 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
33 ;; See newsticker.el |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
34 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
35 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
36 ;;; Code: |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
37 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
38 (require 'derived) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
39 (require 'xml) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
40 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
41 ;; Silence warnings |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
42 (defvar w3-mode-map) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
43 (defvar w3m-minor-mode-map) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
44 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
45 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
46 (defvar newsticker--retrieval-timer-list nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
47 "List of timers for news retrieval. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
48 This is an alist, each element consisting of (feed-name . timer).") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
49 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
50 (defvar newsticker--download-logos nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
51 "If non-nil download feed logos if available.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
52 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
53 (defvar newsticker--sentinel-callback nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
54 "Function called at end of `newsticker--sentinel'.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
55 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
56 ;;;###autoload |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
57 (defun newsticker-running-p () |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
58 "Check whether newsticker is running. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
59 Return t if newsticker is running, nil otherwise. Newsticker is |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
60 considered to be running if the newsticker timer list is not empty." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
61 (> (length newsticker--retrieval-timer-list) 0)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
62 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
63 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
64 ;;; Customization |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
65 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
66 (defgroup newsticker nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
67 "Aggregator for RSS and Atom feeds." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
68 :group 'applications) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
69 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
70 (defconst newsticker--raw-url-list-defaults |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
71 '(("CNET News.com" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
72 "http://export.cnet.com/export/feeds/news/rss/1,11176,,00.xml") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
73 ("Debian Security Advisories" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
74 "http://www.debian.org/security/dsa.en.rdf") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
75 ("Debian Security Advisories - Long format" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
76 "http://www.debian.org/security/dsa-long.en.rdf") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
77 ("Emacs Wiki" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
78 "http://www.emacswiki.org/cgi-bin/wiki.pl?action=rss" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
79 nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
80 3600) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
81 ("Freshmeat.net" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
82 "http://freshmeat.net/backend/fm.rdf") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
83 ("Kuro5hin.org" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
84 "http://www.kuro5hin.org/backend.rdf") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
85 ("LWN (Linux Weekly News)" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
86 "http://lwn.net/headlines/rss") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
87 ("NewsForge" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
88 "http://newsforge.com/index.rss") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
89 ("NY Times: Technology" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
90 "http://partners.userland.com/nytRss/technology.xml") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
91 ("NY Times" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
92 "http://partners.userland.com/nytRss/nytHomepage.xml") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
93 ("Quote of the day" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
94 "http://www.quotationspage.com/data/qotd.rss" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
95 "07:00" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
96 86400) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
97 ("The Register" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
98 "http://www.theregister.co.uk/tonys/slashdot.rdf") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
99 ("slashdot" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
100 "http://slashdot.org/index.rss" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
101 nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
102 3600) ;/. will ban you if under 3600 seconds! |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
103 ("Wired News" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
104 "http://www.wired.com/news_drop/netcenter/netcenter.rdf") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
105 ("Heise News (german)" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
106 "http://www.heise.de/newsticker/heise.rdf") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
107 ("Tagesschau (german)" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
108 "http://www.tagesschau.de/newsticker.rdf" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
109 nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
110 1800) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
111 ("Telepolis (german)" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
112 "http://www.heise.de/tp/news.rdf")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
113 "Default URL list in raw form. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
114 This list is fed into defcustom via `newsticker--splicer'.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
115 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
116 (defun newsticker--splicer (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
117 "Convert ITEM for splicing into `newsticker-url-list-defaults'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
118 (let ((result (list 'list :tag (nth 0 item) (list 'const (nth 0 item)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
119 (element (cdr item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
120 (while element |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
121 (setq result (append result (list (list 'const (car element))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
122 (setq element (cdr element))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
123 result)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
124 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
125 (defun newsticker--set-customvar-retrieval (symbol value) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
126 "Set retrieval related newsticker-variable SYMBOL value to VALUE. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
127 Calls all actions which are necessary in order to make the new |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
128 value effective." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
129 (if (or (not (boundp symbol)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
130 (equal (symbol-value symbol) value)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
131 (set symbol value) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
132 ;; something must have changed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
133 (let ((need-restart nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
134 (new-or-changed-feeds nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
135 (removed-feeds)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
136 (cond ((eq symbol 'newsticker-retrieval-interval) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
137 (setq need-restart t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
138 ((memq symbol '(newsticker-url-list-defaults newsticker-url-list)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
139 (dolist (elt value) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
140 (unless (member elt (symbol-value symbol)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
141 (setq new-or-changed-feeds (cons elt new-or-changed-feeds)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
142 (dolist (elt (symbol-value symbol)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
143 (unless (member elt value) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
144 (setq removed-feeds (cons elt removed-feeds)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
145 (cond (need-restart |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
146 (set symbol value) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
147 (when (newsticker-running-p) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
148 (message "Restarting newsticker") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
149 (newsticker-stop) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
150 (newsticker-start))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
151 (t |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
152 (dolist (feed removed-feeds) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
153 (message "Stopping feed `%s'" (car feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
154 (newsticker--stop-feed (car feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
155 (dolist (feed new-or-changed-feeds) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
156 (message "Starting feed `%s'" (car feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
157 (newsticker--stop-feed (car feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
158 (newsticker--start-feed feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
159 (unless new-or-changed-feeds |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
160 (when newsticker--sentinel-callback |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
161 (funcall newsticker--sentinel-callback))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
162 (set symbol value)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
163 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
164 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
165 ;; retrieval |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
166 (defgroup newsticker-retrieval nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
167 "Settings for news retrieval." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
168 :group 'newsticker) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
169 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
170 (defcustom newsticker-url-list-defaults |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
171 '(("Emacs Wiki" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
172 "http://www.emacswiki.org/cgi-bin/wiki.pl?action=rss" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
173 nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
174 3600)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
175 "A customizable list of news feeds to select from. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
176 These were mostly extracted from the Radio Community Server at |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
177 http://subhonker6.userland.com/rcsPublic/rssHotlist. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
178 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
179 You may add other entries in `newsticker-url-list'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
180 :type `(set ,@(mapcar `newsticker--splicer |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
181 newsticker--raw-url-list-defaults)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
182 :set 'newsticker--set-customvar-retrieval |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
183 :group 'newsticker-retrieval) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
184 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
185 (defcustom newsticker-url-list nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
186 "The news feeds which you like to watch. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
187 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
188 This alist will be used in addition to selection made customizing |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
189 `newsticker-url-list-defaults'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
190 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
191 This is an alist. Each element consists of two items: a LABEL and a URL, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
192 optionally followed by a START-TIME, INTERVAL specifier and WGET-ARGUMENTS. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
193 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
194 The LABEL gives the name of the news feed. It can be an arbitrary string. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
195 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
196 The URL gives the location of the news feed. It must point to a valid |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
197 RSS or Atom file. The file is retrieved by calling wget, or whatever you |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
198 specify as `newsticker-wget-name'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
199 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
200 URL may also be a function which returns news data. In this case |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
201 `newsticker-retrieval-method' etc. are ignored for this feed. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
202 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
203 The START-TIME can be either a string, or nil. If it is a string it |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
204 specifies a fixed time at which this feed shall be retrieved for the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
205 first time. (Examples: \"11:00pm\", \"23:00\".) If it is nil (or |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
206 unspecified), this feed will be retrieved immediately after calling |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
207 `newsticker-start'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
208 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
209 The INTERVAL specifies the time between retrievals for this feed. If it |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
210 is nil (or unspecified) the default interval value as set in |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
211 `newsticker-retrieval-interval' is used. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
212 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
213 \(newsticker.el calls `run-at-time'. The newsticker-parameters START-TIME |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
214 and INTERVAL correspond to the `run-at-time'-parameters TIME and REPEAT.) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
215 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
216 WGET-ARGUMENTS specifies arguments for wget (see `newsticker-wget-name') |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
217 which apply for this feed only, overriding the value of |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
218 `newsticker-wget-arguments'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
219 :type '(repeat (list :tag "News feed" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
220 (string :tag "Label") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
221 (choice :tag "URI" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
222 (string :tag "String") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
223 (function :tag "Function")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
224 (choice :tag "Start" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
225 (const :tag "Default" nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
226 (string :tag "Fixed Time")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
227 (choice :tag "Interval" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
228 (const :tag "Default" nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
229 (const :tag "Hourly" 3600) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
230 (const :tag "Daily" 86400) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
231 (const :tag "Weekly" 604800) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
232 (integer :tag "Interval")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
233 (choice :tag "Wget Arguments" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
234 (const :tag "Default arguments" nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
235 (repeat :tag "Special arguments" string)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
236 :set 'newsticker--set-customvar-retrieval |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
237 :group 'newsticker-retrieval) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
238 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
239 (defcustom newsticker-retrieval-method |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
240 'intern |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
241 "Method for retrieving news from the web, either `intern' or `extern'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
242 Default value `intern' uses Emacs' built-in asynchronous download |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
243 capabilities ('url-retrieve'). If set to `extern' the external |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
244 program wget is used, see `newsticker-wget-name'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
245 :type '(choice :tag "Method" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
246 (const :tag "Intern" intern) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
247 (const :tag "Extern" extern)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
248 :group 'newsticker-retrieval) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
249 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
250 (defcustom newsticker-wget-name |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
251 "wget" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
252 "Name of the program which is called to retrieve news from the web. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
253 The canonical choice is wget but you may take any other program which is |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
254 able to return the contents of a news feed file on stdout." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
255 :type 'string |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
256 :group 'newsticker-retrieval) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
257 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
258 (defcustom newsticker-wget-arguments |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
259 '("-q" "-O" "-") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
260 "Arguments which are passed to wget. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
261 There is probably no reason to change the default settings, unless you |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
262 are living behind a firewall." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
263 :type '(repeat (string :tag "Argument")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
264 :group 'newsticker-retrieval) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
265 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
266 (defcustom newsticker-retrieval-interval |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
267 3600 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
268 "Time interval for retrieving new news items (seconds). |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
269 If this value is not positive (i.e. less than or equal to 0) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
270 items are retrieved only once! |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
271 Please note that some feeds, e.g. Slashdot, will ban you if you |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
272 make it less than 1800 seconds (30 minutes)!" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
273 :type '(choice :tag "Interval" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
274 (const :tag "No automatic retrieval" 0) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
275 (const :tag "Hourly" 3600) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
276 (const :tag "Daily" 86400) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
277 (const :tag "Weekly" 604800) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
278 (integer :tag "Interval")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
279 :set 'newsticker--set-customvar-retrieval |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
280 :group 'newsticker-retrieval) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
281 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
282 (defcustom newsticker-desc-comp-max |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
283 100 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
284 "Relevant length of headline descriptions. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
285 This value gives the maximum number of characters which will be |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
286 taken into account when newsticker compares two headline |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
287 descriptions." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
288 :type 'integer |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
289 :group 'newsticker-retrieval) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
290 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
291 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
292 ;; headline processing |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
293 (defgroup newsticker-headline-processing nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
294 "Settings for the automatic processing of headlines." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
295 :group 'newsticker) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
296 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
297 (defcustom newsticker-automatically-mark-items-as-old |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
298 t |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
299 "Decides whether to automatically mark items as old. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
300 If t a new item is considered as new only after its first retrieval. As |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
301 soon as it is retrieved a second time, it becomes old. If not t all |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
302 items stay new until you mark them as old. This is done in the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
303 *newsticker* buffer." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
304 :type 'boolean |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
305 :group 'newsticker-headline-processing) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
306 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
307 (defcustom newsticker-automatically-mark-visited-items-as-old |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
308 t |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
309 "Decides whether to automatically mark visited items as old. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
310 If t an item is marked as old as soon as the associated link is |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
311 visited, i.e. after pressing RET or mouse2 on the item's |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
312 headline." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
313 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
314 :type 'boolean |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
315 :group 'newsticker-headline-processing) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
316 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
317 (defcustom newsticker-keep-obsolete-items |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
318 t |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
319 "Decides whether to keep unread items which have been removed from feed. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
320 If t a new item, which has been removed from the feed, is kept in |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
321 the cache until it is marked as read." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
322 :type 'boolean |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
323 :group 'newsticker-headline-processing) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
324 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
325 (defcustom newsticker-obsolete-item-max-age |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
326 (* 60 60 24) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
327 "Maximal age of obsolete items, in seconds. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
328 Obsolete items which are older than this value will be silently |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
329 deleted at the next retrieval." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
330 :type 'integer |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
331 :group 'newsticker-headline-processing) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
332 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
333 (defcustom newsticker-auto-mark-filter-list |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
334 nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
335 "A list of filters for automatically marking headlines. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
336 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
337 This is an alist of the form (FEED-NAME PATTERN-LIST). I.e. each |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
338 element consists of a FEED-NAME a PATTERN-LIST. Each element of |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
339 the pattern-list has the form (AGE TITLE-OR-DESCRIPTION REGEXP). |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
340 AGE must be one of the symbols 'old or 'immortal. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
341 TITLE-OR-DESCRIPTION must be on of the symbols 'title, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
342 'description, or 'all. REGEXP is a regular expression, i.e. a |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
343 string. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
344 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
345 This filter is checked after a new headline has been retrieved. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
346 If FEED-NAME matches the name of the corresponding news feed, the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
347 pattern-list is checked: The new headline will be marked as AGE |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
348 if REGEXP matches the headline's TITLE-OR-DESCRIPTION. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
349 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
350 If, for example, `newsticker-auto-mark-filter-list' looks like |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
351 \((slashdot ('old 'title \"^Forget me!$\") ('immortal 'title \"Read me\") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
352 \('immortal 'all \"important\")))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
353 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
354 then all articles from slashdot are marked as old if they have |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
355 the title \"Forget me!\". All articles with a title containing |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
356 the string \"Read me\" are marked as immortal. All articles which |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
357 contain the string \"important\" in their title or their |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
358 description are marked as immortal." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
359 :type '(repeat (list :tag "Auto mark filter" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
360 (string :tag "Feed name") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
361 (repeat |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
362 (list :tag "Filter element" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
363 (choice |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
364 :tag "Auto-assigned age" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
365 (const :tag "Old" old) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
366 (const :tag "Immortal" immortal)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
367 (choice |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
368 :tag "Title/Description" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
369 (const :tag "Title" title) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
370 (const :tag "Description" description) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
371 (const :tag "All" all)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
372 (string :tag "Regexp"))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
373 :group 'newsticker-headline-processing) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
374 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
375 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
376 ;; hooks |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
377 (defgroup newsticker-hooks nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
378 "Settings for newsticker hooks." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
379 :group 'newsticker) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
380 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
381 (defcustom newsticker-start-hook |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
382 nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
383 "Hook run when starting newsticker. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
384 This hook is run at the very end of `newsticker-start'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
385 :options '(newsticker-start-ticker) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
386 :type 'hook |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
387 :group 'newsticker-hooks) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
388 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
389 (defcustom newsticker-stop-hook |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
390 nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
391 "Hook run when stopping newsticker. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
392 This hook is run at the very end of `newsticker-stop'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
393 :options nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
394 :type 'hook |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
395 :group 'newsticker-hooks) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
396 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
397 (defcustom newsticker-new-item-functions |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
398 nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
399 "List of functions run after a new headline has been retrieved. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
400 Each function is called with the following three arguments: |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
401 FEED the name of the corresponding news feed, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
402 TITLE the title of the headline, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
403 DESC the decoded description of the headline. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
404 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
405 See `newsticker-download-images', and |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
406 `newsticker-download-enclosures' for sample functions. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
407 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
408 Please note that these functions are called only once for a |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
409 headline after it has been retrieved for the first time." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
410 :type 'hook |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
411 :options '(newsticker-download-images |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
412 newsticker-download-enclosures) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
413 :group 'newsticker-hooks) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
414 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
415 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
416 ;; miscellaneous |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
417 (defgroup newsticker-miscellaneous nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
418 "Miscellaneous newsticker settings." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
419 :group 'newsticker) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
420 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
421 (defcustom newsticker-cache-filename |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
422 "~/.newsticker-cache" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
423 "Name of the newsticker cache file." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
424 :type 'string |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
425 :group 'newsticker-miscellaneous) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
426 |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
427 (defcustom newsticker-dir |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
428 "~/.newsticker" |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
429 "Name of the directory where newsticker saves cached data." |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
430 :type 'string |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
431 :group 'newsticker-miscellaneous) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
432 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
433 ;; debugging |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
434 (defcustom newsticker-debug |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
435 nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
436 "Enables some features needed for debugging newsticker.el. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
437 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
438 If set to t newsticker.el will print lots of debugging messages, and the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
439 buffers *newsticker-wget-<feed>* will not be closed." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
440 :type 'boolean |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
441 :group 'newsticker-miscellaneous) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
442 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
443 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
444 ;;; Compatibility section, XEmacs, Emacs |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
445 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
446 (unless (fboundp 'time-add) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
447 (require 'time-date);;FIXME |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
448 (defun time-add (t1 t2) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
449 (seconds-to-time (+ (time-to-seconds t1) (time-to-seconds t2))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
450 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
451 (unless (fboundp 'match-string-no-properties) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
452 (defalias 'match-string-no-properties 'match-string)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
453 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
454 (when (featurep 'xemacs) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
455 (unless (fboundp 'replace-regexp-in-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
456 (defun replace-regexp-in-string (re rp st) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
457 (save-match-data ;; apparently XEmacs needs save-match-data |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
458 (replace-in-string st re rp))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
459 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
460 ;; copied from subr.el |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
461 (unless (fboundp 'add-to-invisibility-spec) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
462 (defun add-to-invisibility-spec (arg) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
463 "Add elements to `buffer-invisibility-spec'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
464 See documentation for `buffer-invisibility-spec' for the kind of elements |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
465 that can be added." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
466 (if (eq buffer-invisibility-spec t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
467 (setq buffer-invisibility-spec (list t))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
468 (setq buffer-invisibility-spec |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
469 (cons arg buffer-invisibility-spec)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
470 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
471 ;; copied from subr.el |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
472 (unless (fboundp 'remove-from-invisibility-spec) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
473 (defun remove-from-invisibility-spec (arg) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
474 "Remove elements from `buffer-invisibility-spec'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
475 (if (consp buffer-invisibility-spec) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
476 (setq buffer-invisibility-spec |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
477 (delete arg buffer-invisibility-spec))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
478 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
479 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
480 ;;; Internal variables |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
481 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
482 (defvar newsticker--item-list nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
483 "List of newsticker items.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
484 (defvar newsticker--item-position 0 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
485 "Actual position in list of newsticker items.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
486 (defvar newsticker--prev-message "There was no previous message yet!" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
487 "Last message that the newsticker displayed.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
488 (defvar newsticker--scrollable-text "" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
489 "The text which is scrolled smoothly in the echo area.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
490 (defvar newsticker--buffer-uptodate-p nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
491 "Tells whether the newsticker buffer is up to date.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
492 (defvar newsticker--latest-update-time (current-time) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
493 "The time at which the latest news arrived.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
494 (defvar newsticker--process-ids nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
495 "List of PIDs of active newsticker processes.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
496 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
497 (defvar newsticker--cache nil "Cached newsticker data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
498 This is a list of the form |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
499 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
500 ((label1 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
501 (title description link time age index preformatted-contents |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
502 preformatted-title extra-elements) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
503 ...) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
504 (label2 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
505 (title description link time age index preformatted-contents |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
506 preformatted-title extra-elements) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
507 ...) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
508 ...) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
509 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
510 where LABEL is a symbol. TITLE, DESCRIPTION, and LINK are |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
511 strings. TIME is a time value as returned by `current-time'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
512 AGE is a symbol: 'new, 'old, 'immortal, and 'obsolete denote |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
513 ordinary news items, whereas 'feed denotes an item which is not a |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
514 headline but describes the feed itself. INDEX denotes the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
515 original position of the item -- used for restoring the original |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
516 order. PREFORMATTED-CONTENTS and PREFORMATTED-TITLE hold the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
517 formatted contents of the item's description and title. This |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
518 speeds things up if HTML rendering is used, which is rather |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
519 slow. EXTRA-ELEMENTS is an alist containing additional elements.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
520 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
521 (defvar newsticker--auto-narrow-to-feed nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
522 "Automatically narrow to current news feed. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
523 If non-nil only the items of the current news feed are visible.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
524 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
525 (defvar newsticker--auto-narrow-to-item nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
526 "Automatically narrow to current news item. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
527 If non-nil only the current headline is visible.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
528 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
529 (defconst newsticker--error-headline |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
530 "[COULD NOT DOWNLOAD HEADLINES!]" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
531 "Title of error headline which will be inserted if news retrieval fails.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
532 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
533 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
534 ;;; Shortcuts |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
535 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
536 (defsubst newsticker--title (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
537 "Return title of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
538 (nth 0 item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
539 (defsubst newsticker--desc (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
540 "Return description of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
541 (nth 1 item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
542 (defsubst newsticker--link (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
543 "Return link of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
544 (nth 2 item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
545 (defsubst newsticker--time (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
546 "Return time of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
547 (nth 3 item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
548 (defsubst newsticker--age (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
549 "Return age of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
550 (nth 4 item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
551 (defsubst newsticker--pos (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
552 "Return position/index of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
553 (nth 5 item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
554 (defsubst newsticker--preformatted-contents (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
555 "Return pre-formatted text of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
556 (nth 6 item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
557 (defsubst newsticker--preformatted-title (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
558 "Return pre-formatted title of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
559 (nth 7 item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
560 (defsubst newsticker--extra (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
561 "Return extra attributes of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
562 (nth 8 item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
563 (defsubst newsticker--guid-to-string (guid) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
564 "Return string representation of GUID." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
565 (if (stringp guid) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
566 guid |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
567 (car (xml-node-children guid)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
568 (defsubst newsticker--guid (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
569 "Return guid of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
570 (newsticker--guid-to-string (assoc 'guid (newsticker--extra item)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
571 (defsubst newsticker--enclosure (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
572 "Return enclosure element of ITEM in the form \(...FIXME...\) or nil." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
573 (let ((enclosure (assoc 'enclosure (newsticker--extra item)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
574 (if enclosure |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
575 (xml-node-attributes enclosure)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
576 (defun newsticker--real-feed-name (feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
577 "Return real name of FEED." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
578 (catch 'name |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
579 (mapc (lambda (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
580 (if (eq (newsticker--age item) 'feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
581 (throw 'name (newsticker--title item)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
582 (cdr (newsticker--cache-get-feed feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
583 (symbol-name feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
584 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
585 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
586 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
587 ;;; User fun |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
588 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
589 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
590 (defun newsticker--start-feed (feed &optional do-not-complain-if-running) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
591 "Start retrieval timer for FEED. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
592 If timer is running already a warning message is printed unless |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
593 DO-NOT-COMPLAIN-IF-RUNNING is not nil. Add the started |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
594 name/timer pair to `newsticker--retrieval-timer-list'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
595 (let* ((feed-name (car feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
596 (start-time (nth 2 feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
597 (interval (or (nth 3 feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
598 newsticker-retrieval-interval)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
599 (timer (assoc (car feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
600 newsticker--retrieval-timer-list))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
601 (if timer |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
602 (or do-not-complain-if-running |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
603 (message "Timer for %s is running already!" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
604 feed-name)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
605 (newsticker--debug-msg "Starting timer for %s: %s, %d" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
606 feed-name start-time interval) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
607 ;; do not repeat retrieval if interval not positive |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
608 (if (<= interval 0) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
609 (setq interval nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
610 ;; Suddenly XEmacs doesn't like start-time 0 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
611 (if (or (not start-time) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
612 (and (numberp start-time) (= start-time 0))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
613 (setq start-time 1)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
614 ;; (message "start-time %s" start-time) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
615 (setq timer (run-at-time start-time interval |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
616 'newsticker-get-news feed-name)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
617 (if interval |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
618 (add-to-list 'newsticker--retrieval-timer-list |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
619 (cons feed-name timer)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
620 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
621 ;;;###autoload |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
622 (defun newsticker-start (&optional do-not-complain-if-running) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
623 "Start the newsticker. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
624 Start the timers for display and retrieval. If the newsticker, i.e. the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
625 timers, are running already a warning message is printed unless |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
626 DO-NOT-COMPLAIN-IF-RUNNING is not nil. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
627 Run `newsticker-start-hook' if newsticker was not running already." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
628 (interactive) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
629 (let ((running (newsticker-running-p))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
630 ;; read old cache if it exists and newsticker is not running |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
631 (unless running |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
632 (newsticker--cache-read)) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
633 ;; start retrieval timers -- one timer for each feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
634 (dolist (feed (append newsticker-url-list-defaults newsticker-url-list)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
635 (newsticker--start-feed feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
636 (unless running |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
637 (run-hooks 'newsticker-start-hook) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
638 (message "Newsticker started!")))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
639 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
640 (defun newsticker--stop-feed (feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
641 "Stop retrieval for feed FEED-NAME. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
642 Delete the stopped name/timer pair from `newsticker--retrieval-timer-list'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
643 (let ((name-and-timer (assoc feed-name newsticker--retrieval-timer-list))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
644 (when name-and-timer |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
645 (cancel-timer (cdr name-and-timer)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
646 (setq newsticker--retrieval-timer-list |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
647 (delete name-and-timer newsticker--retrieval-timer-list))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
648 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
649 (defun newsticker-stop () |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
650 "Stop the newsticker and the newsticker-ticker. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
651 Cancel the timers for display and retrieval. Run `newsticker-stop-hook' |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
652 if newsticker has been running." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
653 (interactive) |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
654 (newsticker--cache-save) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
655 (when (fboundp 'newsticker-stop-ticker) ; silence compiler warnings |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
656 (newsticker-stop-ticker)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
657 (when (newsticker-running-p) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
658 (mapc (lambda (name-and-timer) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
659 (newsticker--stop-feed (car name-and-timer))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
660 newsticker--retrieval-timer-list) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
661 (setq newsticker--retrieval-timer-list nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
662 (run-hooks 'newsticker-stop-hook) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
663 (message "Newsticker stopped!"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
664 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
665 (defun newsticker-get-all-news () |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
666 "Launch retrieval of news from all configured newsticker sites. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
667 This does NOT start the retrieval timers." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
668 (interactive) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
669 ;; launch retrieval of news |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
670 (mapc (lambda (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
671 (newsticker-get-news (car item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
672 (append newsticker-url-list-defaults newsticker-url-list))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
673 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
674 (defun newsticker-save-item (feed item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
675 "Save FEED ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
676 (interactive) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
677 (let ((filename (read-string "Filename: " |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
678 (concat feed ":_" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
679 (replace-regexp-in-string |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
680 " " "_" (newsticker--title item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
681 ".html")))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
682 (with-temp-buffer |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
683 (insert (newsticker--desc item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
684 (write-file filename t)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
685 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
686 (defun newsticker-add-url (url name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
687 "Add given URL under given NAME to `newsticker-url-list'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
688 If URL is nil it is searched at point." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
689 (interactive |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
690 (list |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
691 (read-string "URL: " |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
692 (save-excursion |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
693 (end-of-line) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
694 (and |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
695 (re-search-backward |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
696 "http://" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
697 (if (> (point) (+ (point-min) 100)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
698 (- (point) 100) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
699 (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
700 t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
701 (re-search-forward |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
702 "http://[-a-zA-Z0-9&/_.]*" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
703 (if (< (point) (- (point-max) 200)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
704 (+ (point) 200) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
705 (point-max)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
706 t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
707 (buffer-substring-no-properties (match-beginning 0) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
708 (match-end 0))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
709 (read-string "Name: "))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
710 (add-to-list 'newsticker-url-list (list name url nil nil nil) t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
711 (customize-variable 'newsticker-url-list)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
712 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
713 (defun newsticker-customize () |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
714 "Open the newsticker customization group." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
715 (interactive) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
716 (customize-group "newsticker")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
717 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
718 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
719 ;;; Local stuff |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
720 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
721 (defun newsticker--get-news-by-funcall (feed-name function) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
722 "Get news for the site FEED-NAME by calling FUNCTION. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
723 See `newsticker-get-news'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
724 (let ((buffername (concat " *newsticker-funcall-" feed-name "*"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
725 (save-excursion |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
726 (set-buffer (get-buffer-create buffername)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
727 (erase-buffer) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
728 (insert (string-to-multibyte (funcall function feed-name))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
729 (newsticker--sentinel-work nil t feed-name function |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
730 (current-buffer))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
731 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
732 (defun newsticker--get-news-by-url (feed-name url) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
733 "Get news for the site FEED-NAME from address URL using `url-retrieve'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
734 See `newsticker-get-news'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
735 (let ((coding-system-for-read 'no-conversion)) |
96542
4b75a9224462
newsticker: handle url-retrieve errors.
Ulf Jasper <ulf.jasper@web.de>
parents:
95901
diff
changeset
|
736 (condition-case error-data |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
737 (url-retrieve url 'newsticker--get-news-by-url-callback |
96542
4b75a9224462
newsticker: handle url-retrieve errors.
Ulf Jasper <ulf.jasper@web.de>
parents:
95901
diff
changeset
|
738 (list feed-name)) |
4b75a9224462
newsticker: handle url-retrieve errors.
Ulf Jasper <ulf.jasper@web.de>
parents:
95901
diff
changeset
|
739 (error (message "Error retrieving news from %s: %s" feed-name |
4b75a9224462
newsticker: handle url-retrieve errors.
Ulf Jasper <ulf.jasper@web.de>
parents:
95901
diff
changeset
|
740 error-data)))) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
741 (force-mode-line-update)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
742 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
743 (defun newsticker--get-news-by-url-callback (status feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
744 "Callback function for `newsticker--get-news-by-url'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
745 STATUS is the return status as delivered by `url-retrieve', and |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
746 FEED-NAME is the name of the feed that the news were retrieved |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
747 from." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
748 (let ((buf (get-buffer-create (concat " *newsticker-url-" feed-name "*"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
749 (result (string-to-multibyte (buffer-string)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
750 (set-buffer buf) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
751 (erase-buffer) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
752 (insert result) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
753 ;; remove MIME header |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
754 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
755 (search-forward "\n\n") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
756 (delete-region (point-min) (point)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
757 ;; read the rss/atom contents |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
758 (newsticker--sentinel-work nil t feed-name "url-retrieve" (current-buffer)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
759 (when status |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
760 (let ((status-type (car status)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
761 (status-details (cdr status))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
762 (cond ((eq status-type :redirect) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
763 ;; don't care about redirects |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
764 ) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
765 ((eq status-type :error) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
766 (message "%s: Error while retrieving news from %s: %s: \"%s\"" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
767 (format-time-string "%A, %H:%M" (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
768 feed-name |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
769 (car status-details) (cdr status-details)))))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
770 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
771 (defun newsticker--get-news-by-wget (feed-name url wget-arguments) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
772 "Get news for the site FEED-NAME from address URL using wget. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
773 WGET-ARGUMENTS is a list of arguments for wget. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
774 See `newsticker-get-news'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
775 (let ((buffername (concat " *newsticker-wget-" feed-name "*"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
776 (save-excursion |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
777 (set-buffer (get-buffer-create buffername)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
778 (erase-buffer) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
779 ;; throw an error if there is an old wget-process around |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
780 (if (get-process feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
781 (error "Another wget-process is running for %s" feed-name)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
782 ;; start wget |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
783 (let* ((args (append wget-arguments (list url))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
784 (proc (apply 'start-process feed-name buffername |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
785 newsticker-wget-name args))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
786 (set-process-coding-system proc 'no-conversion 'no-conversion) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
787 (set-process-sentinel proc 'newsticker--sentinel) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
788 (setq newsticker--process-ids (cons (process-id proc) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
789 newsticker--process-ids)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
790 (force-mode-line-update))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
791 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
792 (defun newsticker-get-news (feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
793 "Get news from the site FEED-NAME and load feed logo. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
794 FEED-NAME must be a string which occurs as the label (i.e. the first element) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
795 in an element of `newsticker-url-list' or `newsticker-url-list-defaults'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
796 (newsticker--debug-msg "%s: Getting news for %s" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
797 (format-time-string "%A, %H:%M" (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
798 feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
799 (let* ((item (or (assoc feed-name newsticker-url-list) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
800 (assoc feed-name newsticker-url-list-defaults) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
801 (error |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
802 "Cannot get news for %s: Check newsticker-url-list" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
803 feed-name))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
804 (url (cadr item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
805 (wget-arguments (or (car (cdr (cdr (cdr (cdr item))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
806 newsticker-wget-arguments))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
807 (if (functionp url) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
808 (newsticker--get-news-by-funcall feed-name url) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
809 (if (eq newsticker-retrieval-method 'intern) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
810 (newsticker--get-news-by-url feed-name url) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
811 (newsticker--get-news-by-wget feed-name url wget-arguments))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
812 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
813 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
814 ;; Parsing |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
815 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
816 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
817 (defun newsticker--sentinel (process event) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
818 "Sentinel for extracting news titles from an RDF buffer. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
819 Argument PROCESS is the process which has just changed its state. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
820 Argument EVENT tells what has happened to the process." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
821 (let ((p-status (process-status process)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
822 (exit-status (process-exit-status process)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
823 (name (process-name process)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
824 (command (process-command process)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
825 (buffer (process-buffer process))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
826 (newsticker--sentinel-work event |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
827 (and (eq p-status 'exit) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
828 (= exit-status 0)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
829 name command buffer))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
830 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
831 (defun newsticker--sentinel-work (event status-ok name command buffer) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
832 "Actually do the sentinel work. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
833 Argument EVENT tells what has happened to the retrieval process. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
834 Argument STATUS-OK is the final status of the retrieval process, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
835 non-nil meaning retrieval was successful. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
836 Argument NAME is the name of the retrieval process. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
837 Argument COMMAND is the command of the retrieval process. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
838 Argument BUFFER is the buffer of the retrieval process." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
839 (let ((time (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
840 (name-symbol (intern name)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
841 (something-was-added nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
842 ;; catch known errors (zombie processes, rubbish-xml etc. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
843 ;; if an error occurs the news feed is not updated! |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
844 (catch 'oops |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
845 (unless status-ok |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
846 (setq newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
847 (newsticker--cache-add |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
848 newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
849 name-symbol |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
850 newsticker--error-headline |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
851 (format |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
852 (concat "%s: Newsticker could not retrieve news from %s.\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
853 "Return status: `%s'\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
854 "Command was `%s'") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
855 (format-time-string "%A, %H:%M" (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
856 name event command) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
857 "" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
858 (current-time) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
859 'new |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
860 0 nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
861 (message "%s: Error while retrieving news from %s" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
862 (format-time-string "%A, %H:%M" (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
863 name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
864 (throw 'oops nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
865 (let* ((coding-system 'utf-8) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
866 (node-list |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
867 (save-current-buffer |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
868 (set-buffer buffer) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
869 ;; a very very dirty workaround to overcome the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
870 ;; problems with the newest (20030621) xml.el: |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
871 ;; remove all unnecessary whitespace |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
872 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
873 (while (re-search-forward ">[ \t\r\n]+<" nil t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
874 (replace-match "><" nil t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
875 ;; and another brutal workaround (20031105)! For some |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
876 ;; reason the xml parser does not like the colon in the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
877 ;; doctype name "rdf:RDF" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
878 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
879 (if (re-search-forward "<!DOCTYPE[ \t\n]+rdf:RDF" nil t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
880 (replace-match "<!DOCTYPE rdfColonRDF" nil t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
881 ;; finally.... ~##^°!!!!! |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
882 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
883 (while (search-forward "\r\n" nil t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
884 (replace-match "\n" nil t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
885 ;; still more brutal workarounds (20040309)! The xml |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
886 ;; parser does not like doctype rss |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
887 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
888 (if (re-search-forward "<!DOCTYPE[ \t\n]+rss[ \t\n]*>" nil t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
889 (replace-match "" nil t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
890 ;; And another one (20050618)! (Fixed in GNU Emacs 22.0.50.18) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
891 ;; Remove comments to avoid this xml-parsing bug: |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
892 ;; "XML files can have only one toplevel tag" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
893 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
894 (while (search-forward "<!--" nil t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
895 (let ((start (match-beginning 0))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
896 (unless (search-forward "-->" nil t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
897 (error "Can't find end of comment")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
898 (delete-region start (point)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
899 ;; And another one (20050702)! If description is HTML |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
900 ;; encoded and starts with a `<', wrap the whole |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
901 ;; description in a CDATA expression. This happened for |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
902 ;; http://www.thefreedictionary.com/_/WoD/rss.aspx?type=quote |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
903 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
904 (while (re-search-forward |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
905 "<description>\\(<img.*?\\)</description>" nil t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
906 (replace-match |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
907 "<description><![CDATA[ \\1 ]]></description>")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
908 ;; And another one (20051123)! XML parser does not |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
909 ;; like this: <yweather:location city="Frankfurt/Main" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
910 ;; region="" country="GM" /> |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
911 ;; try to "fix" empty attributes |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
912 ;; This happened for |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
913 ;; http://xml.weather.yahoo.com/forecastrss?p=GMXX0040&u=f |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
914 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
915 (while (re-search-forward "\\(<[^>]*\\)=\"\"" nil t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
916 (replace-match "\\1=\" \"")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
917 ;; |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
918 (set-buffer-modified-p nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
919 ;; check coding system |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
920 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
921 (if (re-search-forward "encoding=\"\\([^\"]+\\)\"" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
922 nil t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
923 (setq coding-system (intern (downcase (match-string 1)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
924 (setq coding-system |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
925 (condition-case nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
926 (check-coding-system coding-system) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
927 (coding-system-error |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
928 (message |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
929 "newsticker.el: ignoring coding system %s for %s" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
930 coding-system name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
931 nil)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
932 ;; Decode if possible |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
933 (when coding-system |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
934 (decode-coding-region (point-min) (point-max) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
935 coding-system)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
936 (condition-case errordata |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
937 ;; The xml parser might fail |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
938 ;; or the xml might be bugged |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
939 (xml-parse-region (point-min) (point-max)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
940 (error (message "Could not parse %s: %s" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
941 (buffer-name) (cadr errordata)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
942 (throw 'oops nil))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
943 (topnode (car node-list)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
944 (channelnode (car (xml-get-children topnode 'channel))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
945 (imageurl nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
946 ;; mark all items as obsolete |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
947 (newsticker--cache-replace-age newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
948 name-symbol |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
949 'new 'obsolete-new) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
950 (newsticker--cache-replace-age newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
951 name-symbol |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
952 'old 'obsolete-old) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
953 (newsticker--cache-replace-age newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
954 name-symbol |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
955 'feed 'obsolete-old) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
956 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
957 ;; check Atom/RSS version and call corresponding parser |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
958 (condition-case error-data |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
959 (if (cond |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
960 ;; RSS 0.91 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
961 ((and (eq 'rss (xml-node-name topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
962 (string= "0.91" (xml-get-attribute topnode 'version))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
963 (setq imageurl (newsticker--get-logo-url-rss-0.91 topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
964 (newsticker--parse-rss-0.91 name time topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
965 ;; RSS 0.92 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
966 ((and (eq 'rss (xml-node-name topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
967 (string= "0.92" (xml-get-attribute topnode 'version))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
968 (setq imageurl (newsticker--get-logo-url-rss-0.92 topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
969 (newsticker--parse-rss-0.92 name time topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
970 ;; RSS 1.0 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
971 ((eq 'rdf:RDF (xml-node-name topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
972 (setq imageurl (newsticker--get-logo-url-rss-1.0 topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
973 (newsticker--parse-rss-1.0 name time topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
974 ;; RSS 2.0 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
975 ((and (eq 'rss (xml-node-name topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
976 (string= "2.0" (xml-get-attribute topnode 'version))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
977 (setq imageurl (newsticker--get-logo-url-rss-2.0 topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
978 (newsticker--parse-rss-2.0 name time topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
979 ;; Atom 0.3 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
980 ((and (eq 'feed (xml-node-name topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
981 (string= "http://purl.org/atom/ns#" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
982 (xml-get-attribute topnode 'xmlns))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
983 (setq imageurl (newsticker--get-logo-url-atom-0.3 topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
984 (newsticker--parse-atom-0.3 name time topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
985 ;; Atom 1.0 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
986 ((and (eq 'feed (xml-node-name topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
987 (string= "http://www.w3.org/2005/Atom" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
988 (xml-get-attribute topnode 'xmlns))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
989 (setq imageurl (newsticker--get-logo-url-atom-1.0 topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
990 (newsticker--parse-atom-1.0 name time topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
991 ;; unknown feed type |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
992 (t |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
993 (newsticker--debug-msg "Feed type unknown: %s: %s" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
994 (xml-node-name topnode) name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
995 nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
996 (setq something-was-added t)) |
96542
4b75a9224462
newsticker: handle url-retrieve errors.
Ulf Jasper <ulf.jasper@web.de>
parents:
95901
diff
changeset
|
997 (error (message "sentinelerror in %s: %s" name error-data))) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
998 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
999 ;; Remove those old items from cache which have been removed from |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1000 ;; the feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1001 (newsticker--cache-replace-age newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1002 name-symbol 'obsolete-old 'deleteme) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1003 (newsticker--cache-remove newsticker--cache name-symbol |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1004 'deleteme) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1005 ;; Remove those new items from cache which have been removed from |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1006 ;; the feed. Or keep them as `obsolete' |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1007 (if (not newsticker-keep-obsolete-items) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1008 (newsticker--cache-remove newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1009 name-symbol 'obsolete-new) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1010 (setq newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1011 (newsticker--cache-mark-expired |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1012 newsticker--cache name-symbol 'obsolete 'obsolete-expired |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1013 newsticker-obsolete-item-max-age)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1014 (newsticker--cache-remove newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1015 name-symbol 'obsolete-expired) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1016 (newsticker--cache-replace-age newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1017 name-symbol 'obsolete-new |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1018 'obsolete)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1019 (newsticker--update-process-ids) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1020 ;; setup scrollable text |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1021 (when (= 0 (length newsticker--process-ids)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1022 (when (fboundp 'newsticker--ticker-text-setup) ;silence |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1023 ;compiler |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1024 ;warnings |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1025 (newsticker--ticker-text-setup))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1026 (setq newsticker--latest-update-time (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1027 (when something-was-added |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1028 ;; FIXME: should we care about removed items as well? |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1029 (newsticker--cache-save-feed |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1030 (newsticker--cache-get-feed name-symbol)) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1031 (when (fboundp 'newsticker--buffer-set-uptodate) ;silence |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1032 ;compiler |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1033 ;warnings |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1034 (newsticker--buffer-set-uptodate nil))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1035 ;; kill the process buffer if wanted |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1036 (unless newsticker-debug |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1037 (kill-buffer buffer)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1038 ;; launch retrieval of image |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1039 (when (and imageurl newsticker--download-logos) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1040 (newsticker--image-get name imageurl))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1041 (when newsticker--sentinel-callback |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1042 (funcall newsticker--sentinel-callback))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1043 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1044 (defun newsticker--get-logo-url-atom-1.0 (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1045 "Return logo URL from atom 1.0 data in NODE." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1046 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1047 (car (xml-get-children node 'logo))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1048 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1049 (defun newsticker--get-logo-url-atom-0.3 (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1050 "Return logo URL from atom 0.3 data in NODE." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1051 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1052 (car (xml-get-children (car (xml-get-children node 'image)) 'url))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1053 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1054 (defun newsticker--get-logo-url-rss-2.0 (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1055 "Return logo URL from RSS 2.0 data in NODE." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1056 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1057 (car (xml-get-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1058 (car (xml-get-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1059 (car (xml-get-children node 'channel)) 'image)) 'url))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1060 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1061 (defun newsticker--get-logo-url-rss-1.0 (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1062 "Return logo URL from RSS 1.0 data in NODE." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1063 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1064 (car (xml-get-children (car (xml-get-children node 'image)) 'url))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1065 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1066 (defun newsticker--get-logo-url-rss-0.92 (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1067 "Return logo URL from RSS 0.92 data in NODE." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1068 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1069 (car (xml-get-children (car (xml-get-children node 'image)) 'url))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1070 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1071 (defun newsticker--get-logo-url-rss-0.91 (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1072 "Return logo URL from RSS 0.91 data in NODE." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1073 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1074 (car (xml-get-children (car (xml-get-children node 'image)) 'url))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1075 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1076 (defun newsticker--parse-atom-0.3 (name time topnode) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1077 "Parse Atom 0.3 data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1078 Return value as well as arguments NAME, TIME, and TOPNODE are the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1079 same as in `newsticker--parse-atom-1.0'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1080 (newsticker--debug-msg "Parsing Atom 0.3 feed %s" name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1081 (let (new-feed new-item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1082 (setq new-feed (newsticker--parse-generic-feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1083 name time |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1084 ;; title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1085 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1086 (car (xml-get-children topnode 'title)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1087 ;; desc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1088 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1089 (car (xml-get-children topnode 'content)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1090 ;; link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1091 (xml-get-attribute |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1092 (car (xml-get-children topnode 'link)) 'href) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1093 ;; extra-elements |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1094 (xml-node-children topnode))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1095 (setq new-item (newsticker--parse-generic-items |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1096 name time (xml-get-children topnode 'entry) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1097 ;; title-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1098 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1099 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1100 (car (xml-get-children node 'title))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1101 ;; desc-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1102 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1103 (or (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1104 (car (xml-get-children node 'content)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1105 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1106 (car (xml-get-children node 'summary)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1107 ;; link-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1108 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1109 (xml-get-attribute |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1110 (car (xml-get-children node 'link)) 'href)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1111 ;; time-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1112 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1113 (newsticker--decode-rfc822-date |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1114 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1115 (car (xml-get-children node 'modified)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1116 ;; guid-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1117 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1118 (newsticker--guid-to-string |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1119 (assoc 'guid (xml-node-children node)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1120 ;; extra-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1121 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1122 (xml-node-children node)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1123 (or new-item new-feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1124 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1125 (defun newsticker--parse-atom-1.0 (name time topnode) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1126 "Parse Atom 1.0 data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1127 Argument NAME gives the name of a news feed. TIME gives the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1128 system time at which the data have been retrieved. TOPNODE |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1129 contains the feed data as returned by the xml parser. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1130 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1131 For the Atom 1.0 specification see |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1132 http://www.atompub.org/2005/08/17/draft-ietf-atompub-format-11.html" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1133 (newsticker--debug-msg "Parsing Atom 1.0 feed %s" name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1134 (let (new-feed new-item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1135 (setq new-feed (newsticker--parse-generic-feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1136 name time |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1137 ;; title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1138 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1139 (car (xml-get-children topnode 'title)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1140 ;; desc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1141 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1142 (car (xml-get-children topnode 'subtitle)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1143 ;; link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1144 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1145 (xml-get-attribute |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1146 (car (xml-get-children node 'link)) 'href)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1147 ;; extra-elements |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1148 (xml-node-children topnode))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1149 (setq new-item (newsticker--parse-generic-items |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1150 name time (xml-get-children topnode 'entry) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1151 ;; title-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1152 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1153 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1154 (car (xml-get-children node 'title))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1155 ;; desc-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1156 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1157 (or (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1158 (car (xml-get-children node 'content)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1159 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1160 (car (xml-get-children node 'summary)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1161 ;; link-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1162 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1163 (xml-get-attribute |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1164 (car (xml-get-children node 'link)) 'href)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1165 ;; time-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1166 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1167 (newsticker--decode-iso8601-date |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1168 (or (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1169 (car (xml-get-children node 'updated)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1170 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1171 (car (xml-get-children node 'published))))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1172 ;; guid-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1173 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1174 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1175 (car (xml-get-children node 'id))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1176 ;; extra-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1177 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1178 (xml-node-children node)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1179 (or new-item new-feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1180 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1181 (defun newsticker--parse-rss-0.91 (name time topnode) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1182 "Parse RSS 0.91 data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1183 Return value as well as arguments NAME, TIME, and TOPNODE are the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1184 same as in `newsticker--parse-atom-1.0'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1185 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1186 For the RSS 0.91 specification see http://backend.userland.com/rss091 or |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1187 http://my.netscape.com/publish/formats/rss-spec-0.91.html." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1188 (newsticker--debug-msg "Parsing RSS 0.91 feed %s" name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1189 (let* ((channelnode (car (xml-get-children topnode 'channel))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1190 (pub-date (newsticker--decode-rfc822-date |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1191 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1192 (car (xml-get-children channelnode 'pubDate)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1193 is-new-feed has-new-items) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1194 (setq is-new-feed (newsticker--parse-generic-feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1195 name time |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1196 ;; title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1197 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1198 (car (xml-get-children channelnode 'title)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1199 ;; desc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1200 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1201 (car (xml-get-children channelnode |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1202 'description)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1203 ;; link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1204 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1205 (car (xml-get-children channelnode 'link)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1206 ;; extra-elements |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1207 (xml-node-children channelnode))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1208 (setq has-new-items (newsticker--parse-generic-items |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1209 name time (xml-get-children channelnode 'item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1210 ;; title-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1211 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1212 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1213 (car (xml-get-children node 'title))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1214 ;; desc-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1215 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1216 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1217 (car (xml-get-children node 'description))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1218 ;; link-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1219 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1220 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1221 (car (xml-get-children node 'link))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1222 ;; time-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1223 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1224 (newsticker--decode-rfc822-date |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1225 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1226 (car (xml-get-children node 'pubDate)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1227 ;; guid-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1228 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1229 nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1230 ;; extra-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1231 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1232 (xml-node-children node)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1233 (or has-new-items is-new-feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1234 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1235 (defun newsticker--parse-rss-0.92 (name time topnode) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1236 "Parse RSS 0.92 data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1237 Return value as well as arguments NAME, TIME, and TOPNODE are the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1238 same as in `newsticker--parse-atom-1.0'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1239 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1240 For the RSS 0.92 specification see http://backend.userland.com/rss092." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1241 (newsticker--debug-msg "Parsing RSS 0.92 feed %s" name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1242 (let* ((channelnode (car (xml-get-children topnode 'channel))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1243 (pub-date (newsticker--decode-rfc822-date |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1244 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1245 (car (xml-get-children channelnode 'pubDate)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1246 is-new-feed has-new-items) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1247 (setq is-new-feed (newsticker--parse-generic-feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1248 name time |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1249 ;; title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1250 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1251 (car (xml-get-children channelnode 'title)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1252 ;; desc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1253 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1254 (car (xml-get-children channelnode |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1255 'description)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1256 ;; link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1257 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1258 (car (xml-get-children channelnode 'link)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1259 ;; extra-elements |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1260 (xml-node-children channelnode))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1261 (setq has-new-items (newsticker--parse-generic-items |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1262 name time (xml-get-children channelnode 'item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1263 ;; title-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1264 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1265 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1266 (car (xml-get-children node 'title))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1267 ;; desc-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1268 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1269 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1270 (car (xml-get-children node 'description))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1271 ;; link-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1272 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1273 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1274 (car (xml-get-children node 'link))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1275 ;; time-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1276 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1277 (newsticker--decode-rfc822-date |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1278 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1279 (car (xml-get-children node 'pubDate)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1280 ;; guid-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1281 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1282 nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1283 ;; extra-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1284 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1285 (xml-node-children node)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1286 (or has-new-items is-new-feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1287 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1288 (defun newsticker--parse-rss-1.0 (name time topnode) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1289 "Parse RSS 1.0 data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1290 Return value as well as arguments NAME, TIME, and TOPNODE are the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1291 same as in `newsticker--parse-atom-1.0'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1292 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1293 For the RSS 1.0 specification see http://web.resource.org/rss/1.0/spec." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1294 (newsticker--debug-msg "Parsing RSS 1.0 feed %s" name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1295 (let* ((channelnode (car (xml-get-children topnode 'channel))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1296 is-new-feed has-new-items) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1297 (setq is-new-feed (newsticker--parse-generic-feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1298 name time |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1299 ;; title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1300 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1301 (car (xml-get-children channelnode 'title)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1302 ;; desc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1303 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1304 (car (xml-get-children channelnode |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1305 'description)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1306 ;; link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1307 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1308 (car (xml-get-children channelnode 'link)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1309 ;; extra-elements |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1310 (xml-node-children channelnode))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1311 (setq has-new-items (newsticker--parse-generic-items |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1312 name time (xml-get-children topnode 'item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1313 ;; title-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1314 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1315 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1316 (car (xml-get-children node 'title))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1317 ;; desc-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1318 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1319 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1320 (car (xml-get-children node |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1321 'description))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1322 ;; link-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1323 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1324 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1325 (car (xml-get-children node 'link))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1326 ;; time-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1327 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1328 (newsticker--decode-iso8601-date |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1329 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1330 (car (xml-get-children node 'dc:date)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1331 ;; guid-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1332 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1333 nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1334 ;; extra-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1335 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1336 (xml-node-children node)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1337 (or has-new-items is-new-feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1338 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1339 (defun newsticker--parse-rss-2.0 (name time topnode) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1340 "Parse RSS 2.0 data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1341 Return value as well as arguments NAME, TIME, and TOPNODE are the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1342 same as in `newsticker--parse-atom-1.0'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1343 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1344 For the RSS 2.0 specification see http://blogs.law.harvard.edu/tech/rss." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1345 (newsticker--debug-msg "Parsing RSS 2.0 feed %s" name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1346 (let* ((channelnode (car (xml-get-children topnode 'channel))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1347 is-new-feed has-new-items) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1348 (setq is-new-feed (newsticker--parse-generic-feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1349 name time |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1350 ;; title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1351 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1352 (car (xml-get-children channelnode 'title)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1353 ;; desc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1354 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1355 (car (xml-get-children channelnode |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1356 'description)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1357 ;; link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1358 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1359 (car (xml-get-children channelnode 'link)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1360 ;; extra-elements |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1361 (xml-node-children channelnode))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1362 (setq has-new-items (newsticker--parse-generic-items |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1363 name time (xml-get-children channelnode 'item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1364 ;; title-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1365 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1366 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1367 (car (xml-get-children node 'title))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1368 ;; desc-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1369 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1370 (or (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1371 (car (xml-get-children node |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1372 'content:encoded)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1373 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1374 (car (xml-get-children node |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1375 'description)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1376 ;; link-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1377 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1378 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1379 (car (xml-get-children node 'link))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1380 ;; time-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1381 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1382 (newsticker--decode-rfc822-date |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1383 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1384 (car (xml-get-children node 'pubDate)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1385 ;; guid-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1386 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1387 (newsticker--guid-to-string |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1388 (assoc 'guid (xml-node-children node)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1389 ;; extra-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1390 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1391 (xml-node-children node)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1392 (or has-new-items is-new-feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1393 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1394 (defun newsticker--parse-generic-feed (name time title desc link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1395 extra-elements) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1396 "Parse generic news feed data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1397 Argument NAME gives the name of a news feed. TIME gives the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1398 system time at which the data have been retrieved. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1399 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1400 The arguments TITLE, DESC, LINK, and EXTRA-ELEMENTS give the feed's title, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1401 description, link, and extra elements resp." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1402 (let ((title (or title "[untitled]")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1403 (link (or link "")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1404 (old-item nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1405 (position 0) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1406 (something-was-added nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1407 ;; decode numeric entities |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1408 (setq title (newsticker--decode-numeric-entities title)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1409 (setq desc (newsticker--decode-numeric-entities desc)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1410 (setq link (newsticker--decode-numeric-entities link)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1411 ;; remove whitespace from title, desc, and link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1412 (setq title (newsticker--remove-whitespace title)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1413 (setq desc (newsticker--remove-whitespace desc)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1414 (setq link (newsticker--remove-whitespace link)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1415 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1416 ;; handle the feed itself |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1417 (unless (newsticker--cache-contains newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1418 (intern name) title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1419 desc link 'feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1420 (setq something-was-added t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1421 (setq newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1422 (newsticker--cache-add newsticker--cache (intern name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1423 title desc link time 'feed position |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1424 extra-elements time 'feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1425 something-was-added)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1426 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1427 (defun newsticker--parse-generic-items (name time itemlist |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1428 title-fn desc-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1429 link-fn time-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1430 guid-fn extra-fn) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1431 "Parse generic news feed data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1432 Argument NAME gives the name of a news feed. TIME gives the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1433 system time at which the data have been retrieved. ITEMLIST |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1434 contains the news items returned by the xml parser. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1435 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1436 The arguments TITLE-FN, DESC-FN, LINK-FN, TIME-FN, GUID-FN, and |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1437 EXTRA-FN give functions for extracting title, description, link, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1438 time, guid, and extra-elements resp. They are called with one |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1439 argument, which is one of the items in ITEMLIST." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1440 (let (title desc link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1441 (old-item nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1442 (position 0) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1443 (something-was-added nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1444 ;; gather all items for this feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1445 (mapc (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1446 (setq position (1+ position)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1447 (setq title (or (funcall title-fn node) "[untitled]")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1448 (setq desc (funcall desc-fn node)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1449 (setq link (or (funcall link-fn node) "")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1450 (setq time (or (funcall time-fn node) time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1451 ;; It happened that the title or description |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1452 ;; contained evil HTML code that confused the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1453 ;; xml parser. Therefore: |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1454 (unless (stringp title) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1455 (setq title (prin1-to-string title))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1456 (unless (or (stringp desc) (not desc)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1457 (setq desc (prin1-to-string desc))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1458 ;; ignore items with empty title AND empty desc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1459 (when (or (> (length title) 0) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1460 (> (length desc) 0)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1461 ;; decode numeric entities |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1462 (setq title (newsticker--decode-numeric-entities title)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1463 (when desc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1464 (setq desc (newsticker--decode-numeric-entities desc))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1465 (setq link (newsticker--decode-numeric-entities link)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1466 ;; remove whitespace from title, desc, and link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1467 (setq title (newsticker--remove-whitespace title)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1468 (setq desc (newsticker--remove-whitespace desc)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1469 (setq link (newsticker--remove-whitespace link)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1470 ;; add data to cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1471 ;; do we have this item already? |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1472 (let* ((guid (funcall guid-fn node))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1473 ;;(message "guid=%s" guid) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1474 (setq old-item |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1475 (newsticker--cache-contains newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1476 (intern name) title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1477 desc link nil guid))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1478 ;; add this item, or mark it as old, or do nothing |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1479 (let ((age1 'new) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1480 (age2 'old) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1481 (item-new-p nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1482 (if old-item |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1483 (let ((prev-age (newsticker--age old-item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1484 (unless newsticker-automatically-mark-items-as-old |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1485 ;; Some feeds deliver items multiply, the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1486 ;; first time we find an 'obsolete-old one the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1487 ;; cache, the following times we find an 'old |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1488 ;; one |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1489 (if (memq prev-age '(obsolete-old old)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1490 (setq age2 'old) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1491 (setq age2 'new))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1492 (if (eq prev-age 'immortal) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1493 (setq age2 'immortal)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1494 (setq time (newsticker--time old-item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1495 ;; item was not there |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1496 (setq item-new-p t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1497 (setq something-was-added t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1498 (setq newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1499 (newsticker--cache-add |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1500 newsticker--cache (intern name) title desc link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1501 time age1 position (funcall extra-fn node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1502 time age2)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1503 (when item-new-p |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1504 (let ((item (newsticker--cache-contains |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1505 newsticker--cache (intern name) title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1506 desc link nil))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1507 (if newsticker-auto-mark-filter-list |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1508 (newsticker--run-auto-mark-filter name item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1509 (run-hook-with-args |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1510 'newsticker-new-item-functions name item)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1511 itemlist) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1512 something-was-added)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1513 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1514 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1515 ;;; Misc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1516 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1517 (defun newsticker--decode-numeric-entities (string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1518 "Decode SGML numeric entities by their respective utf characters. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1519 This function replaces numeric entities in the input STRING and |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1520 returns the modified string. For example \"*\" gets replaced |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1521 by \"*\"." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1522 (if (and string (stringp string)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1523 (let ((start 0)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1524 (while (string-match "&#\\([0-9]+\\);" string start) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1525 (condition-case nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1526 (setq string (replace-match |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1527 (string (read (substring string |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1528 (match-beginning 1) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1529 (match-end 1)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1530 nil nil string)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1531 (error nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1532 (setq start (1+ (match-beginning 0)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1533 string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1534 nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1535 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1536 (defun newsticker--remove-whitespace (string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1537 "Remove leading and trailing whitespace from STRING." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1538 ;; we must have ...+ but not ...* in the regexps otherwise xemacs loops |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1539 ;; endlessly... |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1540 (when (and string (stringp string)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1541 (replace-regexp-in-string |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1542 "[ \t\r\n]+$" "" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1543 (replace-regexp-in-string "^[ \t\r\n]+" "" string)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1544 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1545 (defun newsticker--do-forget-preformatted (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1546 "Forget pre-formatted data for ITEM. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1547 Remove the pre-formatted from `newsticker--cache'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1548 (if (nthcdr 7 item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1549 (setcar (nthcdr 7 item) nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1550 (if (nthcdr 6 item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1551 (setcar (nthcdr 6 item) nil))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1552 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1553 (defun newsticker--forget-preformatted () |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1554 "Forget all cached pre-formatted data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1555 Remove the pre-formatted from `newsticker--cache'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1556 (mapc (lambda (feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1557 (mapc 'newsticker--do-forget-preformatted |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1558 (cdr feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1559 newsticker--cache) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1560 (when (fboundp 'newsticker--buffer-set-uptodate) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1561 (newsticker--buffer-set-uptodate nil))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1562 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1563 (defun newsticker--debug-msg (string &rest args) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1564 "Print newsticker debug messages. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1565 This function calls `message' with arguments STRING and ARGS, if |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1566 `newsticker-debug' is non-nil." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1567 (and newsticker-debug |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1568 ;;(not (active-minibuffer-window)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1569 ;;(not (current-message)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1570 (apply 'message string args))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1571 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1572 (defun newsticker--decode-iso8601-date (iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1573 "Return ISO8601-STRING in format like `decode-time'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1574 Converts from ISO-8601 to Emacs representation. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1575 Examples: |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1576 2004-09-17T05:09:49.001+00:00 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1577 2004-09-17T05:09:49+00:00 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1578 2004-09-17T05:09+00:00 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1579 2004-09-17T05:09:49 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1580 2004-09-17T05:09 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1581 2004-09-17 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1582 2004-09 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1583 2004" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1584 (if iso8601-string |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1585 (when (string-match |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1586 (concat |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1587 "^ *\\([0-9]\\{4\\}\\)" ;year |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1588 "\\(-\\([0-9]\\{2\\}\\)" ;month |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1589 "\\(-\\([0-9]\\{2\\}\\)" ;day |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1590 "\\(T" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1591 "\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)" ;hour:minute |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1592 "\\(:\\([0-9]\\{2\\}\\)\\(\\.[0-9]+\\)?\\)?" ;second |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1593 ;timezone |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1594 "\\(\\([-+Z]\\)\\(\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)?" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1595 "\\)?\\)?\\)? *$") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1596 iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1597 (let ((year (read (match-string 1 iso8601-string))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1598 (month (read (or (match-string 3 iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1599 "1"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1600 (day (read (or (match-string 5 iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1601 "1"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1602 (hour (read (or (match-string 7 iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1603 "0"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1604 (minute (read (or (match-string 8 iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1605 "0"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1606 (second (read (or (match-string 10 iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1607 "0"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1608 (sign (match-string 13 iso8601-string)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1609 (offset-hour (read (or (match-string 15 iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1610 "0"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1611 (offset-minute (read (or (match-string 16 iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1612 "0")))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1613 (cond ((string= sign "+") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1614 (setq hour (- hour offset-hour)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1615 (setq minute (- minute offset-minute))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1616 ((string= sign "-") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1617 (setq hour (+ hour offset-hour)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1618 (setq minute (+ minute offset-minute)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1619 ;; if UTC subtract current-time-zone offset |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1620 ;;(setq second (+ (car (current-time-zone)) second))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1621 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1622 (condition-case nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1623 (encode-time second minute hour day month year t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1624 (error |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1625 (message "Cannot decode \"%s\"" iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1626 nil)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1627 nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1628 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1629 (defun newsticker--decode-rfc822-date (rfc822-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1630 "Return RFC822-STRING in format like `decode-time'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1631 Converts from RFC822 to Emacs representation. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1632 Examples: |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1633 Sat, 07 September 2002 00:00:01 +0100 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1634 Sat, 07 September 2002 00:00:01 MET |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1635 Sat, 07 Sep 2002 00:00:01 GMT |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1636 07 Sep 2002 00:00:01 GMT |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1637 07 Sep 2002" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1638 (if (and rfc822-string (stringp rfc822-string)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1639 (when (string-match |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1640 (concat |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1641 "\\s-*" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1642 ;; week day |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1643 "\\(\\(Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\)\\s-*,?\\)?\\s-*" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1644 ;; day |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1645 "\\([0-9]\\{1,2\\}\\)\\s-+" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1646 ;; month |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1647 "\\(Jan\\|Feb\\|Mar\\|Apr\\|May\\|Jun\\|" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1648 "Jul\\|Aug\\|Sep\\|Oct\\|Nov\\|Dec\\).*?\\s-+" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1649 ;; year |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1650 "\\([0-9]\\{2,4\\}\\)" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1651 ;; time may be missing |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1652 "\\(\\s-+" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1653 ;; hour |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1654 "\\([0-9]\\{2\\}\\)" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1655 ;; minute |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1656 ":\\([0-9]\\{2\\}\\)" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1657 ;; second |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1658 "\\(:\\([0-9]\\{2\\}\\)\\)?" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1659 ;; zone -- fixme |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1660 "\\(\\s-+\\(" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1661 "UT\\|GMT\\|EST\\|EDT\\|CST\\|CDT\\|MST\\|MDT\\|PST\\|PDT" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1662 "\\|\\([-+]\\)\\([0-9]\\{2\\}\\)\\([0-9]\\{2\\}\\)" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1663 "\\)\\)?" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1664 "\\)?") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1665 rfc822-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1666 (let ((day (read (match-string 3 rfc822-string))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1667 (month-name (match-string 4 rfc822-string)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1668 (month 0) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1669 (year (read (match-string 5 rfc822-string))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1670 (hour (read (or (match-string 7 rfc822-string) "0"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1671 (minute (read (or (match-string 8 rfc822-string) "0"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1672 (second (read (or (match-string 10 rfc822-string) "0"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1673 (zone (match-string 12 rfc822-string)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1674 (sign (match-string 13 rfc822-string)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1675 (offset-hour (read (or (match-string 14 rfc822-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1676 "0"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1677 (offset-minute (read (or (match-string 15 rfc822-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1678 "0"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1679 ;;FIXME |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1680 ) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1681 (when zone |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1682 (cond ((string= sign "+") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1683 (setq hour (- hour offset-hour)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1684 (setq minute (- minute offset-minute))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1685 ((string= sign "-") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1686 (setq hour (+ hour offset-hour)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1687 (setq minute (+ minute offset-minute))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1688 (condition-case error-data |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1689 (let ((i 1)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1690 (mapc (lambda (m) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1691 (if (string= month-name m) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1692 (setq month i)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1693 (setq i (1+ i))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1694 '("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1695 "Sep" "Oct" "Nov" "Dec")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1696 (encode-time second minute hour day month year t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1697 (error |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1698 (message "Cannot decode \"%s\": %s %s" rfc822-string |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1699 (car error-data) (cdr error-data)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1700 nil)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1701 nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1702 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1703 (defun newsticker--lists-intersect-p (list1 list2) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1704 "Return t if LIST1 and LIST2 share elements." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1705 (let ((result nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1706 (mapc (lambda (elt) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1707 (if (memq elt list2) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1708 (setq result t))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1709 list1) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1710 result)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1711 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1712 (defun newsticker--update-process-ids () |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1713 "Update list of ids of active newsticker processes. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1714 Checks list of active processes against list of newsticker processes." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1715 (let ((active-procs (process-list)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1716 (new-list nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1717 (mapc (lambda (proc) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1718 (let ((id (process-id proc))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1719 (if (memq id newsticker--process-ids) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1720 (setq new-list (cons id new-list))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1721 active-procs) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1722 (setq newsticker--process-ids new-list)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1723 (force-mode-line-update)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1724 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1725 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1726 ;;; Images |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1727 ;; ====================================================================== |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1728 (defun newsticker--images-dir () |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1729 "Return directory where feed images are saved." |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1730 (concat newsticker-dir "/images")) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1731 |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1732 (defun newsticker--image-get (feed-name url) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1733 "Get image of the news site FEED-NAME from URL. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1734 If the image has been downloaded in the last 24h do nothing." |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1735 (let ((image-name (concat (newsticker--images-dir) feed-name))) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1736 (if (and (file-exists-p image-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1737 (time-less-p (current-time) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1738 (time-add (nth 5 (file-attributes image-name)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1739 (seconds-to-time 86400)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1740 (newsticker--debug-msg "%s: Getting image for %s skipped" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1741 (format-time-string "%A, %H:%M" (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1742 feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1743 ;; download |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1744 (newsticker--debug-msg "%s: Getting image for %s" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1745 (format-time-string "%A, %H:%M" (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1746 feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1747 (let* ((buffername (concat " *newsticker-wget-image-" feed-name "*")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1748 (item (or (assoc feed-name newsticker-url-list) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1749 (assoc feed-name newsticker-url-list-defaults) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1750 (error |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1751 "Cannot get news for %s: Check newsticker-url-list" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1752 feed-name))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1753 (wget-arguments (or (car (cdr (cdr (cdr (cdr item))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1754 newsticker-wget-arguments))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1755 (save-excursion |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1756 (set-buffer (get-buffer-create buffername)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1757 (erase-buffer) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1758 ;; throw an error if there is an old wget-process around |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1759 (if (get-process feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1760 (error "Another wget-process is running for image %s" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1761 feed-name)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1762 ;; start wget |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1763 (let* ((args (append wget-arguments (list url))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1764 (proc (apply 'start-process feed-name buffername |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1765 newsticker-wget-name args))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1766 (set-process-coding-system proc 'no-conversion 'no-conversion) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1767 (set-process-sentinel proc 'newsticker--image-sentinel))))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1768 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1769 (defun newsticker--image-sentinel (process event) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1770 "Sentinel for image-retrieving PROCESS caused by EVENT." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1771 (let* ((p-status (process-status process)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1772 (exit-status (process-exit-status process)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1773 (feed-name (process-name process))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1774 ;; catch known errors (zombie processes, rubbish-xml, etc.) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1775 ;; if an error occurs the news feed is not updated! |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1776 (catch 'oops |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1777 (unless (and (eq p-status 'exit) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1778 (= exit-status 0)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1779 (message "%s: Error while retrieving image from %s" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1780 (format-time-string "%A, %H:%M" (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1781 feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1782 (throw 'oops nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1783 (let (image-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1784 (save-excursion |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1785 (set-buffer (process-buffer process)) |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1786 (setq image-name (concat (newsticker--images-dir) feed-name)) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1787 (set-buffer-file-coding-system 'no-conversion) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1788 ;; make sure the cache dir exists |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1789 (unless (file-directory-p (newsticker--images-dir)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1790 (make-directory (newsticker--images-dir))) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1791 ;; write and close buffer |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1792 (let ((require-final-newline nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1793 (backup-inhibited t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1794 (coding-system-for-write 'no-conversion)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1795 (write-region nil nil image-name nil 'quiet)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1796 (set-buffer-modified-p nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1797 (kill-buffer (current-buffer))))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1798 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1799 (defun newsticker--insert-image (img string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1800 "Insert IMG with STRING at point." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1801 (insert-image img string)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1802 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1803 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1804 ;;; HTML rendering |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1805 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1806 (defun newsticker-htmlr-render (pos1 pos2) ; |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1807 "Replacement for `htmlr-render'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1808 Renders the HTML code in the region POS1 to POS2 using htmlr." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1809 (let ((str (buffer-substring-no-properties pos1 pos2))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1810 (delete-region pos1 pos2) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1811 (insert |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1812 (with-temp-buffer |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1813 (insert str) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1814 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1815 ;; begin original htmlr-render |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1816 (when (fboundp 'htmlr-reset) (htmlr-reset)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1817 ;; something omitted here... |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1818 (when (fboundp 'htmlr-step) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1819 (while (< (point) (point-max)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1820 (htmlr-step))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1821 ;; end original htmlr-render |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1822 (newsticker--remove-whitespace (buffer-string)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1823 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1824 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1825 ;;; Manipulation of cached data |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1826 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1827 (defun newsticker--cache-set-preformatted-contents (item contents) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1828 "Set preformatted contents of ITEM to CONTENTS." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1829 (if (nthcdr 6 item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1830 (setcar (nthcdr 6 item) contents) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1831 (setcdr (nthcdr 5 item) (list contents)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1832 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1833 (defun newsticker--cache-set-preformatted-title (item title) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1834 "Set preformatted title of ITEM to TITLE." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1835 (if (nthcdr 7 item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1836 (setcar (nthcdr 7 item) title) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1837 (setcdr (nthcdr 6 item) title))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1838 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1839 (defun newsticker--cache-replace-age (data feed old-age new-age) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1840 "Mark all items in DATA in FEED which carry age OLD-AGE with NEW-AGE. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1841 If FEED is 'any it applies to all feeds. If OLD-AGE is 'any, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1842 all marks are replaced by NEW-AGE. Removes all pre-formatted contents." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1843 (mapc (lambda (a-feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1844 (when (or (eq feed 'any) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1845 (eq (car a-feed) feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1846 (let ((items (cdr a-feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1847 (mapc (lambda (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1848 (when (or (eq old-age 'any) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1849 (eq (newsticker--age item) old-age)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1850 (setcar (nthcdr 4 item) new-age) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1851 (newsticker--do-forget-preformatted item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1852 items)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1853 data) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1854 data) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1855 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1856 (defun newsticker--cache-mark-expired (data feed old-age new-age time) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1857 "Mark all expired entries. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1858 This function sets the age entries in DATA in the feed FEED. If |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1859 an item's age is OLD-AGE it is set to NEW-AGE if the item is |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1860 older than TIME." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1861 (mapc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1862 (lambda (a-feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1863 (when (or (eq feed 'any) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1864 (eq (car a-feed) feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1865 (let ((items (cdr a-feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1866 (mapc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1867 (lambda (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1868 (when (eq (newsticker--age item) old-age) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1869 (let ((exp-time (time-add (newsticker--time item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1870 (seconds-to-time time)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1871 (when (time-less-p exp-time (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1872 (newsticker--debug-msg |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1873 "Item `%s' from %s has expired on %s" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1874 (newsticker--title item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1875 (format-time-string "%Y-%02m-%d, %H:%M" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1876 (newsticker--time item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1877 (format-time-string "%Y-%02m-%d, %H:%M" exp-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1878 (setcar (nthcdr 4 item) new-age))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1879 items)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1880 data) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1881 data) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1882 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1883 (defun newsticker--cache-contains (data feed title desc link age |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1884 &optional guid) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1885 "Check DATA whether FEED contains an item with the given properties. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1886 This function returns the contained item or nil if it is not |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1887 contained. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1888 The properties which are checked are TITLE, DESC, LINK, AGE, and |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1889 GUID. In general all properties must match in order to return a |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1890 certain item, except for the following cases. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1891 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1892 If AGE equals 'feed the TITLE, DESCription and LINK do not |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1893 matter. If DESC is nil it is ignored as well. If |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1894 `newsticker-desc-comp-max' is non-nil, only the first |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1895 `newsticker-desc-comp-max' characters of DESC are taken into |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1896 account. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1897 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1898 If GUID is non-nil it is sufficient to match this value, and the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1899 other properties are ignored." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1900 ;;(newsticker--debug-msg "Looking for %s guid=%s" title guid) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1901 (condition-case nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1902 (catch 'found |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1903 (when (and desc newsticker-desc-comp-max |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1904 (> (length desc) newsticker-desc-comp-max)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1905 (setq desc (substring desc 0 newsticker-desc-comp-max))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1906 (mapc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1907 (lambda (this-feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1908 (when (eq (car this-feed) feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1909 (mapc (lambda (anitem) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1910 (when (cond (guid |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1911 ;; global unique id can match |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1912 (string= guid (newsticker--guid anitem))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1913 (t;;FIXME? |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1914 (or |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1915 ;; or title, desc, etc. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1916 (and |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1917 ;;(or (not (eq age 'feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1918 ;; (eq (newsticker--age anitem) 'feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1919 (string= (newsticker--title anitem) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1920 title) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1921 (or (not link) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1922 (string= (newsticker--link anitem) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1923 link)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1924 (or (not desc) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1925 (if (and desc newsticker-desc-comp-max |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1926 (> (length (newsticker--desc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1927 anitem)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1928 newsticker-desc-comp-max)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1929 (string= (substring |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1930 (newsticker--desc anitem) |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1931 0 |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1932 newsticker-desc-comp-max) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1933 desc) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1934 (string= (newsticker--desc anitem) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1935 desc))))))) |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1936 ;;(newsticker--debug-msg "Found %s guid=%s" |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1937 ;; (newsticker--title anitem) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1938 ;; (newsticker--guid anitem)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1939 (throw 'found anitem))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1940 (cdr this-feed)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1941 data) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1942 ;;(newsticker--debug-msg "Found nothing") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1943 nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1944 (error nil))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1945 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1946 (defun newsticker--cache-add (data feed-name-symbol title desc link time age |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1947 position extra-elements |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1948 &optional updated-time updated-age |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1949 preformatted-contents |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1950 preformatted-title) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1951 "Add another item to cache data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1952 Add to DATA in the FEED-NAME-SYMBOL an item with TITLE, DESC, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1953 LINK, TIME, AGE, POSITION, and EXTRA-ELEMENTS. If this item is |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1954 contained already, its time is set to UPDATED-TIME, its mark is |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1955 set to UPDATED-AGE, and its pre-formatted contents is set to |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1956 PREFORMATTED-CONTENTS and PREFORMATTED-TITLE. Returns the age |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1957 which the item got." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1958 (let* ((guid (newsticker--guid-to-string (assoc 'guid extra-elements))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1959 (item (newsticker--cache-contains data feed-name-symbol title desc link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1960 age guid))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1961 ;;(message "guid=%s" guid) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1962 (if item |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1963 ;; does exist already -- change age, update time and position |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1964 (progn |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1965 ;;(newsticker--debug-msg "Updating item %s %s %s %s %s -> %s %s |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1966 ;; (guid %s -> %s)" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1967 ;; feed-name-symbol title link time age |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1968 ;; updated-time updated-age |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1969 ;; guid (newsticker--guid item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1970 (if (nthcdr 5 item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1971 (setcar (nthcdr 5 item) position) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1972 (setcdr (nthcdr 4 item) (list position))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1973 (setcar (nthcdr 4 item) updated-age) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1974 (if updated-time |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1975 (setcar (nthcdr 3 item) updated-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1976 ;; replace cached pre-formatted contents |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1977 (newsticker--cache-set-preformatted-contents |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1978 item preformatted-contents) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1979 (newsticker--cache-set-preformatted-title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1980 item preformatted-title)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1981 ;; did not exist or age equals 'feed-name-symbol |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1982 (setq item (list title desc link time age position preformatted-contents |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1983 preformatted-title extra-elements)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1984 ;;(newsticker--debug-msg "Adding item %s" item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1985 (catch 'found |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1986 (mapc (lambda (this-feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1987 (when (eq (car this-feed) feed-name-symbol) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1988 (setcdr this-feed (nconc (cdr this-feed) (list item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1989 (throw 'found this-feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1990 data) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1991 ;; the feed is not contained |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1992 (add-to-list 'data (list feed-name-symbol item) t)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1993 data) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1994 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1995 (defun newsticker--cache-remove (data feed-symbol age) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1996 "Remove all entries from DATA in the feed FEED-SYMBOL with AGE. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1997 FEED-SYMBOL may be 'any. Entries from old feeds, which are no longer in |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1998 `newsticker-url-list' or `newsticker-url-list-defaults', are removed as |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1999 well." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2000 (let* ((pos data) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2001 (feed (car pos)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2002 (last-pos nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2003 (while feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2004 (if (or (assoc (symbol-name (car feed)) newsticker-url-list) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2005 (assoc (symbol-name (car feed)) newsticker-url-list-defaults)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2006 ;; feed is still valid=active |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2007 ;; (message "Keeping feed %s" (car feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2008 (if (or (eq feed-symbol 'any) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2009 (eq feed-symbol (car feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2010 (let* ((item-pos (cdr feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2011 (item (car item-pos)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2012 (prev-pos nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2013 (while item |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2014 ;;(message "%s" (car item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2015 (if (eq age (newsticker--age item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2016 ;; remove this item |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2017 (progn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2018 ;;(message "Removing item %s" (car item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2019 (if prev-pos |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2020 (setcdr prev-pos (cdr item-pos)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2021 (setcdr feed (cdr item-pos)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2022 ;;(message "Keeping item %s" (car item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2023 (setq prev-pos item-pos)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2024 (setq item-pos (cdr item-pos)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2025 (setq item (car item-pos))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2026 ;; feed is not active anymore |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2027 ;; (message "Removing feed %s" (car feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2028 (if last-pos |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2029 (setcdr last-pos (cdr pos)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2030 (setq data (cdr pos)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2031 (setq last-pos pos) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2032 (setq pos (cdr pos)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2033 (setq feed (car pos))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2034 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2035 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2036 ;;; Sorting |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2037 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2038 (defun newsticker--cache-item-compare-by-time (item1 item2) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2039 "Compare two news items ITEM1 and ITEM2 by comparing their time values." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2040 (catch 'result |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2041 (let ((age1 (newsticker--age item1)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2042 (age2 (newsticker--age item2))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2043 (if (not (eq age1 age2)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2044 (cond ((eq age1 'obsolete) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2045 (throw 'result nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2046 ((eq age2 'obsolete) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2047 (throw 'result t))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2048 (let* ((time1 (newsticker--time item1)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2049 (time2 (newsticker--time item2))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2050 (cond ((< (nth 0 time1) (nth 0 time2)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2051 nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2052 ((> (nth 0 time1) (nth 0 time2)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2053 t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2054 ((< (nth 1 time1) (nth 1 time2)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2055 nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2056 ((> (nth 1 time1) (nth 1 time2)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2057 t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2058 ((< (or (nth 2 time1) 0) (or (nth 2 time2) 0)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2059 nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2060 ((> (or (nth 2 time1) 0) (or (nth 2 time2) 0)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2061 t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2062 (t |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2063 nil))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2064 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2065 (defun newsticker--cache-item-compare-by-title (item1 item2) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2066 "Compare ITEM1 and ITEM2 by comparing their titles." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2067 (catch 'result |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2068 (let ((age1 (newsticker--age item1)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2069 (age2 (newsticker--age item2))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2070 (if (not (eq age1 age2)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2071 (cond ((eq age1 'obsolete) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2072 (throw 'result nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2073 ((eq age2 'obsolete) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2074 (throw 'result t))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2075 (string< (newsticker--title item1) (newsticker--title item2)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2076 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2077 (defun newsticker--cache-item-compare-by-position (item1 item2) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2078 "Compare ITEM1 and ITEM2 by comparing their original positions." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2079 (catch 'result |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2080 (let ((age1 (newsticker--age item1)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2081 (age2 (newsticker--age item2))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2082 (if (not (eq age1 age2)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2083 (cond ((eq age1 'obsolete) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2084 (throw 'result nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2085 ((eq age2 'obsolete) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2086 (throw 'result t))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2087 (< (or (newsticker--pos item1) 0) (or (newsticker--pos item2) 0)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2088 |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2089 (defun newsticker--cache-save-version1 () |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2090 "Update and save newsticker cache file." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2091 (interactive) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2092 (newsticker--cache-update t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2093 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2094 (defun newsticker--cache-update (&optional save) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2095 "Update newsticker cache file. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2096 If optional argument SAVE is not nil the cache file is saved to disk." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2097 (save-excursion |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2098 (unless (file-directory-p newsticker-dir) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2099 (make-directory newsticker-dir t)) |
99287
80eabff1490b
newsticker fixes: cachefile, layout changes.
Ulf Jasper <ulf.jasper@web.de>
parents:
96542
diff
changeset
|
2100 (let ((coding-system-for-write 'utf-8) |
80eabff1490b
newsticker fixes: cachefile, layout changes.
Ulf Jasper <ulf.jasper@web.de>
parents:
96542
diff
changeset
|
2101 (buf (find-file-noselect newsticker-cache-filename))) |
80eabff1490b
newsticker fixes: cachefile, layout changes.
Ulf Jasper <ulf.jasper@web.de>
parents:
96542
diff
changeset
|
2102 (when buf |
80eabff1490b
newsticker fixes: cachefile, layout changes.
Ulf Jasper <ulf.jasper@web.de>
parents:
96542
diff
changeset
|
2103 (set-buffer buf) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2104 (setq buffer-undo-list t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2105 (erase-buffer) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2106 (insert ";; -*- coding: utf-8 -*-\n") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2107 (insert (prin1-to-string newsticker--cache)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2108 (when save |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2109 (save-buffer)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2110 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2111 (defun newsticker--cache-get-feed (feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2112 "Return the cached data for the feed FEED. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2113 FEED is a symbol!" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2114 (assoc feed newsticker--cache)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2115 |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2116 (defun newsticker--cache-dir () |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2117 "Return directory for saving cache data." |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2118 (concat newsticker-dir "/feeds")) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2119 |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2120 (defun newsticker--cache-save () |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2121 "Save cache data for all feeds." |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2122 (unless (file-directory-p newsticker-dir) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2123 (make-directory newsticker-dir t)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2124 (mapc 'newsticker--cache-save-feed newsticker--cache) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2125 nil) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2126 |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2127 (defun newsticker--cache-save-feed (feed) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2128 "Save cache data for FEED." |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2129 (let ((dir (concat (newsticker--cache-dir) "/" (symbol-name (car feed))))) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2130 (unless (file-directory-p dir) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2131 (make-directory dir t)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2132 (let ((coding-system-for-write 'utf-8)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2133 (with-temp-file (concat dir "/data") |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2134 (insert ";; -*- coding: utf-8 -*-\n") |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2135 (insert (prin1-to-string (cdr feed))))))) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2136 |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2137 (defun newsticker--cache-read-version1 () |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2138 "Read version1 cache data." |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2139 (let ((coding-system-for-read 'utf-8)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2140 (when (file-exists-p newsticker-cache-filename) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2141 (with-temp-buffer |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2142 (insert-file-contents newsticker-cache-filename) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2143 (goto-char (point-min)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2144 (condition-case nil |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2145 (setq newsticker--cache (read (current-buffer))) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2146 (error |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2147 (message "Error while reading newsticker cache file!") |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2148 (setq newsticker--cache nil))))))) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2149 |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2150 (defun newsticker--cache-read () |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2151 "Read cache data." |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2152 (setq newsticker--cache nil) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2153 (if (file-exists-p newsticker-cache-filename) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2154 (progn |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2155 (when (y-or-n-p "Old newsticker cache file exists. Read it? ") |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2156 (newsticker--cache-read-version1)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2157 (message "Please remove/rename the old cache file (%s) now." |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2158 newsticker-cache-filename)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2159 (mapc (lambda (f) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2160 (newsticker--cache-read-feed (car f))) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2161 (append newsticker-url-list-defaults newsticker-url-list)))) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2162 |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2163 (defun newsticker--cache-read-feed (feed-name) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2164 "Read cache data for feed named FEED-NAME." |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2165 (let ((file-name (concat (newsticker--cache-dir) "/" feed-name "/data")) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2166 (coding-system-for-read 'utf-8)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2167 (when (file-exists-p file-name) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2168 (with-temp-buffer |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2169 (insert-file-contents file-name) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2170 (goto-char (point-min)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2171 (condition-case nil |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2172 (add-to-list 'newsticker--cache (cons (intern feed-name) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2173 (read (current-buffer)))) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2174 (error |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2175 (message "Error while reading newsticker cache file %s!" |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2176 file-name)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2177 (setq newsticker--cache nil)))))) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2178 |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2179 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2180 ;;; Statistics |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2181 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2182 (defun newsticker--stat-num-items (feed &rest ages) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2183 "Return number of items in the given FEED which have one of the given AGES. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2184 If AGES is nil, the total number of items is returned." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2185 (let ((items (cdr (newsticker--cache-get-feed feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2186 (num 0)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2187 (while items |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2188 (if ages |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2189 (if (memq (newsticker--age (car items)) ages) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2190 (setq num (1+ num))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2191 (if (memq (newsticker--age (car items)) '(new old immortal obsolete)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2192 (setq num (1+ num)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2193 (setq items (cdr items))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2194 num)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2195 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2196 (defun newsticker--stat-num-items-total (&optional age) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2197 "Return total number of items in all feeds which have the given AGE. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2198 If AGE is nil, the total number of items is returned." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2199 (apply '+ |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2200 (mapcar (lambda (feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2201 (if age |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2202 (newsticker--stat-num-items (intern (car feed)) age) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2203 (newsticker--stat-num-items (intern (car feed))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2204 (append newsticker-url-list-defaults newsticker-url-list)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2205 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2206 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2207 ;;; OPML |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2208 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2209 (defun newsticker-opml-export () |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2210 "OPML subscription export. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2211 Export subscriptions to a buffer in OPML Format." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2212 (interactive) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2213 (with-current-buffer (get-buffer-create "*OPML Export*") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2214 (set-buffer-file-coding-system 'utf-8) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2215 (insert (concat |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2216 "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2217 "<!-- OPML generated by Emacs newsticker.el -->\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2218 "<opml version=\"1.0\">\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2219 " <head>\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2220 " <title>mySubscriptions</title>\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2221 " <dateCreated>" (format-time-string "%a, %d %b %Y %T %z") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2222 "</dateCreated>\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2223 " <ownerEmail>" user-mail-address "</ownerEmail>\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2224 " <ownerName>" (user-full-name) "</ownerName>\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2225 " </head>\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2226 " <body>\n")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2227 (mapc (lambda (sub) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2228 (insert " <outline text=\"") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2229 (insert (newsticker--title sub)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2230 (insert "\" xmlUrl=\"") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2231 (insert (cadr sub)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2232 (insert "\"/>\n")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2233 (append newsticker-url-list newsticker-url-list-defaults)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2234 (insert " </body>\n</opml>\n")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2235 (pop-to-buffer "*OPML Export*") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2236 (when (fboundp 'sgml-mode) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2237 (sgml-mode))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2238 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2239 (defun newsticker--opml-import-outlines (outlines) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2240 "Recursively import OUTLINES from OPML data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2241 Note that nested outlines are currently flattened -- i.e. grouping is |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2242 removed." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2243 (mapc (lambda (outline) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2244 (let ((name (xml-get-attribute outline 'text)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2245 (url (xml-get-attribute outline 'xmlUrl)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2246 (children (xml-get-children outline 'outline))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2247 (unless (string= "" url) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2248 (add-to-list 'newsticker-url-list |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2249 (list name url nil nil nil) t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2250 (if children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2251 (newsticker--opml-import-outlines children)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2252 outlines)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2253 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2254 (defun newsticker-opml-import (filename) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2255 "Import OPML data from FILENAME." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2256 (interactive "fOPML file: ") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2257 (set-buffer (find-file-noselect filename)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2258 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2259 (let* ((node-list (xml-parse-region (point-min) (point-max))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2260 (body (car (xml-get-children (car node-list) 'body))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2261 (outlines (xml-get-children body 'outline))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2262 (newsticker--opml-import-outlines outlines)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2263 (customize-variable 'newsticker-url-list)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2264 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2265 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2266 ;;; Auto marking |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2267 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2268 (defun newsticker--run-auto-mark-filter (feed item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2269 "Automatically mark an item as old or immortal. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2270 This function checks the variable `newsticker-auto-mark-filter-list' |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2271 for an entry that matches FEED and ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2272 (let ((case-fold-search t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2273 (mapc (lambda (filter) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2274 (let ((filter-feed (car filter)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2275 (pattern-list (cadr filter))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2276 (when (string-match filter-feed feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2277 (newsticker--do-run-auto-mark-filter item pattern-list)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2278 newsticker-auto-mark-filter-list))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2279 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2280 (defun newsticker--do-run-auto-mark-filter (item list) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2281 "Actually compare ITEM against the pattern-LIST. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2282 LIST must be an element of `newsticker-auto-mark-filter-list'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2283 (mapc (lambda (pattern) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2284 (let ((age (nth 0 pattern)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2285 (place (nth 1 pattern)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2286 (regexp (nth 2 pattern)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2287 (title (newsticker--title item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2288 (desc (newsticker--desc item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2289 (when (or (eq place 'title) (eq place 'all)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2290 (when (and title (string-match regexp title)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2291 (newsticker--debug-msg "Auto-marking as %s: `%s'" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2292 age (newsticker--title item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2293 (setcar (nthcdr 4 item) age))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2294 (when (or (eq place 'description) (eq place 'all)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2295 (when (and desc (string-match regexp desc)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2296 (newsticker--debug-msg "Auto-marking as %s: `%s'" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2297 age (newsticker--title item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2298 (setcar (nthcdr 4 item) age))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2299 list)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2300 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2301 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2302 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2303 ;;; Hook samples |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2304 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2305 (defun newsticker-new-item-functions-sample (feed item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2306 "Demonstrate the use of the `newsticker-new-item-functions' hook. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2307 This function just prints out the values of the FEED and title of the ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2308 (message (concat "newsticker-new-item-functions-sample: feed=`%s', " |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2309 "title=`%s'") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2310 feed (newsticker--title item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2311 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2312 (defun newsticker-download-images (feed item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2313 "Download the first image. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2314 If FEED equals \"imagefeed\" download the first image URL found |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2315 in the description=contents of ITEM to the directory |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2316 \"~/tmp/newsticker/FEED/TITLE\" where TITLE is the title of the item." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2317 (when (string= feed "imagefeed") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2318 (let ((title (newsticker--title item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2319 (desc (newsticker--desc item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2320 (when (string-match "<img src=\"\\(http://[^ \"]+\\)\"" desc) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2321 (let ((url (substring desc (match-beginning 1) (match-end 1))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2322 (temp-dir (concat "~/tmp/newsticker/" feed "/" title)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2323 (org-dir default-directory)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2324 (unless (file-directory-p temp-dir) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2325 (make-directory temp-dir t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2326 (cd temp-dir) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2327 (message "Getting image %s" url) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2328 (apply 'start-process "wget-image" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2329 " *newsticker-wget-download-images*" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2330 newsticker-wget-name |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2331 (list url)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2332 (cd org-dir)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2333 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2334 (defun newsticker-download-enclosures (feed item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2335 "In all FEEDs download the enclosed object of the news ITEM. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2336 The object is saved to the directory \"~/tmp/newsticker/FEED/TITLE\", which |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2337 is created if it does not exist. TITLE is the title of the news |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2338 item. Argument FEED is ignored. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2339 This function is suited for adding it to `newsticker-new-item-functions'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2340 (let ((title (newsticker--title item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2341 (enclosure (newsticker--enclosure item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2342 (when enclosure |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2343 (let ((url (cdr (assoc 'url enclosure))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2344 (temp-dir (concat "~/tmp/newsticker/" feed "/" title)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2345 (org-dir default-directory)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2346 (unless (file-directory-p temp-dir) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2347 (make-directory temp-dir t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2348 (cd temp-dir) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2349 (message "Getting enclosure %s" url) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2350 (apply 'start-process "wget-enclosure" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2351 " *newsticker-wget-download-enclosures*" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2352 newsticker-wget-name |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2353 (list url)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2354 (cd org-dir))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2355 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2356 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2357 ;;; Retrieve samples |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2358 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2359 (defun newsticker-retrieve-random-message (feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2360 "Return an artificial RSS string under the name FEED-NAME." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2361 (concat "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?><rss version=\"0.91\">" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2362 "<channel>" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2363 "<title>newsticker-retrieve-random-message</title>" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2364 "<description>Sample retrieval function</description>" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2365 "<pubDate>FIXME Sat, 07 Sep 2005 00:00:01 GMT</pubDate>" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2366 "<item><title>" (format "Your lucky number is %d" (random 10000)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2367 "</title><description>" (format "Or maybe it is %d" (random 10000)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2368 "</description></item></channel></rss>")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2369 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2370 (provide 'newsticker-backend) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2371 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2372 ;; arch-tag: 0e37b658-56e9-49ab-90f9-f2df57e1a659 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2373 ;;; newsticker-backend.el ends here |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2374 |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2375 (provide 'newst-backend) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2376 |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2377 ;;; newst-backend.el ends here |