annotate lisp/gnus/gnus-srvr.el @ 26:441bb1e64a06 r19-15b96

Import from CVS: tag r19-15b96
author cvs
date Mon, 13 Aug 2007 08:51:32 +0200
parents 4103f0995bd7
children 1917ad0d78d7
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-srvr.el --- virtual server support for Gnus
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
2 ;; Copyright (C) 1995,96,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: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Keywords: news
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 (require 'gnus)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
29 (require 'gnus-spec)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
30 (require 'gnus-group)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
31 (require 'gnus-int)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
32 (require 'gnus-range)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (defvar gnus-server-mode-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 "Hook run in `gnus-server-mode' buffers.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (defconst gnus-server-line-format " {%(%h:%w%)} %s\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 "Format of server lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 It works along the same lines as a normal formatting string,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 with some simple extensions.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (defvar gnus-server-mode-line-format "Gnus List of servers"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 "The format specification for the server mode line.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (defvar gnus-server-exit-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 "*Hook run when exiting the server buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;;; Internal variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (defvar gnus-inserted-opened-servers nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (defvar gnus-server-line-format-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 `((?h how ?s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (?n name ?s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (?w where ?s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (?s status ?s)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (defvar gnus-server-mode-line-format-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 `((?S news-server ?s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (?M news-method ?s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (?u user-defined ?s)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (defvar gnus-server-line-format-spec nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (defvar gnus-server-mode-line-format-spec nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (defvar gnus-server-killed-servers nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (defvar gnus-server-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (defvar gnus-server-menu-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 "*Hook run after the creation of the server mode menu.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (defun gnus-server-make-menu-bar ()
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
73 (gnus-turn-off-edit-menu 'server)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (unless (boundp 'gnus-server-server-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (easy-menu-define
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 gnus-server-server-menu gnus-server-mode-map ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 '("Server"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 ["Add" gnus-server-add-server t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 ["Browse" gnus-server-read-server t]
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
80 ["Scan" gnus-server-scan-server t]
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 ["List" gnus-server-list-servers t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ["Kill" gnus-server-kill-server t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 ["Yank" gnus-server-yank-server t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 ["Copy" gnus-server-copy-server t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 ["Edit" gnus-server-edit-server t]
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
86 ["Regenerate" gnus-server-regenerate-server t]
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
87 ["Exit" gnus-server-exit t]))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (easy-menu-define
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 gnus-server-connections-menu gnus-server-mode-map ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 '("Connections"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ["Open" gnus-server-open-server t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 ["Close" gnus-server-close-server t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 ["Deny" gnus-server-deny-server t]
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
95 "---"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
96 ["Open All" gnus-server-open-all-servers t]
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
97 ["Close All" gnus-server-close-all-servers t]
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
98 ["Reset All" gnus-server-remove-denials t]))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (run-hooks 'gnus-server-menu-hook)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (defvar gnus-server-mode-map nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (put 'gnus-server-mode 'mode-class 'special)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (unless gnus-server-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (setq gnus-server-mode-map (make-sparse-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (suppress-keymap gnus-server-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (gnus-define-keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 gnus-server-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 " " gnus-server-read-server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 "\r" gnus-server-read-server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 gnus-mouse-2 gnus-server-pick-server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 "q" gnus-server-exit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 "l" gnus-server-list-servers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 "k" gnus-server-kill-server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 "y" gnus-server-yank-server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 "c" gnus-server-copy-server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 "a" gnus-server-add-server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 "e" gnus-server-edit-server
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
121 "s" gnus-server-scan-server
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 "O" gnus-server-open-server
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
124 "\M-o" gnus-server-open-all-servers
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 "C" gnus-server-close-server
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
126 "\M-c" gnus-server-close-all-servers
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 "D" gnus-server-deny-server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 "R" gnus-server-remove-denials
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
130 "g" gnus-server-regenerate-server
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
131
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 18
diff changeset
132 "\C-c\C-i" gnus-info-find-node
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 18
diff changeset
133 "\C-c\C-b" gnus-bug))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (defun gnus-server-mode ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 "Major mode for listing and editing servers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 All normal editing commands are switched off.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 \\<gnus-server-mode-map>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 For more in-depth information on this mode, read the manual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (`\\[gnus-info-find-node]').
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 The following commands are available:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 \\{gnus-server-mode-map}"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (interactive)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
147 (when (gnus-visual-p 'server-menu 'menu)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (gnus-server-make-menu-bar))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (kill-all-local-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (gnus-simplify-mode-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (setq major-mode 'gnus-server-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (setq mode-name "Server")
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
153 (gnus-set-default-directory)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (setq mode-line-process nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (use-local-map gnus-server-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (setq truncate-lines t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (setq buffer-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (run-hooks 'gnus-server-mode-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (defun gnus-server-insert-server-line (name method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (let* ((how (car method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (where (nth 1 method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (elem (assoc method gnus-opened-servers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (status (cond ((eq (nth 1 elem) 'denied)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 "(denied)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 ((or (gnus-server-opened method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (eq (nth 1 elem) 'ok))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 "(opened)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 "(closed)"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (gnus-add-text-properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (prog1 (1+ (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 ;; Insert the text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (eval gnus-server-line-format-spec))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (list 'gnus-server (intern name)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (defun gnus-enter-server-buffer ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 "Set up the server buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (gnus-server-setup-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (gnus-configure-windows 'server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (gnus-server-prepare))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (defun gnus-server-setup-buffer ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 "Initialize the server buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (unless (get-buffer gnus-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (set-buffer (get-buffer-create gnus-server-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (gnus-server-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (when gnus-carpal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (gnus-carpal-setup-buffer 'server)))))
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-server-prepare ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (setq gnus-server-mode-line-format-spec
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (gnus-parse-format gnus-server-mode-line-format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 gnus-server-mode-line-format-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (setq gnus-server-line-format-spec
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (gnus-parse-format gnus-server-line-format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 gnus-server-line-format-alist t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (let ((alist gnus-server-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (opened gnus-opened-servers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 done server op-ser)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (setq gnus-inserted-opened-servers nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 ;; First we do the real list of servers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (while alist
26
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 24
diff changeset
210 (unless (member (caar alist) done)
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 24
diff changeset
211 (push (caar alist) done)
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 24
diff changeset
212 (cdr (setq server (pop alist)))
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 24
diff changeset
213 (when (and server (car server) (cdr server))
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 24
diff changeset
214 (gnus-server-insert-server-line (car server) (cdr server)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 ;; Then we insert the list of servers that have been opened in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 ;; this session.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (while opened
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
218 (unless (member (cadaar opened) done)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
219 (push (cadaar opened) done)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (gnus-server-insert-server-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (setq op-ser (format "%s:%s" (caaar opened) (nth 1 (caar opened))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (caar opened))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (push (list op-ser (caar opened)) gnus-inserted-opened-servers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (setq opened (cdr opened))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (gnus-server-position-point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (defun gnus-server-server-name ()
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 16
diff changeset
229 (let ((server (get-text-property (gnus-point-at-bol) 'gnus-server)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (and server (symbol-name server))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (defalias 'gnus-server-position-point 'gnus-goto-colon)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (defconst gnus-server-edit-buffer "*Gnus edit server*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (defun gnus-server-update-server (server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (set-buffer gnus-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (let* ((buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (entry (assoc server gnus-server-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (oentry (assoc (gnus-server-to-method server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 gnus-opened-servers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (when entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (gnus-dribble-enter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (concat "(gnus-server-set-info \"" server "\" '"
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
246 (prin1-to-string (cdr entry)) ")\n")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (when (or entry oentry)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 ;; Buffer may be narrowed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (when (gnus-server-goto-server server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (gnus-delete-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (if entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (gnus-server-insert-server-line (car entry) (cdr entry))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (gnus-server-insert-server-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (format "%s:%s" (caar oentry) (nth 1 (car oentry)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (car oentry)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (gnus-server-position-point))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (defun gnus-server-set-info (server info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 ;; Enter a select method into the virtual server alist.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (when (and server info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (gnus-dribble-enter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (concat "(gnus-server-set-info \"" server "\" '"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (prin1-to-string info) ")"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (let* ((server (nth 1 info))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (entry (assoc server gnus-server-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (if entry (setcdr entry info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (setq gnus-server-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (nconc gnus-server-alist (list (cons server info))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 ;;; Interactive server functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (defun gnus-server-kill-server (server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 "Kill the server on the current line."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (interactive (list (gnus-server-server-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (unless (gnus-server-goto-server server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (if server (error "No such server: %s" server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (error "No server on the current line")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (unless (assoc server gnus-server-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (error "Read-only server %s" server))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (gnus-dribble-enter "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (gnus-delete-line))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
285 (push (assoc server gnus-server-alist) gnus-server-killed-servers)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (setq gnus-server-alist (delq (car gnus-server-killed-servers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 gnus-server-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (gnus-server-position-point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (defun gnus-server-yank-server ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 "Yank the previously killed server."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (interactive)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
293 (unless gnus-server-killed-servers
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
294 (error "No killed servers to be yanked"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (let ((alist gnus-server-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (server (gnus-server-server-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (killed (car gnus-server-killed-servers)))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
298 (if (not server)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (setq gnus-server-alist (nconc gnus-server-alist (list killed)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (if (string= server (caar gnus-server-alist))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
301 (push killed gnus-server-alist)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (while (and (cdr alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (not (string= server (caadr alist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (setq alist (cdr alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (if alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (setcdr alist (cons killed (cdr alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (setq gnus-server-alist (list killed)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (gnus-server-update-server (car killed))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (setq gnus-server-killed-servers (cdr gnus-server-killed-servers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (gnus-server-position-point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (defun gnus-server-exit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 "Return to the group buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (kill-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (switch-to-buffer gnus-group-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (run-hooks 'gnus-server-exit-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (defun gnus-server-list-servers ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 "List all available servers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (let ((cur (gnus-server-server-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (gnus-server-prepare)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (if cur (gnus-server-goto-server cur)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (forward-line -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (gnus-server-position-point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (defun gnus-server-set-status (method status)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 "Make METHOD have STATUS."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (let ((entry (assoc method gnus-opened-servers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (if entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (setcar (cdr entry) status)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (push (list method status) gnus-opened-servers))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (defun gnus-opened-servers-remove (method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 "Remove METHOD from the list of opened servers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (setq gnus-opened-servers (delq (assoc method gnus-opened-servers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 gnus-opened-servers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (defun gnus-server-open-server (server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 "Force an open of SERVER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (interactive (list (gnus-server-server-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (let ((method (gnus-server-to-method server)))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
345 (unless method
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
346 (error "No such server: %s" server))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (gnus-server-set-status method 'ok)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (or (gnus-open-server method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (progn (message "Couldn't open %s" server) nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (gnus-server-update-server server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (gnus-server-position-point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
354 (defun gnus-server-open-all-servers ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
355 "Open all servers."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
356 (interactive)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
357 (let ((servers gnus-inserted-opened-servers))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
358 (while servers
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
359 (gnus-server-open-server (car (pop servers))))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
360
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (defun gnus-server-close-server (server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 "Close SERVER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (interactive (list (gnus-server-server-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (let ((method (gnus-server-to-method server)))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
365 (unless method
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
366 (error "No such server: %s" server))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (gnus-server-set-status method 'closed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (gnus-close-server method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (gnus-server-update-server server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (gnus-server-position-point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
373 (defun gnus-server-close-all-servers ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
374 "Close all servers."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
375 (interactive)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
376 (let ((servers gnus-inserted-opened-servers))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
377 (while servers
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
378 (gnus-server-close-server (car (pop servers))))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
379
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (defun gnus-server-deny-server (server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 "Make sure SERVER will never be attempted opened."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (interactive (list (gnus-server-server-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (let ((method (gnus-server-to-method server)))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
384 (unless method
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
385 (error "No such server: %s" server))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (gnus-server-set-status method 'denied))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (gnus-server-update-server server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (gnus-server-position-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (defun gnus-server-remove-denials ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 "Make all denied servers into closed servers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (let ((servers gnus-opened-servers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (while servers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (when (eq (nth 1 (car servers)) 'denied)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (setcar (nthcdr 1 (car servers)) 'closed))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (setq servers (cdr servers))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (gnus-server-list-servers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (defun gnus-server-copy-server (from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (list
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
404 (or (gnus-server-server-name)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
405 (error "No server on the current line"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (read-string "Copy to: ")))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
407 (unless from
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
408 (error "No server on current line"))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
409 (unless (and to (not (string= to "")))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
410 (error "No name to copy to"))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
411 (when (assoc to gnus-server-alist)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
412 (error "%s already exists" to))
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
413 (unless (gnus-server-to-method from)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
414 (error "%s: no such server" from))
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
415 (let ((to-entry (cons from (gnus-copy-sequence
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
416 (gnus-server-to-method from)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (setcar to-entry to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (setcar (nthcdr 2 to-entry) to)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
419 (push to-entry gnus-server-killed-servers)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (gnus-server-yank-server)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (defun gnus-server-add-server (how where)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (list (intern (completing-read "Server method: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 gnus-valid-select-methods nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (read-string "Server name: ")))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
427 (when (assq where gnus-server-alist)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
428 (error "Server with that name already defined"))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
429 (push (list where how where) gnus-server-killed-servers)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (gnus-server-yank-server))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (defun gnus-server-goto-server (server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 "Jump to a server line."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (list (completing-read "Goto server: " gnus-server-alist nil t)))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
436 (let ((to (text-property-any (point-min) (point-max)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 'gnus-server (intern server))))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
438 (when to
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
439 (goto-char to)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
440 (gnus-server-position-point))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (defun gnus-server-edit-server (server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 "Edit the server on the current line."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (interactive (list (gnus-server-server-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (unless server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (error "No server on current line"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (unless (assoc server gnus-server-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (error "This server can't be edited"))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
449 (let ((info (cdr (assoc server gnus-server-alist))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (gnus-close-server info)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
451 (gnus-edit-form
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
452 info "Editing the server."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
453 `(lambda (form)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
454 (gnus-server-set-info ,server form)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
455 (gnus-server-list-servers)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
456 (gnus-server-position-point)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
458 (defun gnus-server-scan-server (server)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
459 "Request a scan from the current server."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
460 (interactive (list (gnus-server-server-name)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
461 (gnus-message 3 "Scanning %s...done" server)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
462 (gnus-request-scan nil (gnus-server-to-method server))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
463 (gnus-message 3 "Scanning %s...done" server))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (defun gnus-server-read-server (server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 "Browse a server."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (interactive (list (gnus-server-server-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (let ((buf (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (gnus-browse-foreign-server (gnus-server-to-method server) buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (set-buffer buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (gnus-server-update-server (gnus-server-server-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (gnus-server-position-point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (defun gnus-server-pick-server (e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (interactive "e")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (mouse-set-point e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (gnus-server-read-server (gnus-server-server-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 ;;; Browse Server Mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (defvar gnus-browse-menu-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 "*Hook run after the creation of the browse mode menu.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (defvar gnus-browse-mode-hook nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (defvar gnus-browse-mode-map nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (put 'gnus-browse-mode 'mode-class 'special)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (unless gnus-browse-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (setq gnus-browse-mode-map (make-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (suppress-keymap gnus-browse-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 (gnus-define-keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 gnus-browse-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 " " gnus-browse-read-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 "=" gnus-browse-select-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 "n" gnus-browse-next-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 "p" gnus-browse-prev-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 "\177" gnus-browse-prev-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 "N" gnus-browse-next-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 "P" gnus-browse-prev-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 "\M-n" gnus-browse-next-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 "\M-p" gnus-browse-prev-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 "\r" gnus-browse-select-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 "u" gnus-browse-unsubscribe-current-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 "l" gnus-browse-exit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 "L" gnus-browse-exit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 "q" gnus-browse-exit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 "Q" gnus-browse-exit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 "\C-c\C-c" gnus-browse-exit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 "?" gnus-browse-describe-briefly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 18
diff changeset
517 "\C-c\C-i" gnus-info-find-node
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 18
diff changeset
518 "\C-c\C-b" gnus-bug))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (defun gnus-browse-make-menu-bar ()
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
521 (gnus-turn-off-edit-menu 'browse)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
522 (unless (boundp 'gnus-browse-menu)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
523 (easy-menu-define
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
524 gnus-browse-menu gnus-browse-mode-map ""
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
525 '("Browse"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
526 ["Subscribe" gnus-browse-unsubscribe-current-group t]
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
527 ["Read" gnus-browse-read-group t]
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
528 ["Select" gnus-browse-read-group t]
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
529 ["Next" gnus-browse-next-group t]
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
530 ["Prev" gnus-browse-next-group t]
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
531 ["Exit" gnus-browse-exit t]
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
532 ))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
533 (run-hooks 'gnus-browse-menu-hook)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (defvar gnus-browse-current-method nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (defvar gnus-browse-return-buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 (defvar gnus-browse-buffer "*Gnus Browse Server*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (defun gnus-browse-foreign-server (method &optional return-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 "Browse the server METHOD."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 (setq gnus-browse-current-method method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (setq gnus-browse-return-buffer return-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 (let ((gnus-select-method method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 groups group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (gnus-message 5 "Connecting to %s..." (nth 1 method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 ((not (gnus-check-server method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (gnus-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 1 "Unable to contact server: %s" (gnus-status-message method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 nil)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
552 ((not
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
553 (prog2
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
554 (gnus-message 6 "Reading active file...")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
555 (gnus-request-list method)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
556 (gnus-message 6 "Reading active file...done")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (gnus-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 1 "Couldn't request list: %s" (gnus-status-message method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (get-buffer-create gnus-browse-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 (gnus-add-current-to-buffer-list)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
563 (when gnus-carpal
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
564 (gnus-carpal-setup-buffer 'browse))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (gnus-configure-windows 'browse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (erase-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (gnus-browse-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (setq mode-line-buffer-identification
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 (format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 "Gnus: %%b {%s:%s}" (car method) (cadr method))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (let ((cur (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (goto-char (point-min))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
578 (unless (string= gnus-ignored-newsgroups "")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
579 (delete-matching-lines gnus-ignored-newsgroups))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (while (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 "\\(^[^ \t]+\\)[ \t]+[0-9]+[ \t]+[0-9]+" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (goto-char (match-end 1))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
583 (push (cons (match-string 1)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
584 (max 0 (- (1+ (read cur)) (read cur))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
585 groups))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (setq groups (sort groups
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (lambda (l1 l2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 (string< (car l1) (car l2)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (while groups
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (setq group (car groups))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (format "K%7d: %s\n" (cdr group) (car group)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (setq groups (cdr groups))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (switch-to-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (gnus-group-position-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (gnus-message 5 "Connecting to %s...done" (nth 1 method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (defun gnus-browse-mode ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 "Major mode for browsing a foreign server.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 All normal editing commands are switched off.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 \\<gnus-browse-mode-map>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 The only things you can do in this buffer is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 1) `\\[gnus-browse-unsubscribe-current-group]' to subscribe to a group.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 The group will be inserted into the group buffer upon exit from this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 2) `\\[gnus-browse-read-group]' to read a group ephemerally.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 3) `\\[gnus-browse-exit]' to return to the group buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (kill-all-local-variables)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
618 (when (gnus-visual-p 'browse-menu 'menu)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (gnus-browse-make-menu-bar))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 (gnus-simplify-mode-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (setq major-mode 'gnus-browse-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (setq mode-name "Browse Server")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (setq mode-line-process nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (use-local-map gnus-browse-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (setq truncate-lines t)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
627 (gnus-set-default-directory)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 (setq buffer-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 (run-hooks 'gnus-browse-mode-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (defun gnus-browse-read-group (&optional no-article)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 "Enter the group at the current line."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (interactive)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
634 (let ((group (gnus-group-real-name (gnus-browse-group-name))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
635 (unless (gnus-group-read-ephemeral-group
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
636 group gnus-browse-current-method nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
637 (cons (current-buffer) 'browse))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
638 (error "Couldn't enter %s" group))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (defun gnus-browse-select-group ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 "Select the current group."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (gnus-browse-read-group 'no))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 (defun gnus-browse-next-group (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 "Go to the next group."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 (forward-line n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (gnus-group-position-point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 (defun gnus-browse-prev-group (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 "Go to the next group."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 (gnus-browse-next-group (- n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 (defun gnus-browse-unsubscribe-current-group (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 "(Un)subscribe to the next ARG groups."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 (when (eobp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 (error "No group at current line."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 (let ((ward (if (< arg 0) -1 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 (arg (abs arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 (while (and (> arg 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (gnus-browse-unsubscribe-group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (zerop (gnus-browse-next-group ward)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (decf arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (gnus-group-position-point)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
670 (when (/= 0 arg)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
671 (gnus-message 7 "No more newsgroups"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 (defun gnus-browse-group-name ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 (beginning-of-line)
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 16
diff changeset
677 (when (re-search-forward ": \\(.*\\)$" (gnus-point-at-eol) t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 (gnus-group-prefixed-name (match-string 1) gnus-browse-current-method))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 (defun gnus-browse-unsubscribe-group ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 "Toggle subscription of the current group in the browse buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 (let ((sub nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 (buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 ;; If this group it killed, then we want to subscribe it.
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
688 (when (= (following-char) ?K)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
689 (setq sub t))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 (setq group (gnus-browse-group-name))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
691 ;; Make sure the group has been properly removed before we
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
692 ;; subscribe to it.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
693 (gnus-kill-ephemeral-group group)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 (delete-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 (if sub
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 (gnus-group-change-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 (list t group gnus-level-default-subscribed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 nil nil gnus-browse-current-method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 gnus-level-default-subscribed gnus-level-killed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 (and (car (nth 1 gnus-newsrc-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 (gnus-gethash (car (nth 1 gnus-newsrc-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 gnus-newsrc-hashtb))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 (insert ? ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 (gnus-group-change-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 group gnus-level-killed gnus-level-default-subscribed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 (insert ?K)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 (defun gnus-browse-exit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 "Quit browsing and return to the group buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 (when (eq major-mode 'gnus-browse-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 (kill-buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 ;; Insert the newly subscribed groups in the group buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 (set-buffer gnus-group-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 (gnus-group-list-groups nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 (if gnus-browse-return-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 (gnus-configure-windows 'server 'force)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 (gnus-configure-windows 'group 'force)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 (defun gnus-browse-describe-briefly ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 "Give a one line description of the group mode commands."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 (gnus-message 6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 (substitute-command-keys "\\<gnus-browse-mode-map>\\[gnus-group-next-group]:Forward \\[gnus-group-prev-group]:Backward \\[gnus-browse-exit]:Exit \\[gnus-info-find-node]:Run Info \\[gnus-browse-describe-briefly]:This help")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
730 (defun gnus-server-regenerate-server ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
731 "Issue a command to the server to regenerate all its data structures."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
732 (interactive)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
733 (let ((server (gnus-server-server-name)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
734 (unless server
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
735 (error "No server on the current line"))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
736 (if (not (gnus-check-backend-function
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
737 'request-regenerate (car (gnus-server-to-method server))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
738 (error "This backend doesn't support regeneration")
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
739 (gnus-message 5 "Requesting regeneration of %s..." server)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
740 (if (gnus-request-regenerate server)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
741 (gnus-message 5 "Requesting regeneration of %s...done" server)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
742 (gnus-message 5 "Couldn't regenerate %s" server)))))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
743
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 (provide 'gnus-srvr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 ;;; gnus-srvr.el ends here.