annotate lisp/gnus/gnus-picon.el @ 142:1856695b1fa9 r20-2b5

Import from CVS: tag r20-2b5
author cvs
date Mon, 13 Aug 2007 09:33:18 +0200
parents 585fb297b004
children 59463afc5666
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
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
26 ;;; TODO:
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
27 ;; See the comment in gnus-picons-remove
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
28
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
31 (require 'gnus)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (require 'xpm)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (require 'annotations)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
34 (require 'custom)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
35 (require 'gnus-art)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
36 (require 'gnus-win)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
38 ;;; User variables:
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
39
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
40 (defgroup picons nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
41 "Show pictures of people, domains, and newsgroups (XEmacs).
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
42 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
43 gnus-summary-display-hook or to the gnus-article-display-hook
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
44 depending on what gnus-picons-display-where is set to. You must
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
45 also add gnus-article-display-picons to gnus-article-display-hook."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
46 :group 'gnus-visual)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
48 (defcustom gnus-picons-buffer "*Icon Buffer*"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
49 "Buffer name to display the icons in if gnus-picons-display-where is 'picons."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
50 :type 'string
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
51 :group 'picons)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
53 (defcustom gnus-picons-display-where 'picons
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 98
diff changeset
54 "Where to display the group and article icons.
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 98
diff changeset
55 Legal values are `article' and `picons'."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
56 :type '(choice symbol string)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
57 :group 'picons)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
58
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
59 (defcustom gnus-picons-database "/usr/local/faces"
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
60 "Defines the location of the faces database.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
61 For information on obtaining this database of pretty pictures, please
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
62 see http://www.cs.indiana.edu/picons/ftp/index.html"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
63 :type 'directory
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
64 :group 'picons)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
65
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
66 (defcustom gnus-picons-news-directory "news"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
67 "Sub-directory of the faces database containing the icons for newsgroups."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
68 :type 'string
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
69 :group 'picons)
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")
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
155 (defvar gnus-group-annotations-lock nil)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
156 (defvar gnus-article-annotations nil
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
157 "List of annotations added/removed when selecting an article")
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
158 (defvar gnus-article-annotations-lock nil)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
159 (defvar gnus-x-face-annotations nil
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
160 "List of annotations added/removed when selecting an article with an
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
161 X-Face.")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
162 (defvar gnus-x-face-annotations-lock nil)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
163
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
164 (defvar gnus-picons-jobs-alist nil
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
165 "List of jobs that still need be done.
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
166 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
167 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
168 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
169 arguments necessary for the job.")
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 (defvar gnus-picons-job-already-running nil
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
172 "Lock to ensure only one stream of http requests is running.")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
173
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
174 ;;; Functions:
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
175
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
176 (defsubst gnus-picons-lock (symbol)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
177 (intern (concat (symbol-name symbol) "-lock")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
179 (defun gnus-picons-remove (symbol)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
180 "Remove all annotations in variable named SYMBOL.
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
181 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
182 asynchronous process don't get crazy."
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
183 ;; clear the lock
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
184 (set (gnus-picons-lock symbol) nil)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
185 ;; clear all annotations
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
186 (mapc (function (lambda (item)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
187 (if (annotationp item)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
188 (delete-annotation item))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
189 (prog1 (symbol-value symbol)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
190 (set symbol nil)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
191 ;; FIXME: there's a race condition here. If a job is already
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
192 ;; running, it has already removed itself from this queue... But
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
193 ;; will still display its picon.
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
194 ;; TODO: push a request to clear an annotation. Then
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
195 ;; gnus-picons-next-job will be able to clean up when it gets the
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
196 ;; hand
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
197 (setq gnus-picons-jobs-alist (remassq symbol gnus-picons-jobs-alist)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (defun gnus-picons-remove-all ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 "Removes all picons from the Gnus display(s)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (interactive)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
202 (gnus-picons-remove 'gnus-article-annotations)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
203 (gnus-picons-remove 'gnus-group-annotations)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
204 (gnus-picons-remove 'gnus-x-face-annotations)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
205 (when (bufferp gnus-picons-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
206 (kill-buffer gnus-picons-buffer)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (defun gnus-get-buffer-name (variable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 "Returns the buffer name associated with the contents of a variable."
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
210 (cond ((symbolp variable) (let ((newvar (cdr (assq variable
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
211 gnus-window-to-buffer))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
212 (cond ((symbolp newvar)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
213 (symbol-value newvar))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
214 ((stringp newvar) newvar))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
215 ((stringp variable) variable)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
217 (defun gnus-picons-prepare-for-annotations (annotations)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
218 "Prepare picons buffer for puting annotations memorized in ANNOTATIONS.
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
219 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
220 annotations. Sets buffer to `gnus-picons-display-where'."
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
221 ;; let drawing catch up
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
222 (when gnus-picons-refresh-before-display
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
223 (sit-for 0))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
224 (set-buffer (get-buffer-create
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
225 (gnus-get-buffer-name gnus-picons-display-where)))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
226 (gnus-add-current-to-buffer-list)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
227 (goto-char (point-min))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
228 (if (and (eq gnus-picons-display-where 'article)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
229 gnus-picons-display-article-move-p)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
230 (when (search-forward "\n\n" nil t)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
231 (forward-line -1))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
232 (make-local-variable 'inhibit-read-only)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
233 (setq buffer-read-only t
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
234 inhibit-read-only nil))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
235 (gnus-picons-remove annotations))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
236
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (defun gnus-picons-article-display-x-face ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 "Display the x-face header bitmap in the 'gnus-picons-display-where buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 ;; delete any old ones.
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
240 ;; This is needed here because gnus-picons-display-x-face will not
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
241 ;; be called if there is no X-Face header
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
242 (gnus-picons-remove 'gnus-x-face-annotations)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 ;; display the new one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (let ((gnus-article-x-face-command 'gnus-picons-display-x-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (gnus-article-display-x-face)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
247 (defun gnus-picons-x-face-sentinel (process event)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
248 (let* ((env (assq process gnus-picons-processes-alist))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
249 (annot (cdr env)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
250 (setq gnus-picons-processes-alist (remassq process
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
251 gnus-picons-processes-alist))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
252 (when annot
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
253 (set-annotation-glyph annot
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
254 (make-glyph gnus-picons-x-face-file-name))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
255 (if (memq annot gnus-x-face-annotations)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
256 (delete-file gnus-picons-x-face-file-name)))))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
257
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (defun gnus-picons-display-x-face (beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 "Function to display the x-face header in the picons window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 To use: (setq gnus-article-x-face-command 'gnus-picons-display-x-face)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (interactive)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
262 (if (featurep 'xface)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
263 ;; Use builtin support
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
264 (let ((buf (current-buffer)))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
265 (save-excursion
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
266 (gnus-picons-prepare-for-annotations 'gnus-x-face-annotations)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
267 (setq gnus-x-face-annotations
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
268 (cons (make-annotation
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
269 (vector 'xface
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
270 :data (concat "X-Face: "
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
271 (buffer-substring beg end buf)))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
272 nil 'text)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
273 gnus-x-face-annotations))))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
274 ;; convert the x-face header to a .xbm file
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
275 (let* ((process-connection-type nil)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
276 (annot (save-excursion
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
277 (gnus-picons-prepare-for-annotations
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
278 'gnus-x-face-annotations)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
279 (make-annotation nil nil 'text)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
280 (process (start-process-shell-command "gnus-x-face" nil
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
281 gnus-picons-convert-x-face)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
282 (push annot gnus-x-face-annotations)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
283 (push (cons process annot) gnus-picons-processes-alist)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
284 (process-kill-without-query process)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
285 (set-process-sentinel process 'gnus-picons-x-face-sentinel)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
286 (process-send-region process beg end)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
287 (process-send-eof process))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (defun gnus-article-display-picons ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 "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
291 (interactive)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
292 (let (from at-idx)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
293 (when (and (featurep 'xpm)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (or (not (fboundp 'device-type)) (equal (device-type) 'x))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (setq from (mail-fetch-field "from"))
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
296 (setq from (downcase (or (cadr (mail-extract-address-components
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
297 from))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
298 "")))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
299 (or (setq at-idx (string-match "@" from))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
300 (setq at-idx (length from))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (save-excursion
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
302 (let ((username (downcase (substring from 0 at-idx)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
303 (addrs (if (eq at-idx (length from))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
304 (if gnus-local-domain
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
305 (message-tokenize-header gnus-local-domain "."))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
306 (message-tokenize-header (substring from (1+ at-idx))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
307 "."))))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
308 (gnus-picons-prepare-for-annotations 'gnus-article-annotations)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
309 (if (null gnus-picons-piconsearch-url)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
310 (setq gnus-article-annotations
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
311 (nconc gnus-article-annotations
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
312 (gnus-picons-display-pairs
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
313 (gnus-picons-lookup-pairs
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
314 addrs gnus-picons-domain-directories)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
315 (not (or gnus-picons-display-as-address
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
316 gnus-article-annotations))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
317 "." t)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
318 (if (and gnus-picons-display-as-address addrs)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
319 (list (make-annotation [string :data "@"] nil
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
320 'text nil nil nil t)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
321 (gnus-picons-display-picon-or-name
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
322 (gnus-picons-lookup-user username addrs)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
323 username t)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
324 (push (list 'gnus-article-annotations 'search username addrs
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
325 gnus-picons-domain-directories t)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
326 gnus-picons-jobs-alist)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
327 (gnus-picons-next-job))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
328
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (add-hook 'gnus-summary-exit-hook 'gnus-picons-remove-all))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (defun gnus-group-display-picons ()
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
332 "Display icons for the group in the gnus-picons-display-where buffer."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (interactive)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
334 (when (and (featurep 'xpm)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (or (not (fboundp 'device-type)) (equal (device-type) 'x)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (save-excursion
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
337 (gnus-picons-prepare-for-annotations 'gnus-group-annotations)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
338 (if (null gnus-picons-piconsearch-url)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
339 (setq gnus-group-annotations
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
340 (gnus-picons-display-pairs
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
341 (gnus-picons-lookup-pairs (reverse (message-tokenize-header
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
342 gnus-newsgroup-name "."))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
343 gnus-picons-news-directory)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
344 t "."))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
345 (push (list 'gnus-group-annotations 'search nil
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
346 (message-tokenize-header gnus-newsgroup-name ".")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
347 (if (listp gnus-picons-news-directory)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
348 gnus-picons-news-directory
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
349 (list gnus-picons-news-directory))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
350 nil)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
351 gnus-picons-jobs-alist)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
352 (gnus-picons-next-job))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
353
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (add-hook 'gnus-summary-exit-hook 'gnus-picons-remove-all))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
356 (defsubst gnus-picons-lookup-internal (addrs dir)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
357 (setq dir (expand-file-name dir gnus-picons-database))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
358 (gnus-picons-try-face (dolist (part (reverse addrs) dir)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
359 (setq dir (expand-file-name part dir)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
361 (defun gnus-picons-lookup (addrs dirs)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
362 "Lookup the picon for ADDRS in databases DIRS.
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
363 Returns the picon filename or NIL if none found."
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
364 (let (result)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
365 (while (and dirs (null result))
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
366 (setq result (gnus-picons-lookup-internal addrs (pop dirs))))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
367 result))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
368
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
369 (defun gnus-picons-lookup-user-internal (user domains)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
370 (let ((dirs gnus-picons-user-directories)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
371 domains-tmp dir picon)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
372 (while (and dirs (null picon))
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
373 (setq domains-tmp domains
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
374 dir (pop dirs))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
375 (while (and domains-tmp
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
376 (null (setq picon (gnus-picons-lookup-internal
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
377 (cons user domains-tmp) dir))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
378 (pop domains-tmp))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
379 ;; Also make a try in MISC subdir
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
380 (unless picon
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
381 (setq picon (gnus-picons-lookup-internal (list user "MISC") dir))))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
382 picon))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
383
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
384 (defun gnus-picons-lookup-user (user domains)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
385 "Lookup the picon for USER at DOMAINS.
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
386 USER is a string containing a name.
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
387 DOMAINS is a list of strings from the fully qualified domain name."
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
388 (or (gnus-picons-lookup-user-internal user domains)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
389 (gnus-picons-lookup-user-internal "unknown" domains)))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
390
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
391 (defun gnus-picons-lookup-pairs (domains directories)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
392 "Lookup picons for DOMAINS and all its parents in DIRECTORIES.
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
393 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
394 none, and whose CDR is the corresponding element of DOMAINS."
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
395 (let (picons)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
396 (setq directories (if (listp directories)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
397 directories
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
398 (list directories)))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
399 (while domains
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
400 (push (list (gnus-picons-lookup (cons "unknown" domains) directories)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
401 (pop domains))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
402 picons))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
403 picons))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
404
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
405 (defun gnus-picons-display-picon-or-name (picon name &optional right-p)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
406 (cond (picon (gnus-picons-display-glyph picon name right-p))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
407 (gnus-picons-display-as-address (list (make-annotation
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
408 (vector 'string :data name)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
409 nil 'text
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
410 nil nil nil right-p)))))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
411
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
412 (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
413 "Display picons in list PAIRS."
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
414 (let ((bar (and bar-p (or gnus-picons-display-as-address
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
415 (annotations-in-region (point)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
416 (min (point-max)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
417 (1+ (point)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
418 (current-buffer)))))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
419 (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)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
421 (while pairs
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
422 (setq pair (pop pairs)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
423 picons (nconc (if (and domain-p picons (not right-p))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
424 (list (make-annotation
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
425 (vector 'string :data dot-p)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
426 nil 'text nil nil nil right-p)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
427 (gnus-picons-display-picon-or-name (car pair)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
428 (cadr pair)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
429 right-p)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
430 (if (and domain-p pairs right-p)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
431 (list (make-annotation
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
432 (vector 'string :data dot-p)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
433 nil 'text nil nil nil right-p)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
434 (when (and bar domain-p)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
435 (setq bar nil)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
436 (gnus-picons-display-glyph
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
437 (gnus-picons-try-face gnus-xmas-glyph-directory
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
438 "bar.")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
439 nil t))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
440 picons)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
441 picons))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
443 (defun gnus-picons-try-face (dir &optional filebase)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
444 (let* ((dir (file-name-as-directory dir))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
445 (filebase (or filebase "face."))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
446 (key (concat dir filebase))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
447 (glyph (cdr (assoc key gnus-picons-glyph-alist)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
448 (suffixes gnus-picons-file-suffixes)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
449 f)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
450 (while (and suffixes (null glyph))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
451 (when (file-exists-p (setq f (expand-file-name (concat filebase
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
452 (pop suffixes))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
453 dir)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
454 (setq glyph (make-glyph f))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
455 (push (cons key glyph) gnus-picons-glyph-alist)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
456 glyph))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
457
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
458 (defun gnus-picons-display-glyph (glyph &optional part rightp)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
459 (let ((new (make-annotation glyph (point) 'text nil nil nil rightp)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
460 (when (and part gnus-picons-display-as-address)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
461 (set-annotation-data new (cons new
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
462 (make-glyph (vector 'string :data part))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
463 (set-annotation-action new 'gnus-picons-action-toggle))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
464 (nconc
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
465 (list new)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
466 (if (and (eq major-mode 'gnus-article-mode)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
467 (not gnus-picons-display-as-address)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
468 (not part))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
469 (list (make-annotation [string :data " "]
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
470 (point) 'text nil nil nil rightp))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
472 (defun gnus-picons-action-toggle (data)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
473 "Toggle annotation"
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
474 (interactive "e")
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
475 (let* ((annot (car data))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
476 (glyph (annotation-glyph annot)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
477 (set-annotation-glyph annot (cdr data))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
478 (set-annotation-data annot (cons annot glyph))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
479
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
480 (defun gnus-picons-clear-cache ()
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
481 "Clear the picons cache"
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
482 (interactive)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
483 (setq gnus-picons-glyph-alist nil))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
484
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (gnus-add-shutdown 'gnus-picons-close 'gnus)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (defun gnus-picons-close ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 "Shut down the picons."
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
489 (if gnus-picons-clear-cache-on-shutdown
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
490 (gnus-picons-clear-cache)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
491
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
492 ;;; Query a remote DB. This requires some stuff from w3 !
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
493
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
494 (require 'url)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
495 (require 'w3-forms)
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 (defun gnus-picons-url-retrieve (url fn arg)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
498 (let ((old-asynch (default-value 'url-be-asynchronous))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
499 (url-working-buffer (generate-new-buffer " *picons*"))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
500 (url-request-method nil)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
501 (url-package-name "Gnus")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
502 (url-package-version gnus-version-number))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
503 (setq-default url-be-asynchronous t)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
504 (save-excursion
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
505 (set-buffer url-working-buffer)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
506 (setq url-be-asynchronous t
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
507 url-show-status nil
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
508 url-current-callback-data arg
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
509 url-current-callback-func fn)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
510 (url-retrieve url t))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
511 (setq-default url-be-asynchronous old-asynch)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
512
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
513 (defun gnus-picons-make-glyph (type)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
514 "Make a TYPE glyph using current buffer as data. Handles xbm nicely."
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
515 (cond ((null type) nil)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
516 ((eq type 'xbm) (let ((fname (make-temp-name "/tmp/picon")))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
517 (write-region (point-min) (point-max) fname
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
518 nil 'quiet)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
519 (prog1 (make-glyph (vector 'xbm :file fname))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
520 (delete-file fname))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
521 (t (make-glyph (vector type :data (buffer-string))))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
522
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
523 ;;; Parsing of piconsearch result page.
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 ;; Assumes:
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
526 ;; 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
527 ;; 2 - a "<p>" separates the keywords from the results
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
528 ;; 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
529 ;; of the line in raw text.
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
530 ;; 3b - and the href following it is the preferred image type.
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
531
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
532 ;; 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
533 ;; will go undetected
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
534
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
535 (defun gnus-picons-parse-value (name)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
536 (goto-char (point-min))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
537 (re-search-forward (concat "<strong>"
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
538 (regexp-quote name)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
539 "</strong> *= *<kbd> *\\([^ <][^<]*\\) *</kbd>"))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
540 (buffer-substring (match-beginning 1) (match-end 1)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
541
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
542 (defun gnus-picons-parse-filenames ()
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
543 ;; returns an alist of ((USER ADDRS DB) . URL)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
544 (let* ((case-fold-search t)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
545 (user (gnus-picons-parse-value "user"))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
546 (host (gnus-picons-parse-value "host"))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
547 (dbs (message-tokenize-header (gnus-picons-parse-value "db") " "))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
548 (start-re
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
549 (concat
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
550 ;; dbs
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
551 "^\\(" (mapconcat 'identity dbs "\\|") "\\)/"
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
552 ;; host
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
553 "\\(\\(" (replace-in-string host "\\." "/\\|" t) "/\\|MISC/\\)*\\)"
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
554 ;; user
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
555 "\\(" (regexp-quote user) "\\|unknown\\)/"
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
556 "face\\."))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
557 cur-db cur-host cur-user types res)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
558 ;; now point will be somewhere in the header. Find beginning of
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
559 ;; entries
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
560 (re-search-forward "<p>[ \t\n]*")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
561 (while (re-search-forward start-re nil t)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
562 (setq cur-db (buffer-substring (match-beginning 1) (match-end 1))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
563 cur-host (buffer-substring (match-beginning 2) (match-end 2))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
564 cur-user (buffer-substring (match-beginning 4) (match-end 4))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
565 cur-host (nreverse (message-tokenize-header cur-host "/")))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
566 ;; XXX - KLUDGE: there is a blank picon in news/MISC/unknown
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
567 (unless (and (string-equal cur-db "news")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
568 (string-equal cur-user "unknown")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
569 (equal cur-host '("MISC")))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
570 ;; ok now we have found an entry (USER HOST DB), find the
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
571 ;; corresponding picon URL
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
572 (save-restriction
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
573 ;; restrict region to this entry
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
574 (narrow-to-region (point) (search-forward "<br>"))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
575 (goto-char (point-min))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
576 (setq types gnus-picons-file-suffixes)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
577 (while (and types
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
578 (not (re-search-forward
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
579 (concat "<a[ \t\n]+href=\"\\([^\"]*\\."
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
580 (regexp-quote (car types)) "\\)\"")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
581 nil t)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
582 (pop types))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
583 (push (cons (list cur-user cur-host cur-db)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
584 (buffer-substring (match-beginning 1) (match-end 1)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
585 res))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
586 (nreverse res)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
587
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
588 ;;; picon network display functions :
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 (defun gnus-picons-network-display-internal (sym-ann glyph part right-p)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
591 (set-buffer
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
592 (get-buffer-create (gnus-get-buffer-name gnus-picons-display-where)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
593 (set sym-ann (nconc (symbol-value sym-ann)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
594 (gnus-picons-display-picon-or-name glyph part right-p)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
595 (gnus-picons-next-job-internal))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
596
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
597 (defun gnus-picons-network-display-callback (url part sym-ann right-p)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
598 (let ((glyph (gnus-picons-make-glyph (cdr (assoc url-current-mime-type
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
599 w3-image-mappings)))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
600 (kill-buffer (current-buffer))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
601 (push (cons url glyph) gnus-picons-glyph-alist)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
602 (gnus-picons-network-display-internal sym-ann glyph part right-p)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
603
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
604 (defun gnus-picons-network-display (url part sym-ann right-p)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
605 (let ((cache (assoc url gnus-picons-glyph-alist)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
606 (if (or cache (null url))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
607 (gnus-picons-network-display-internal sym-ann (cdr cache) part right-p)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
608 (gnus-picons-url-retrieve url 'gnus-picons-network-display-callback
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
609 (list url part sym-ann right-p)))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
610
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
611 ;;; search job functions
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
612
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
613 (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
614 &optional fnames)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
615 (let (curkey dom pfx url dbs-tmp cache new-jobs)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
616 ;; First do the domain search
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
617 (dolist (part (if right-p
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
618 (reverse addrs)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
619 addrs))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
620 (setq pfx (nconc (list part) pfx)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
621 dom (cond ((and dom right-p) (concat part "." dom))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
622 (dom (concat dom "." part))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
623 (t part))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
624 curkey (list "unknown" dom dbs))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
625 (when (null (setq cache (assoc curkey gnus-picons-url-alist)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
626 ;; This one is not yet in the cache, create a new entry
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
627 ;; Search for an entry
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
628 (setq dbs-tmp dbs
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
629 url nil)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
630 (while (and dbs-tmp (null url))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
631 (setq url (or (cdr (assoc (list "unknown" pfx (car dbs-tmp)) fnames))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
632 (and (eq dom part)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
633 ;; This is the first component. Try the
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
634 ;; catch-all MISC component
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
635 (cdr (assoc (list "unknown"
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
636 '("MISC")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
637 (car dbs-tmp))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
638 fnames)))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
639 (pop dbs-tmp))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
640 (push (setq cache (cons curkey url)) gnus-picons-url-alist))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
641 ;; Put this glyph in the job list
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
642 (if (and (not (eq dom part)) gnus-picons-display-as-address)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
643 (push (list sym-ann "." right-p) new-jobs))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
644 (push (list sym-ann 'picon (cdr cache) part right-p) new-jobs))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
645 ;; next, the user search
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
646 (when user
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
647 (setq curkey (list user dom gnus-picons-user-directories))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
648 (if (null (setq cache (assoc curkey gnus-picons-url-alist)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
649 (let ((users (list user "unknown"))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
650 dirs usr domains-tmp dir picon)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
651 (while (and users (null picon))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
652 (setq dirs gnus-picons-user-directories
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
653 usr (pop users))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
654 (while (and dirs (null picon))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
655 (setq domains-tmp addrs
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
656 dir (pop dirs))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
657 (while (and domains-tmp
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
658 (null (setq picon (assoc (list usr domains-tmp dir)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
659 fnames))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
660 (pop domains-tmp))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
661 (unless picon
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
662 (setq picon (assoc (list usr '("MISC") dir) fnames)))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
663 (push (setq cache (cons curkey (cdr picon)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
664 gnus-picons-url-alist)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
665 (if (and gnus-picons-display-as-address new-jobs)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
666 (push (list sym-ann "@" right-p) new-jobs))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
667 (push (list sym-ann 'picon (cdr cache) user right-p) new-jobs))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
668 (setq gnus-picons-jobs-alist (nconc (nreverse new-jobs)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
669 gnus-picons-jobs-alist))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
670 (gnus-picons-next-job-internal)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
671
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
672 (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
673 (gnus-picons-network-search-internal user addrs dbs sym-ann right-p
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
674 (prog1 (gnus-picons-parse-filenames)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
675 (kill-buffer (current-buffer)))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
676
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
677 (defun gnus-picons-network-search (user addrs dbs sym-ann right-p)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
678 (let* ((host (mapconcat 'identity addrs "."))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
679 (key (list (or user "unknown") host (if user
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
680 gnus-picons-user-directories
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
681 dbs)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
682 (cache (assoc key gnus-picons-url-alist)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
683 (if (null cache)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
684 (gnus-picons-url-retrieve
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
685 (concat gnus-picons-piconsearch-url
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
686 "?user=" (w3-form-encode-xwfu (or user "unknown"))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
687 "&host=" (w3-form-encode-xwfu host)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
688 "&db=" (mapconcat 'w3-form-encode-xwfu
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
689 (if user
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
690 (append dbs
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
691 gnus-picons-user-directories)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
692 dbs)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
693 "+"))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
694 'gnus-picons-network-search-callback
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
695 (list user addrs dbs sym-ann right-p))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
696 (gnus-picons-network-search-internal user addrs dbs sym-ann right-p))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
697
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
698 ;;; Main jobs dispatcher function
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
699 ;; Given that XEmacs is not really multi threaded, this locking should
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
700 ;; be sufficient
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
701
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
702 (defun gnus-picons-next-job-internal ()
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
703 (if gnus-picons-jobs-alist
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
704 (let* ((job (pop gnus-picons-jobs-alist))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
705 (sym-ann (pop job))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
706 (tag (pop job)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
707 (if tag
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
708 (cond ((stringp tag);; (SYM-ANN "..." RIGHT-P)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
709 (gnus-picons-network-display-internal sym-ann nil tag
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
710 (pop job)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
711 ((eq 'search tag);; (SYM-ANN 'search USER ADDRS DBS RIGHT-P)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
712 (gnus-picons-network-search
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
713 (pop job) (pop job) (pop job) sym-ann (pop job)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
714 ((eq 'picon tag);; (SYM-ANN 'picon URL PART RIGHT-P)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
715 (gnus-picons-network-display
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
716 (pop job) (pop job) sym-ann (pop job)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
717 (t (error "Unknown picon job tag %s" tag)))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
718 (setq gnus-picons-job-already-running nil)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
719
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
720 (defun gnus-picons-next-job ()
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
721 "Start processing the job queue."
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
722 (unless gnus-picons-job-already-running
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
723 (setq gnus-picons-job-already-running t)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
724 (gnus-picons-next-job-internal)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 (provide 'gnus-picon)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 ;;; gnus-picon.el ends here