Mercurial > emacs
annotate lisp/gnus/gnus-int.el @ 28994:0388cb689633
(lisp-mode-variables): Set comment-add.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 19 May 2000 21:36:14 +0000 |
parents | 15fc6acbae7a |
children | 9968f55ad26e |
rev | line source |
---|---|
17493 | 1 ;;; gnus-int.el --- backend interface functions for Gnus |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2 ;; Copyright (C) 1996,97,98 Free Software Foundation, Inc. |
17493 | 3 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
17493 | 5 ;; Keywords: news |
6 | |
7 ;; This file is part of GNU Emacs. | |
8 | |
9 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 ;; it under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation; either version 2, or (at your option) | |
12 ;; any later version. | |
13 | |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
22 ;; Boston, MA 02111-1307, USA. | |
23 | |
24 ;;; Commentary: | |
25 | |
26 ;;; Code: | |
27 | |
19531
f5b98be7c142
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
28 (eval-when-compile (require 'cl)) |
f5b98be7c142
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
29 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
30 (eval-when-compile (require 'cl)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
31 |
17493 | 32 (require 'gnus) |
33 | |
34 (defcustom gnus-open-server-hook nil | |
35 "Hook called just before opening connection to the news server." | |
36 :group 'gnus-start | |
37 :type 'hook) | |
38 | |
39 ;;; | |
40 ;;; Server Communication | |
41 ;;; | |
42 | |
43 (defun gnus-start-news-server (&optional confirm) | |
44 "Open a method for getting news. | |
45 If CONFIRM is non-nil, the user will be asked for an NNTP server." | |
46 (let (how) | |
47 (if gnus-current-select-method | |
48 ;; Stream is already opened. | |
49 nil | |
50 ;; Open NNTP server. | |
51 (unless gnus-nntp-service | |
52 (setq gnus-nntp-server nil)) | |
53 (when confirm | |
54 ;; Read server name with completion. | |
55 (setq gnus-nntp-server | |
56 (completing-read "NNTP server: " | |
57 (mapcar (lambda (server) (list server)) | |
58 (cons (list gnus-nntp-server) | |
59 gnus-secondary-servers)) | |
60 nil nil gnus-nntp-server))) | |
61 | |
62 (when (and gnus-nntp-server | |
63 (stringp gnus-nntp-server) | |
64 (not (string= gnus-nntp-server ""))) | |
65 (setq gnus-select-method | |
66 (cond ((or (string= gnus-nntp-server "") | |
67 (string= gnus-nntp-server "::")) | |
68 (list 'nnspool (system-name))) | |
69 ((string-match "^:" gnus-nntp-server) | |
70 (list 'nnmh gnus-nntp-server | |
71 (list 'nnmh-directory | |
72 (file-name-as-directory | |
73 (expand-file-name | |
74 (concat "~/" (substring | |
75 gnus-nntp-server 1))))) | |
76 (list 'nnmh-get-new-mail nil))) | |
77 (t | |
78 (list 'nntp gnus-nntp-server))))) | |
79 | |
80 (setq how (car gnus-select-method)) | |
81 (cond | |
82 ((eq how 'nnspool) | |
83 (require 'nnspool) | |
84 (gnus-message 5 "Looking up local news spool...")) | |
85 ((eq how 'nnmh) | |
86 (require 'nnmh) | |
87 (gnus-message 5 "Looking up mh spool...")) | |
88 (t | |
89 (require 'nntp))) | |
90 (setq gnus-current-select-method gnus-select-method) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
91 (gnus-run-hooks 'gnus-open-server-hook) |
17493 | 92 (or |
93 ;; gnus-open-server-hook might have opened it | |
94 (gnus-server-opened gnus-select-method) | |
95 (gnus-open-server gnus-select-method) | |
96 (gnus-y-or-n-p | |
97 (format | |
98 "%s (%s) open error: '%s'. Continue? " | |
99 (car gnus-select-method) (cadr gnus-select-method) | |
100 (gnus-status-message gnus-select-method))) | |
101 (gnus-error 1 "Couldn't open server on %s" | |
102 (nth 1 gnus-select-method)))))) | |
103 | |
104 (defun gnus-check-group (group) | |
105 "Try to make sure that the server where GROUP exists is alive." | |
106 (let ((method (gnus-find-method-for-group group))) | |
107 (or (gnus-server-opened method) | |
108 (gnus-open-server method)))) | |
109 | |
110 (defun gnus-check-server (&optional method silent) | |
111 "Check whether the connection to METHOD is down. | |
112 If METHOD is nil, use `gnus-select-method'. | |
113 If it is down, start it up (again)." | |
114 (let ((method (or method gnus-select-method))) | |
115 ;; Transform virtual server names into select methods. | |
116 (when (stringp method) | |
117 (setq method (gnus-server-to-method method))) | |
118 (if (gnus-server-opened method) | |
119 ;; The stream is already opened. | |
120 t | |
121 ;; Open the server. | |
122 (unless silent | |
123 (gnus-message 5 "Opening %s server%s..." (car method) | |
124 (if (equal (nth 1 method) "") "" | |
125 (format " on %s" (nth 1 method))))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
126 (gnus-run-hooks 'gnus-open-server-hook) |
17493 | 127 (prog1 |
128 (gnus-open-server method) | |
129 (unless silent | |
130 (message "")))))) | |
131 | |
132 (defun gnus-get-function (method function &optional noerror) | |
133 "Return a function symbol based on METHOD and FUNCTION." | |
134 ;; Translate server names into methods. | |
135 (unless method | |
136 (error "Attempted use of a nil select method")) | |
137 (when (stringp method) | |
138 (setq method (gnus-server-to-method method))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
139 ;; Check cache of constructed names. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
140 (let* ((method-sym (if gnus-agent |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
141 (gnus-agent-get-function method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
142 (car method))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
143 (method-fns (get method-sym 'gnus-method-functions)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
144 (func (let ((method-fnlist-elt (assq function method-fns))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
145 (unless method-fnlist-elt |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
146 (setq method-fnlist-elt |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
147 (cons function |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
148 (intern (format "%s-%s" method-sym function)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
149 (put method-sym 'gnus-method-functions |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
150 (cons method-fnlist-elt method-fns))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
151 (cdr method-fnlist-elt)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
152 ;; Maybe complain if there is no function. |
17493 | 153 (unless (fboundp func) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
154 (unless (car method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
155 (error "Trying to require a method that doesn't exist")) |
17493 | 156 (require (car method)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
157 (when (not (fboundp func)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
158 (if noerror |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
159 (setq func nil) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
160 (error "No such function: %s" func)))) |
17493 | 161 func)) |
162 | |
163 | |
164 ;;; | |
165 ;;; Interface functions to the backends. | |
166 ;;; | |
167 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
168 (defun gnus-open-server (gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
169 "Open a connection to GNUS-COMMAND-METHOD." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
170 (when (stringp gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
171 (setq gnus-command-method (gnus-server-to-method gnus-command-method))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
172 (let ((elem (assoc gnus-command-method gnus-opened-servers))) |
17493 | 173 ;; If this method was previously denied, we just return nil. |
174 (if (eq (nth 1 elem) 'denied) | |
175 (progn | |
176 (gnus-message 1 "Denied server") | |
177 nil) | |
178 ;; Open the server. | |
179 (let ((result | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
180 (funcall (gnus-get-function gnus-command-method 'open-server) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
181 (nth 1 gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
182 (nthcdr 2 gnus-command-method)))) |
17493 | 183 ;; If this hasn't been opened before, we add it to the list. |
184 (unless elem | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
185 (setq elem (list gnus-command-method nil) |
17493 | 186 gnus-opened-servers (cons elem gnus-opened-servers))) |
187 ;; Set the status of this server. | |
188 (setcar (cdr elem) (if result 'ok 'denied)) | |
189 ;; Return the result from the "open" call. | |
190 result)))) | |
191 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
192 (defun gnus-close-server (gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
193 "Close the connection to GNUS-COMMAND-METHOD." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
194 (when (stringp gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
195 (setq gnus-command-method (gnus-server-to-method gnus-command-method))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
196 (funcall (gnus-get-function gnus-command-method 'close-server) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
197 (nth 1 gnus-command-method))) |
17493 | 198 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
199 (defun gnus-request-list (gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
200 "Request the active file from GNUS-COMMAND-METHOD." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
201 (when (stringp gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
202 (setq gnus-command-method (gnus-server-to-method gnus-command-method))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
203 (funcall (gnus-get-function gnus-command-method 'request-list) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
204 (nth 1 gnus-command-method))) |
17493 | 205 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
206 (defun gnus-request-list-newsgroups (gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
207 "Request the newsgroups file from GNUS-COMMAND-METHOD." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
208 (when (stringp gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
209 (setq gnus-command-method (gnus-server-to-method gnus-command-method))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
210 (funcall (gnus-get-function gnus-command-method 'request-list-newsgroups) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
211 (nth 1 gnus-command-method))) |
17493 | 212 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
213 (defun gnus-request-newgroups (date gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
214 "Request all new groups since DATE from GNUS-COMMAND-METHOD." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
215 (when (stringp gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
216 (setq gnus-command-method (gnus-server-to-method gnus-command-method))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
217 (let ((func (gnus-get-function gnus-command-method 'request-newgroups t))) |
17493 | 218 (when func |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
219 (funcall func date (nth 1 gnus-command-method))))) |
17493 | 220 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
221 (defun gnus-server-opened (gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
222 "Check whether a connection to GNUS-COMMAND-METHOD has been opened." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
223 (when (stringp gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
224 (setq gnus-command-method (gnus-server-to-method gnus-command-method))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
225 (funcall (inline (gnus-get-function gnus-command-method 'server-opened)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
226 (nth 1 gnus-command-method))) |
17493 | 227 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
228 (defun gnus-status-message (gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
229 "Return the status message from GNUS-COMMAND-METHOD. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
230 If GNUS-COMMAND-METHOD is a string, it is interpreted as a group name. The method |
17493 | 231 this group uses will be queried." |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
232 (let ((gnus-command-method |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
233 (if (stringp gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
234 (gnus-find-method-for-group gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
235 gnus-command-method))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
236 (funcall (gnus-get-function gnus-command-method 'status-message) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
237 (nth 1 gnus-command-method)))) |
17493 | 238 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
239 (defun gnus-request-regenerate (gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
240 "Request a data generation from GNUS-COMMAND-METHOD." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
241 (when (stringp gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
242 (setq gnus-command-method (gnus-server-to-method gnus-command-method))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
243 (funcall (gnus-get-function gnus-command-method 'request-regenerate) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
244 (nth 1 gnus-command-method))) |
17493 | 245 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
246 (defun gnus-request-group (group &optional dont-check gnus-command-method) |
17493 | 247 "Request GROUP. If DONT-CHECK, no information is required." |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
248 (let ((gnus-command-method |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
249 (or gnus-command-method (inline (gnus-find-method-for-group group))))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
250 (when (stringp gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
251 (setq gnus-command-method |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
252 (inline (gnus-server-to-method gnus-command-method)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
253 (funcall (inline (gnus-get-function gnus-command-method 'request-group)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
254 (gnus-group-real-name group) (nth 1 gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
255 dont-check))) |
17493 | 256 |
257 (defun gnus-list-active-group (group) | |
258 "Request active information on GROUP." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
259 (let ((gnus-command-method (gnus-find-method-for-group group)) |
17493 | 260 (func 'list-active-group)) |
261 (when (gnus-check-backend-function func group) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
262 (funcall (gnus-get-function gnus-command-method func) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
263 (gnus-group-real-name group) (nth 1 gnus-command-method))))) |
17493 | 264 |
265 (defun gnus-request-group-description (group) | |
266 "Request a description of GROUP." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
267 (let ((gnus-command-method (gnus-find-method-for-group group)) |
17493 | 268 (func 'request-group-description)) |
269 (when (gnus-check-backend-function func group) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
270 (funcall (gnus-get-function gnus-command-method func) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
271 (gnus-group-real-name group) (nth 1 gnus-command-method))))) |
17493 | 272 |
273 (defun gnus-close-group (group) | |
274 "Request the GROUP be closed." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
275 (let ((gnus-command-method (inline (gnus-find-method-for-group group)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
276 (funcall (gnus-get-function gnus-command-method 'close-group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
277 (gnus-group-real-name group) (nth 1 gnus-command-method)))) |
17493 | 278 |
279 (defun gnus-retrieve-headers (articles group &optional fetch-old) | |
280 "Request headers for ARTICLES in GROUP. | |
281 If FETCH-OLD, retrieve all headers (or some subset thereof) in the group." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
282 (let ((gnus-command-method (gnus-find-method-for-group group))) |
17493 | 283 (if (and gnus-use-cache (numberp (car articles))) |
284 (gnus-cache-retrieve-headers articles group fetch-old) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
285 (funcall (gnus-get-function gnus-command-method 'retrieve-headers) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
286 articles (gnus-group-real-name group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
287 (nth 1 gnus-command-method) fetch-old)))) |
17493 | 288 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
289 (defun gnus-retrieve-articles (articles group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
290 "Request ARTICLES in GROUP." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
291 (let ((gnus-command-method (gnus-find-method-for-group group))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
292 (funcall (gnus-get-function gnus-command-method 'retrieve-articles) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
293 articles (gnus-group-real-name group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
294 (nth 1 gnus-command-method)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
295 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
296 (defun gnus-retrieve-groups (groups gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
297 "Request active information on GROUPS from GNUS-COMMAND-METHOD." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
298 (when (stringp gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
299 (setq gnus-command-method (gnus-server-to-method gnus-command-method))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
300 (funcall (gnus-get-function gnus-command-method 'retrieve-groups) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
301 groups (nth 1 gnus-command-method))) |
17493 | 302 |
303 (defun gnus-request-type (group &optional article) | |
304 "Return the type (`post' or `mail') of GROUP (and ARTICLE)." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
305 (let ((gnus-command-method (gnus-find-method-for-group group))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
306 (if (not (gnus-check-backend-function |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
307 'request-type (car gnus-command-method))) |
17493 | 308 'unknown |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
309 (funcall (gnus-get-function gnus-command-method 'request-type) |
17493 | 310 (gnus-group-real-name group) article)))) |
311 | |
312 (defun gnus-request-update-mark (group article mark) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
313 "Allow the backend to change the mark the user tries to put on an article." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
314 (let ((gnus-command-method (gnus-find-method-for-group group))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
315 (if (not (gnus-check-backend-function |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
316 'request-update-mark (car gnus-command-method))) |
17493 | 317 mark |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
318 (funcall (gnus-get-function gnus-command-method 'request-update-mark) |
17493 | 319 (gnus-group-real-name group) article mark)))) |
320 | |
321 (defun gnus-request-article (article group &optional buffer) | |
322 "Request the ARTICLE in GROUP. | |
323 ARTICLE can either be an article number or an article Message-ID. | |
324 If BUFFER, insert the article in that group." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
325 (let ((gnus-command-method (gnus-find-method-for-group group))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
326 (funcall (gnus-get-function gnus-command-method 'request-article) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
327 article (gnus-group-real-name group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
328 (nth 1 gnus-command-method) buffer))) |
17493 | 329 |
330 (defun gnus-request-head (article group) | |
331 "Request the head of ARTICLE in GROUP." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
332 (let* ((gnus-command-method (gnus-find-method-for-group group)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
333 (head (gnus-get-function gnus-command-method 'request-head t)) |
17493 | 334 res clean-up) |
335 (cond | |
336 ;; Check the cache. | |
337 ((and gnus-use-cache | |
338 (numberp article) | |
339 (gnus-cache-request-article article group)) | |
340 (setq res (cons group article) | |
341 clean-up t)) | |
342 ;; Use `head' function. | |
343 ((fboundp head) | |
344 (setq res (funcall head article (gnus-group-real-name group) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
345 (nth 1 gnus-command-method)))) |
17493 | 346 ;; Use `article' function. |
347 (t | |
348 (setq res (gnus-request-article article group) | |
349 clean-up t))) | |
350 (when clean-up | |
351 (save-excursion | |
352 (set-buffer nntp-server-buffer) | |
353 (goto-char (point-min)) | |
354 (when (search-forward "\n\n" nil t) | |
355 (delete-region (1- (point)) (point-max))) | |
356 (nnheader-fold-continuation-lines))) | |
357 res)) | |
358 | |
359 (defun gnus-request-body (article group) | |
360 "Request the body of ARTICLE in GROUP." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
361 (let* ((gnus-command-method (gnus-find-method-for-group group)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
362 (head (gnus-get-function gnus-command-method 'request-body t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
363 res clean-up) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
364 (cond |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
365 ;; Check the cache. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
366 ((and gnus-use-cache |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
367 (numberp article) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
368 (gnus-cache-request-article article group)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
369 (setq res (cons group article) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
370 clean-up t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
371 ;; Use `head' function. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
372 ((fboundp head) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
373 (setq res (funcall head article (gnus-group-real-name group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
374 (nth 1 gnus-command-method)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
375 ;; Use `article' function. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
376 (t |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
377 (setq res (gnus-request-article article group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
378 clean-up t))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
379 (when clean-up |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
380 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
381 (set-buffer nntp-server-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
382 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
383 (when (search-forward "\n\n" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
384 (delete-region (point-min) (1- (point)))))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
385 res)) |
17493 | 386 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
387 (defun gnus-request-post (gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
388 "Post the current buffer using GNUS-COMMAND-METHOD." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
389 (when (stringp gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
390 (setq gnus-command-method (gnus-server-to-method gnus-command-method))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
391 (funcall (gnus-get-function gnus-command-method 'request-post) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
392 (nth 1 gnus-command-method))) |
17493 | 393 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
394 (defun gnus-request-scan (group gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
395 "Request a SCAN being performed in GROUP from GNUS-COMMAND-METHOD. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
396 If GROUP is nil, all groups on GNUS-COMMAND-METHOD are scanned." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
397 (when gnus-plugged |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
398 (let ((gnus-command-method |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
399 (if group (gnus-find-method-for-group group) gnus-command-method)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
400 (gnus-inhibit-demon t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
401 (funcall (gnus-get-function gnus-command-method 'request-scan) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
402 (and group (gnus-group-real-name group)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
403 (nth 1 gnus-command-method))))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
404 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
405 (defsubst gnus-request-update-info (info gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
406 "Request that GNUS-COMMAND-METHOD update INFO." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
407 (when (stringp gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
408 (setq gnus-command-method (gnus-server-to-method gnus-command-method))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
409 (when (gnus-check-backend-function |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
410 'request-update-info (car gnus-command-method)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
411 (funcall (gnus-get-function gnus-command-method 'request-update-info) |
17493 | 412 (gnus-group-real-name (gnus-info-group info)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
413 info (nth 1 gnus-command-method)))) |
17493 | 414 |
415 (defun gnus-request-expire-articles (articles group &optional force) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
416 (let ((gnus-command-method (gnus-find-method-for-group group))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
417 (funcall (gnus-get-function gnus-command-method 'request-expire-articles) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
418 articles (gnus-group-real-name group) (nth 1 gnus-command-method) |
17493 | 419 force))) |
420 | |
421 (defun gnus-request-move-article | |
422 (article group server accept-function &optional last) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
423 (let ((gnus-command-method (gnus-find-method-for-group group))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
424 (funcall (gnus-get-function gnus-command-method 'request-move-article) |
17493 | 425 article (gnus-group-real-name group) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
426 (nth 1 gnus-command-method) accept-function last))) |
17493 | 427 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
428 (defun gnus-request-accept-article (group &optional gnus-command-method last) |
17493 | 429 ;; Make sure there's a newline at the end of the article. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
430 (when (stringp gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
431 (setq gnus-command-method (gnus-server-to-method gnus-command-method))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
432 (when (and (not gnus-command-method) |
17493 | 433 (stringp group)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
434 (setq gnus-command-method (gnus-group-name-to-method group))) |
17493 | 435 (goto-char (point-max)) |
436 (unless (bolp) | |
437 (insert "\n")) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
438 (let ((func (car (or gnus-command-method |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
439 (gnus-find-method-for-group group))))) |
17493 | 440 (funcall (intern (format "%s-request-accept-article" func)) |
441 (if (stringp group) (gnus-group-real-name group) group) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
442 (cadr gnus-command-method) |
17493 | 443 last))) |
444 | |
445 (defun gnus-request-replace-article (article group buffer) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19531
diff
changeset
|
446 (let ((func (car (gnus-group-name-to-method group)))) |
17493 | 447 (funcall (intern (format "%s-request-replace-article" func)) |
448 article (gnus-group-real-name group) buffer))) | |
449 | |
450 (defun gnus-request-associate-buffer (group) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
451 (let ((gnus-command-method (gnus-find-method-for-group group))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
452 (funcall (gnus-get-function gnus-command-method 'request-associate-buffer) |
17493 | 453 (gnus-group-real-name group)))) |
454 | |
455 (defun gnus-request-restore-buffer (article group) | |
456 "Request a new buffer restored to the state of ARTICLE." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
457 (let ((gnus-command-method (gnus-find-method-for-group group))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
458 (funcall (gnus-get-function gnus-command-method 'request-restore-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
459 article (gnus-group-real-name group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
460 (nth 1 gnus-command-method)))) |
17493 | 461 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
462 (defun gnus-request-create-group (group &optional gnus-command-method args) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
463 (when (stringp gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
464 (setq gnus-command-method (gnus-server-to-method gnus-command-method))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
465 (let ((gnus-command-method |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
466 (or gnus-command-method (gnus-find-method-for-group group)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
467 (funcall (gnus-get-function gnus-command-method 'request-create-group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
468 (gnus-group-real-name group) (nth 1 gnus-command-method) args))) |
17493 | 469 |
470 (defun gnus-request-delete-group (group &optional force) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
471 (let ((gnus-command-method (gnus-find-method-for-group group))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
472 (funcall (gnus-get-function gnus-command-method 'request-delete-group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
473 (gnus-group-real-name group) force (nth 1 gnus-command-method)))) |
17493 | 474 |
475 (defun gnus-request-rename-group (group new-name) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
476 (let ((gnus-command-method (gnus-find-method-for-group group))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
477 (funcall (gnus-get-function gnus-command-method 'request-rename-group) |
17493 | 478 (gnus-group-real-name group) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
479 (gnus-group-real-name new-name) (nth 1 gnus-command-method)))) |
17493 | 480 |
481 (defun gnus-close-backends () | |
482 ;; Send a close request to all backends that support such a request. | |
483 (let ((methods gnus-valid-select-methods) | |
484 (gnus-inhibit-demon t) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
485 func gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
486 (while (setq gnus-command-method (pop methods)) |
17493 | 487 (when (fboundp (setq func (intern |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
488 (concat (car gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
489 "-request-close")))) |
17493 | 490 (funcall func))))) |
491 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
492 (defun gnus-asynchronous-p (gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
493 (let ((func (gnus-get-function gnus-command-method 'asynchronous-p t))) |
17493 | 494 (when (fboundp func) |
495 (funcall func)))) | |
496 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
497 (defun gnus-remove-denial (gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
498 (when (stringp gnus-command-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
499 (setq gnus-command-method (gnus-server-to-method gnus-command-method))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
500 (let* ((elem (assoc gnus-command-method gnus-opened-servers)) |
17493 | 501 (status (cadr elem))) |
502 ;; If this hasn't been opened before, we add it to the list. | |
503 (when (eq status 'denied) | |
504 ;; Set the status of this server. | |
505 (setcar (cdr elem) 'closed)))) | |
506 | |
507 (provide 'gnus-int) | |
508 | |
509 ;;; gnus-int.el ends here |