annotate lisp/gnus/gnus-picon.el @ 155:43dd3413c7c7 r20-3b4

Import from CVS: tag r20-3b4
author cvs
date Mon, 13 Aug 2007 09:39:39 +0200
parents 59463afc5666
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; gnus-picon.el --- displaying pretty icons in Gnus
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2 ;; Copyright (C) 1996,97 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Author: Wes Hardaker <hardaker@ece.ucdavis.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Keywords: news xpm annotation glyph faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; Boston, MA 02111-1307, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
28 (require 'gnus)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (require 'xpm)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (require 'annotations)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
31 (require 'custom)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
32 (require 'gnus-art)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
33 (require 'gnus-win)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
35 ;;; User variables:
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
36
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
37 (defgroup picons nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
38 "Show pictures of people, domains, and newsgroups (XEmacs).
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
39 For this to work, you must add gnus-group-display-picons to the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
40 gnus-summary-display-hook or to the gnus-article-display-hook
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
41 depending on what gnus-picons-display-where is set to. You must
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
42 also add gnus-article-display-picons to gnus-article-display-hook."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
43 :group 'gnus-visual)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
45 (defcustom gnus-picons-display-where 'picons
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 98
diff changeset
46 "Where to display the group and article icons.
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 98
diff changeset
47 Legal values are `article' and `picons'."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
48 :type '(choice symbol string)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
49 :group 'picons)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
50
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
51 (defcustom gnus-picons-has-modeline-p t
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
52 "Wether the picons window should have a modeline.
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
53 This is only useful if `gnus-picons-display-where' is `picons'."
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
54 :type 'boolean
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
55 :group 'picons)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
56
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
57 (defcustom gnus-picons-database "/usr/local/faces"
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
58 "Defines the location of the faces database.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
59 For information on obtaining this database of pretty pictures, please
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
60 see http://www.cs.indiana.edu/picons/ftp/index.html"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
61 :type 'directory
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
62 :group 'picons)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
63
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
64 (defcustom gnus-picons-news-directories '("news")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
65 "Sub-directory of the faces database containing the icons for newsgroups."
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
66 :type '(repeat string)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
67 :group 'picons)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
68 (define-obsolete-variable-alias 'gnus-picons-news-directory
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
69 'gnus-picons-news-directories)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
70
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
71 (defcustom gnus-picons-user-directories '("local" "users" "usenix" "misc")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 "List of directories to search for user faces."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
73 :type '(repeat string)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
74 :group 'picons)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
76 (defcustom gnus-picons-domain-directories '("domains")
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
77 "List of directories to search for domain faces.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
78 Some people may want to add \"unknown\" to this list."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
79 :type '(repeat string)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
80 :group 'picons)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
81
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
82 (defcustom gnus-picons-refresh-before-display nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
83 "If non-nil, display the article buffer before computing the picons."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
84 :type 'boolean
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
85 :group 'picons)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
87 (defcustom gnus-picons-x-face-file-name
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
88 (format "/tmp/picon-xface.%s.xbm" (user-login-name))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
89 "The name of the file in which to store the converted X-face header."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
90 :type 'string
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
91 :group 'picons)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
92
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
93 (defcustom gnus-picons-convert-x-face (format "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | pbmtoxbm > %s" gnus-picons-x-face-file-name)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
94 "Command to convert the x-face header into a xbm file."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
95 :type 'string
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
96 :group 'picons)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
97
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
98 (defcustom gnus-picons-display-as-address t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
99 "*If t display textual email addresses along with pictures."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
100 :type 'boolean
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
101 :group 'picons)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
102
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
103 (defcustom gnus-picons-file-suffixes
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (when (featurep 'x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (let ((types (list "xbm")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (when (featurep 'gif)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (push "gif" types))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (when (featurep 'xpm)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (push "xpm" types))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 types))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
111 "List of suffixes on picon file names to try."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
112 :type '(repeat string)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
113 :group 'picons)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
115 (defcustom gnus-picons-display-article-move-p t
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 "*Whether to move point to first empty line when displaying picons.
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
117 This has only an effect if `gnus-picons-display-where' has value `article'."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
118 :type 'boolean
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
119 :group 'picons)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
120
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
121 (defcustom gnus-picons-clear-cache-on-shutdown t
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
122 "*Whether to clear the picons cache when exiting gnus.
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
123 Gnus caches every picons it finds while it is running. This saves
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
124 some time in the search process but eats some memory. If this
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
125 variable is set to nil, Gnus will never clear the cache itself; you
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
126 will have to manually call `gnus-picons-clear-cache' to clear it.
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
127 Otherwise the cache will be cleared every time you exit Gnus."
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
128 :type 'boolean
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
129 :group 'picons)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
130
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
131 (defcustom gnus-picons-piconsearch-url nil
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
132 "*The url to query for picons. Setting this to nil will disable it.
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
133 The only plublicly available address currently known is
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
134 http://www.cs.indiana.edu:800/piconsearch. If you know of any other,
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
135 please tell me so that we can list it."
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
136 :type '(choice (const :tag "Disable" :value nil)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
137 (const :tag "www.cs.indiana.edu"
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
138 :value "http://www.cs.indiana.edu:800/piconsearch")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
139 (string))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
140 :group 'picons)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
142 ;;; Internal variables:
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
143
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
144 (defvar gnus-picons-processes-alist nil
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
145 "Picons processes currently running and their environment.")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
146 (defvar gnus-picons-glyph-alist nil
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
147 "Picons glyphs cache.
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
148 List of pairs (KEY . GLYPH) where KEY is either a filename or an URL.")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
149 (defvar gnus-picons-url-alist nil
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
150 "Picons file names cache.
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
151 List of pairs (KEY . NAME) where KEY is (USER HOST DBS) and NAME is an URL.")
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
152
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
153 (defvar gnus-group-annotations nil
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
154 "List of annotations added/removed when selecting/exiting a group")
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
155 (defvar gnus-article-annotations nil
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
156 "List of annotations added/removed when selecting an article")
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
157 (defvar gnus-x-face-annotations nil
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
158 "List of annotations added/removed when selecting an article with an
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
159 X-Face.")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
160
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
161 (defvar gnus-picons-jobs-alist nil
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
162 "List of jobs that still need be done.
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
163 This is a list of (SYM-ANN TAG ARGS...) where SYM-ANN three annotations list,
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
164 TAG is one of `picon' or `search' indicating that the job should query a
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
165 picon or do a search for picons file names, and ARGS is some additionnal
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
166 arguments necessary for the job.")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
167
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
168 (defvar gnus-picons-job-already-running nil
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
169 "Lock to ensure only one stream of http requests is running.")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
170
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
171 ;;; Functions:
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
172
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
173 (defun gnus-picons-remove (symbol)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
174 "Remove all annotations in variable named SYMBOL.
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
175 This function is careful to set it to nil before removing anything so that
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
176 asynchronous process don't get crazy."
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
177 (setq gnus-picons-jobs-alist (remassq symbol gnus-picons-jobs-alist))
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
178 ;; notify running job that it may have been preempted
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
179 (if (eq (car gnus-picons-job-already-running) symbol)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
180 (setq gnus-picons-job-already-running t))
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
181 ;; clear all annotations
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
182 (mapc (function (lambda (item)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
183 (if (annotationp item)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
184 (delete-annotation item))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
185 (prog1 (symbol-value symbol)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
186 (set symbol nil))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (defun gnus-picons-remove-all ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 "Removes all picons from the Gnus display(s)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (interactive)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
191 (gnus-picons-remove 'gnus-article-annotations)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
192 (gnus-picons-remove 'gnus-group-annotations)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
193 (gnus-picons-remove 'gnus-x-face-annotations))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (defun gnus-get-buffer-name (variable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 "Returns the buffer name associated with the contents of a variable."
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
197 (cond ((symbolp variable) (let ((newvar (cdr (assq variable
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
198 gnus-window-to-buffer))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
199 (cond ((symbolp newvar)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
200 (symbol-value newvar))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
201 ((stringp newvar) newvar))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
202 ((stringp variable) variable)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
204 (defun gnus-picons-set-buffer ()
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
205 (set-buffer
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
206 (get-buffer-create (gnus-get-buffer-name gnus-picons-display-where)))
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
207 (gnus-add-current-to-buffer-list)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
208 (goto-char (point-min))
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
209 (if (and (eq gnus-picons-display-where 'article)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
210 gnus-picons-display-article-move-p)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
211 (if (search-forward "\n\n" nil t)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
212 (forward-line -1)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
213 (goto-char (point-max)))
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
214 (setq buffer-read-only t)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
215 (unless gnus-picons-has-modeline-p
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
216 (set-specifier has-modeline-p
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
217 (list (list (current-buffer)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
218 (cons nil gnus-picons-has-modeline-p)))))))
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
219
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
220 (defun gnus-picons-prepare-for-annotations (annotations)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
221 "Prepare picons buffer for puting annotations memorized in ANNOTATIONS.
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
222 ANNOTATIONS should be a symbol naming a variable wich contains a list of
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
223 annotations. Sets buffer to `gnus-picons-display-where'."
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
224 ;; let drawing catch up
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
225 (when gnus-picons-refresh-before-display
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
226 (sit-for 0))
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
227 (gnus-picons-set-buffer)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
228 (gnus-picons-remove annotations))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
229
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
230 (defsubst gnus-picons-make-annotation (&rest args)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
231 (let ((annot (apply 'make-annotation args)))
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
232 (set-extent-property annot 'duplicable nil)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
233 annot))
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
234
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (defun gnus-picons-article-display-x-face ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 "Display the x-face header bitmap in the 'gnus-picons-display-where buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 ;; delete any old ones.
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
238 ;; This is needed here because gnus-picons-display-x-face will not
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
239 ;; be called if there is no X-Face header
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
240 (gnus-picons-remove 'gnus-x-face-annotations)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 ;; display the new one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (let ((gnus-article-x-face-command 'gnus-picons-display-x-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (gnus-article-display-x-face)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
245 (defun gnus-picons-x-face-sentinel (process event)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
246 (let* ((env (assq process gnus-picons-processes-alist))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
247 (annot (cdr env)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
248 (setq gnus-picons-processes-alist (remassq process
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
249 gnus-picons-processes-alist))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
250 (when annot
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
251 (set-annotation-glyph annot
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
252 (make-glyph gnus-picons-x-face-file-name))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
253 (if (memq annot gnus-x-face-annotations)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
254 (delete-file gnus-picons-x-face-file-name)))))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
255
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (defun gnus-picons-display-x-face (beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 "Function to display the x-face header in the picons window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 To use: (setq gnus-article-x-face-command 'gnus-picons-display-x-face)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (interactive)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
260 (if (featurep 'xface)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
261 ;; Use builtin support
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
262 (let ((buf (current-buffer)))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
263 (save-excursion
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
264 (gnus-picons-prepare-for-annotations 'gnus-x-face-annotations)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
265 (setq gnus-x-face-annotations
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
266 (cons (gnus-picons-make-annotation
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
267 (vector 'xface
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
268 :data (concat "X-Face: "
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
269 (buffer-substring beg end buf)))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
270 nil 'text)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
271 gnus-x-face-annotations))))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
272 ;; convert the x-face header to a .xbm file
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
273 (let* ((process-connection-type nil)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
274 (annot (save-excursion
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
275 (gnus-picons-prepare-for-annotations
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
276 'gnus-x-face-annotations)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
277 (gnus-picons-make-annotation nil nil 'text)))
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
278 (process (start-process-shell-command "gnus-x-face" nil
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
279 gnus-picons-convert-x-face)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
280 (push annot gnus-x-face-annotations)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
281 (push (cons process annot) gnus-picons-processes-alist)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
282 (process-kill-without-query process)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
283 (set-process-sentinel process 'gnus-picons-x-face-sentinel)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
284 (process-send-region process beg end)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
285 (process-send-eof process))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (defun gnus-article-display-picons ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 "Display faces for an author and his/her domain in gnus-picons-display-where."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (interactive)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
290 (let (from at-idx)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
291 (when (and (featurep 'xpm)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (or (not (fboundp 'device-type)) (equal (device-type) 'x))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (setq from (mail-fetch-field "from"))
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
294 (setq from (downcase (or (cadr (mail-extract-address-components
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
295 from))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
296 "")))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
297 (or (setq at-idx (string-match "@" from))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
298 (setq at-idx (length from))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (save-excursion
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
300 (let ((username (downcase (substring from 0 at-idx)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
301 (addrs (if (eq at-idx (length from))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
302 (if gnus-local-domain
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
303 (message-tokenize-header gnus-local-domain "."))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
304 (message-tokenize-header (substring from (1+ at-idx))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
305 "."))))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
306 (gnus-picons-prepare-for-annotations 'gnus-article-annotations)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
307 ;; if display in article buffer, the group annotations
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
308 ;; wrongly placed. Move them here
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
309 (if (eq gnus-picons-display-where 'article)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
310 (dolist (ext gnus-group-annotations)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
311 (set-extent-endpoints ext (point) (point))))
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
312 (if (null gnus-picons-piconsearch-url)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
313 (setq gnus-article-annotations
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
314 (nconc gnus-article-annotations
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
315 (gnus-picons-display-pairs
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
316 (gnus-picons-lookup-pairs
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
317 addrs gnus-picons-domain-directories)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
318 gnus-picons-display-as-address
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
319 "." t)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
320 (if (and gnus-picons-display-as-address addrs)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
321 (list (gnus-picons-make-annotation
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
322 [string :data "@"] nil
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
323 'text nil nil nil t)))
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
324 (gnus-picons-display-picon-or-name
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
325 (gnus-picons-lookup-user username addrs)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
326 username t)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
327 (push (list 'gnus-article-annotations 'search username addrs
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
328 gnus-picons-domain-directories t)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
329 gnus-picons-jobs-alist)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
330 (gnus-picons-next-job))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
331
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (add-hook 'gnus-summary-exit-hook 'gnus-picons-remove-all))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (defun gnus-group-display-picons ()
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
335 "Display icons for the group in the gnus-picons-display-where buffer."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (interactive)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
337 (when (and (featurep 'xpm)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (or (not (fboundp 'device-type)) (equal (device-type) 'x)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (save-excursion
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
340 (gnus-picons-prepare-for-annotations 'gnus-group-annotations)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
341 (if (null gnus-picons-piconsearch-url)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
342 (setq gnus-group-annotations
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
343 (gnus-picons-display-pairs
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
344 (gnus-picons-lookup-pairs (reverse (message-tokenize-header
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 151
diff changeset
345 (gnus-group-real-name gnus-newsgroup-name)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 151
diff changeset
346 "."))
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
347 gnus-picons-news-directories)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
348 t "."))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
349 (push (list 'gnus-group-annotations 'search nil
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 151
diff changeset
350 (message-tokenize-header
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 151
diff changeset
351 (gnus-group-real-name gnus-newsgroup-name) ".")
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
352 (if (listp gnus-picons-news-directories)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
353 gnus-picons-news-directories
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
354 (list gnus-picons-news-directories))
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
355 nil)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
356 gnus-picons-jobs-alist)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
357 (gnus-picons-next-job))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
358
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (add-hook 'gnus-summary-exit-hook 'gnus-picons-remove-all))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
361 (defsubst gnus-picons-lookup-internal (addrs dir)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
362 (setq dir (expand-file-name dir gnus-picons-database))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
363 (gnus-picons-try-face (dolist (part (reverse addrs) dir)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
364 (setq dir (expand-file-name part dir)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
366 (defun gnus-picons-lookup (addrs dirs)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
367 "Lookup the picon for ADDRS in databases DIRS.
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
368 Returns the picon filename or NIL if none found."
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
369 (let (result)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
370 (while (and dirs (null result))
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
371 (setq result (gnus-picons-lookup-internal addrs (pop dirs))))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
372 result))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
373
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
374 (defun gnus-picons-lookup-user-internal (user domains)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
375 (let ((dirs gnus-picons-user-directories)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
376 domains-tmp dir picon)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
377 (while (and dirs (null picon))
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
378 (setq domains-tmp domains
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
379 dir (pop dirs))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
380 (while (and domains-tmp
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
381 (null (setq picon (gnus-picons-lookup-internal
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
382 (cons user domains-tmp) dir))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
383 (pop domains-tmp))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
384 ;; Also make a try in MISC subdir
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
385 (unless picon
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
386 (setq picon (gnus-picons-lookup-internal (list user "MISC") dir))))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
387 picon))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
388
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
389 (defun gnus-picons-lookup-user (user domains)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
390 "Lookup the picon for USER at DOMAINS.
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
391 USER is a string containing a name.
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
392 DOMAINS is a list of strings from the fully qualified domain name."
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
393 (or (gnus-picons-lookup-user-internal user domains)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
394 (gnus-picons-lookup-user-internal "unknown" domains)))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
395
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
396 (defun gnus-picons-lookup-pairs (domains directories)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
397 "Lookup picons for DOMAINS and all its parents in DIRECTORIES.
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
398 Returns a list of PAIRS whose CAR is the picon filename or NIL if
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
399 none, and whose CDR is the corresponding element of DOMAINS."
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
400 (let (picons)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
401 (setq directories (if (listp directories)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
402 directories
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
403 (list directories)))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
404 (while domains
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
405 (push (list (gnus-picons-lookup (cons "unknown" domains) directories)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
406 (pop domains))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
407 picons))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
408 picons))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
409
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
410 (defun gnus-picons-display-picon-or-name (picon name &optional right-p)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
411 (cond (picon (gnus-picons-display-glyph picon name right-p))
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
412 (gnus-picons-display-as-address (list (gnus-picons-make-annotation
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
413 (vector 'string :data name)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
414 nil 'text
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
415 nil nil nil right-p)))))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
416
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
417 (defun gnus-picons-display-pairs (pairs &optional bar-p dot-p right-p)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
418 "Display picons in list PAIRS."
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
419 (let ((domain-p (and gnus-picons-display-as-address dot-p))
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
420 pair picons)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
421 (if (and bar-p domain-p right-p)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
422 (setq picons (gnus-picons-display-glyph
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
423 (gnus-picons-try-face gnus-xmas-glyph-directory
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
424 "bar.")
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
425 nil right-p)))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
426 (while pairs
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
427 (setq pair (pop pairs)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
428 picons (nconc picons
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
429 (gnus-picons-display-picon-or-name (car pair)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
430 (cadr pair)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
431 right-p)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
432 (if (and domain-p pairs)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
433 (list (gnus-picons-make-annotation
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
434 (vector 'string :data dot-p)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
435 nil 'text nil nil nil right-p))))))
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
436 (if (and bar-p domain-p (not right-p))
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
437 (setq picons (nconc picons
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
438 (gnus-picons-display-glyph
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
439 (gnus-picons-try-face gnus-xmas-glyph-directory
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
440 "bar.")
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
441 nil right-p))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
442 picons))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
444 (defun gnus-picons-try-face (dir &optional filebase)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
445 (let* ((dir (file-name-as-directory dir))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
446 (filebase (or filebase "face."))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
447 (key (concat dir filebase))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
448 (glyph (cdr (assoc key gnus-picons-glyph-alist)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
449 (suffixes gnus-picons-file-suffixes)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
450 f)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
451 (while (and suffixes (null glyph))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
452 (when (file-exists-p (setq f (expand-file-name (concat filebase
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
453 (pop suffixes))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
454 dir)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
455 (setq glyph (make-glyph f))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
456 (push (cons key glyph) gnus-picons-glyph-alist)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
457 glyph))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
458
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
459 (defun gnus-picons-display-glyph (glyph &optional part rightp)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
460 (let ((new (gnus-picons-make-annotation glyph (point)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
461 'text nil nil nil rightp)))
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
462 (when (and part gnus-picons-display-as-address)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
463 (set-annotation-data new (cons new
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
464 (make-glyph (vector 'string :data part))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
465 (set-annotation-action new 'gnus-picons-action-toggle))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
466 (nconc
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
467 (list new)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
468 (if (and (eq major-mode 'gnus-article-mode)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
469 (not gnus-picons-display-as-address)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
470 (not part))
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
471 (list (gnus-picons-make-annotation [string :data " "] (point)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
472 'text nil nil nil rightp))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
474 (defun gnus-picons-action-toggle (data)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
475 "Toggle annotation"
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
476 (interactive "e")
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
477 (let* ((annot (car data))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
478 (glyph (annotation-glyph annot)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
479 (set-annotation-glyph annot (cdr data))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
480 (set-annotation-data annot (cons annot glyph))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
481
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
482 (defun gnus-picons-clear-cache ()
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
483 "Clear the picons cache"
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
484 (interactive)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
485 (setq gnus-picons-glyph-alist nil
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
486 gnus-picons-url-alist nil))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
487
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (gnus-add-shutdown 'gnus-picons-close 'gnus)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (defun gnus-picons-close ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 "Shut down the picons."
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
492 (if gnus-picons-clear-cache-on-shutdown
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
493 (gnus-picons-clear-cache)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
494
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
495 ;;; Query a remote DB. This requires some stuff from w3 !
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
496
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
497 (require 'url)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
498 (require 'w3-forms)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
499
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
500 (defun gnus-picons-url-retrieve (url fn arg)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
501 (let ((old-asynch (default-value 'url-be-asynchronous))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
502 (url-working-buffer (generate-new-buffer " *picons*"))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
503 (url-package-name "Gnus")
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
504 (url-package-version gnus-version-number)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
505 url-request-method)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
506 (setq-default url-be-asynchronous t)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
507 (save-excursion
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
508 (set-buffer url-working-buffer)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
509 (setq url-be-asynchronous t
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
510 url-current-callback-data arg
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
511 url-current-callback-func fn)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
512 (url-retrieve url t))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
513 (setq-default url-be-asynchronous old-asynch)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
514
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
515 (defun gnus-picons-make-glyph (type)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
516 "Make a TYPE glyph using current buffer as data. Handles xbm nicely."
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
517 (cond ((null type) nil)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
518 ((eq type 'xbm) (let ((fname (make-temp-name "/tmp/picon")))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
519 (write-region (point-min) (point-max) fname
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
520 nil 'quiet)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
521 (prog1 (make-glyph (vector 'xbm :file fname))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
522 (delete-file fname))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
523 (t (make-glyph (vector type :data (buffer-string))))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
524
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
525 ;;; Parsing of piconsearch result page.
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
526
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
527 ;; Assumes:
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
528 ;; 1 - each value field has the form: "<strong>key</strong> = <kbd>value</kbd>"
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
529 ;; 2 - a "<p>" separates the keywords from the results
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
530 ;; 3 - every results begins by the path within the database at the beginning
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
531 ;; of the line in raw text.
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
532 ;; 3b - and the href following it is the preferred image type.
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
533
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
534 ;; if 1 or 2 is not met, it will probably cause an error. The other
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
535 ;; will go undetected
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
536
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
537 (defun gnus-picons-parse-value (name)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
538 (goto-char (point-min))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
539 (re-search-forward (concat "<strong>"
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
540 (regexp-quote name)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
541 "</strong> *= *<kbd> *\\([^ <][^<]*\\) *</kbd>"))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
542 (buffer-substring (match-beginning 1) (match-end 1)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
543
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
544 (defun gnus-picons-parse-filenames ()
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
545 ;; returns an alist of ((USER ADDRS DB) . URL)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
546 (let* ((case-fold-search t)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
547 (user (gnus-picons-parse-value "user"))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
548 (host (gnus-picons-parse-value "host"))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
549 (dbs (message-tokenize-header (gnus-picons-parse-value "db") " "))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
550 (start-re
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
551 (concat
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
552 ;; dbs
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
553 "^\\(" (mapconcat 'identity dbs "\\|") "\\)/"
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
554 ;; host
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
555 "\\(\\(" (replace-in-string host "\\." "/\\|" t) "/\\|MISC/\\)*\\)"
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
556 ;; user
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
557 "\\(" (regexp-quote user) "\\|unknown\\)/"
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
558 "face\\."))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
559 cur-db cur-host cur-user types res)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
560 ;; now point will be somewhere in the header. Find beginning of
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
561 ;; entries
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
562 (re-search-forward "<p>[ \t\n]*")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
563 (while (re-search-forward start-re nil t)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
564 (setq cur-db (buffer-substring (match-beginning 1) (match-end 1))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
565 cur-host (buffer-substring (match-beginning 2) (match-end 2))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
566 cur-user (buffer-substring (match-beginning 4) (match-end 4))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
567 cur-host (nreverse (message-tokenize-header cur-host "/")))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
568 ;; XXX - KLUDGE: there is a blank picon in news/MISC/unknown
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
569 (unless (and (string-equal cur-db "news")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
570 (string-equal cur-user "unknown")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
571 (equal cur-host '("MISC")))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
572 ;; ok now we have found an entry (USER HOST DB), find the
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
573 ;; corresponding picon URL
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
574 (save-restriction
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
575 ;; restrict region to this entry
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
576 (narrow-to-region (point) (search-forward "<br>"))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
577 (goto-char (point-min))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
578 (setq types gnus-picons-file-suffixes)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
579 (while (and types
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
580 (not (re-search-forward
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
581 (concat "<a[ \t\n]+href=\"\\([^\"]*\\."
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
582 (regexp-quote (car types)) "\\)\"")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
583 nil t)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
584 (pop types))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
585 (push (cons (list cur-user cur-host cur-db)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
586 (buffer-substring (match-beginning 1) (match-end 1)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
587 res))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
588 (nreverse res)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
589
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
590 ;;; picon network display functions :
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
591
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
592 (defun gnus-picons-network-display-internal (sym-ann glyph part right-p)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
593 (gnus-picons-set-buffer)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
594 (set sym-ann (nconc (symbol-value sym-ann)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
595 (gnus-picons-display-picon-or-name glyph part right-p)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
596 (gnus-picons-next-job-internal))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
597
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
598 (defun gnus-picons-network-display-callback (url part sym-ann right-p)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
599 (let ((glyph (gnus-picons-make-glyph (cdr (assoc url-current-mime-type
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
600 w3-image-mappings)))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
601 (kill-buffer (current-buffer))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
602 (push (cons url glyph) gnus-picons-glyph-alist)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
603 ;; only do the job if it has not been preempted.
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
604 (if (equal gnus-picons-job-already-running
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
605 (list sym-ann 'picon url part right-p))
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
606 (gnus-picons-network-display-internal sym-ann glyph part right-p)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
607 (gnus-picons-next-job-internal))))
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
608
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
609 (defun gnus-picons-network-display (url part sym-ann right-p)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
610 (let ((cache (assoc url gnus-picons-glyph-alist)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
611 (if (or cache (null url))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
612 (gnus-picons-network-display-internal sym-ann (cdr cache) part right-p)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
613 (gnus-picons-url-retrieve url 'gnus-picons-network-display-callback
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
614 (list url part sym-ann right-p)))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
615
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
616 ;;; search job functions
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
617
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
618 (defun gnus-picons-network-search-internal (user addrs dbs sym-ann right-p
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
619 &optional fnames)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
620 (let (curkey dom pfx url dbs-tmp cache new-jobs)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
621 ;; First do the domain search
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
622 (dolist (part (if right-p
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
623 (reverse addrs)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
624 addrs))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
625 (setq pfx (nconc (list part) pfx)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
626 dom (cond ((and dom right-p) (concat part "." dom))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
627 (dom (concat dom "." part))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
628 (t part))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
629 curkey (list "unknown" dom dbs))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
630 (when (null (setq cache (assoc curkey gnus-picons-url-alist)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
631 ;; This one is not yet in the cache, create a new entry
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
632 ;; Search for an entry
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
633 (setq dbs-tmp dbs
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
634 url nil)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
635 (while (and dbs-tmp (null url))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
636 (setq url (or (cdr (assoc (list "unknown" pfx (car dbs-tmp)) fnames))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
637 (and (eq dom part)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
638 ;; This is the first component. Try the
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
639 ;; catch-all MISC component
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
640 (cdr (assoc (list "unknown"
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
641 '("MISC")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
642 (car dbs-tmp))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
643 fnames)))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
644 (pop dbs-tmp))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
645 (push (setq cache (cons curkey url)) gnus-picons-url-alist))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
646 ;; Put this glyph in the job list
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
647 (if (and (not (eq dom part)) gnus-picons-display-as-address)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
648 (push (list sym-ann "." right-p) new-jobs))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
649 (push (list sym-ann 'picon (cdr cache) part right-p) new-jobs))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
650 ;; next, the user search
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
651 (when user
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
652 (setq curkey (list user dom gnus-picons-user-directories))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
653 (if (null (setq cache (assoc curkey gnus-picons-url-alist)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
654 (let ((users (list user "unknown"))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
655 dirs usr domains-tmp dir picon)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
656 (while (and users (null picon))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
657 (setq dirs gnus-picons-user-directories
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
658 usr (pop users))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
659 (while (and dirs (null picon))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
660 (setq domains-tmp addrs
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
661 dir (pop dirs))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
662 (while (and domains-tmp
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
663 (null (setq picon (assoc (list usr domains-tmp dir)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
664 fnames))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
665 (pop domains-tmp))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
666 (unless picon
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
667 (setq picon (assoc (list usr '("MISC") dir) fnames)))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
668 (push (setq cache (cons curkey (cdr picon)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
669 gnus-picons-url-alist)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
670 (if (and gnus-picons-display-as-address new-jobs)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
671 (push (list sym-ann "@" right-p) new-jobs))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
672 (push (list sym-ann 'picon (cdr cache) user right-p) new-jobs))
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
673 (if (and gnus-picons-display-as-address (not right-p))
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
674 (push (list sym-ann 'bar right-p) new-jobs))
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
675 ;; only put the jobs in the queue if this job has not been preempted.
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
676 (if (equal gnus-picons-job-already-running
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
677 (list sym-ann 'search user addrs dbs right-p))
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
678 (setq gnus-picons-jobs-alist
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
679 (nconc (if (and gnus-picons-display-as-address right-p)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
680 (list (list sym-ann 'bar right-p)))
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
681 (nreverse new-jobs)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
682 gnus-picons-jobs-alist)))
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
683 (gnus-picons-next-job-internal)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
684
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
685 (defun gnus-picons-network-search-callback (user addrs dbs sym-ann right-p)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
686 (gnus-picons-network-search-internal user addrs dbs sym-ann right-p
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
687 (prog1 (gnus-picons-parse-filenames)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
688 (kill-buffer (current-buffer)))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
689
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
690 (defun gnus-picons-network-search (user addrs dbs sym-ann right-p)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
691 (let* ((host (mapconcat 'identity addrs "."))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
692 (key (list (or user "unknown") host (if user
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
693 gnus-picons-user-directories
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
694 dbs)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
695 (cache (assoc key gnus-picons-url-alist)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
696 (if (null cache)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
697 (gnus-picons-url-retrieve
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
698 (concat gnus-picons-piconsearch-url
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
699 "?user=" (w3-form-encode-xwfu (or user "unknown"))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
700 "&host=" (w3-form-encode-xwfu host)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
701 "&db=" (mapconcat 'w3-form-encode-xwfu
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
702 (if user
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
703 (append dbs
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
704 gnus-picons-user-directories)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
705 dbs)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
706 "+"))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
707 'gnus-picons-network-search-callback
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
708 (list user addrs dbs sym-ann right-p))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
709 (gnus-picons-network-search-internal user addrs dbs sym-ann right-p))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
710
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
711 ;;; Main jobs dispatcher function
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
712
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
713 (defun gnus-picons-next-job-internal ()
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
714 (if (setq gnus-picons-job-already-running (pop gnus-picons-jobs-alist))
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
715 (let* ((job gnus-picons-job-already-running)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
716 (sym-ann (pop job))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
717 (tag (pop job)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
718 (if tag
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
719 (cond ((stringp tag);; (SYM-ANN "..." RIGHT-P)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
720 (gnus-picons-network-display-internal sym-ann nil tag
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
721 (pop job)))
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
722 ((eq 'bar tag)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
723 (gnus-picons-network-display-internal
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
724 sym-ann (gnus-picons-try-face gnus-xmas-glyph-directory
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
725 "bar.")
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
726 nil (pop job)))
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
727 ((eq 'search tag);; (SYM-ANN 'search USER ADDRS DBS RIGHT-P)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
728 (gnus-picons-network-search
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
729 (pop job) (pop job) (pop job) sym-ann (pop job)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
730 ((eq 'picon tag);; (SYM-ANN 'picon URL PART RIGHT-P)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
731 (gnus-picons-network-display
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
732 (pop job) (pop job) sym-ann (pop job)))
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
733 (t (setq gnus-picons-job-already-running nil)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
734 (error "Unknown picon job tag %s" tag)))))))
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
735
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
736 (defun gnus-picons-next-job ()
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 142
diff changeset
737 "Start processing the job queue if it is not in progress"
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
738 (unless gnus-picons-job-already-running
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
739 (gnus-picons-next-job-internal)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 (provide 'gnus-picon)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 ;;; gnus-picon.el ends here