1 ;;; gnus-int.el --- backend interface functions for Gnus
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
4 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 3, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
30 (eval-when-compile (require 'cl
))
36 (autoload 'gnus-agent-expire
"gnus-agent")
37 (autoload 'gnus-agent-regenerate-group
"gnus-agent")
38 (autoload 'gnus-agent-read-servers-validate-native
"gnus-agent")
39 (autoload 'gnus-agent-possibly-synchronize-flags-server
"gnus-agent")
41 (defcustom gnus-open-server-hook nil
42 "Hook called just before opening connection to the news server."
46 (defcustom gnus-server-unopen-status nil
47 "The default status if the server is not able to open.
48 If the server is covered by Gnus agent, the possible values are
49 `denied', set the server denied; `offline', set the server offline;
50 nil, ask user. If the server is not covered by Gnus agent, set the
54 :type
'(choice (const :tag
"Ask" nil
)
55 (const :tag
"Deny server" denied
)
56 (const :tag
"Unplug Agent" offline
)))
58 (defvar gnus-internal-registry-spool-current-method nil
59 "The current method, for the registry.")
62 ;;; Server Communication
65 (defun gnus-start-news-server (&optional confirm
)
66 "Open a method for getting news.
67 If CONFIRM is non-nil, the user will be asked for an NNTP server."
69 (if gnus-current-select-method
70 ;; Stream is already opened.
73 (unless gnus-nntp-service
74 (setq gnus-nntp-server nil
))
76 ;; Read server name with completion.
77 (setq gnus-nntp-server
78 (completing-read "NNTP server: "
80 (cons (list gnus-nntp-server
)
81 gnus-secondary-servers
))
82 nil nil gnus-nntp-server
)))
84 (when (and gnus-nntp-server
85 (stringp gnus-nntp-server
)
86 (not (string= gnus-nntp-server
"")))
87 (setq gnus-select-method
88 (cond ((or (string= gnus-nntp-server
"")
89 (string= gnus-nntp-server
"::"))
90 (list 'nnspool
(system-name)))
91 ((string-match "^:" gnus-nntp-server
)
92 (list 'nnmh gnus-nntp-server
94 (file-name-as-directory
96 (substring gnus-nntp-server
1) "~/")))
97 (list 'nnmh-get-new-mail nil
)))
99 (list 'nntp gnus-nntp-server
)))))
101 (setq how
(car gnus-select-method
))
105 (gnus-message 5 "Looking up local news spool..."))
108 (gnus-message 5 "Looking up mh spool..."))
111 (setq gnus-current-select-method gnus-select-method
)
112 (gnus-run-hooks 'gnus-open-server-hook
)
114 ;; Partially validate agent covered methods now that the
115 ;; gnus-select-method is known.
118 ;; NOTE: This is here for one purpose only. By validating
119 ;; the current select method, it converts the old 5.10.3,
120 ;; and earlier, format to the current format. That enables
121 ;; the agent code within gnus-open-server to function
123 (gnus-agent-read-servers-validate-native gnus-select-method
))
126 ;; gnus-open-server-hook might have opened it
127 (gnus-server-opened gnus-select-method
)
128 (gnus-open-server gnus-select-method
)
132 "%s (%s) open error: '%s'. Continue? "
133 (car gnus-select-method
) (cadr gnus-select-method
)
134 (gnus-status-message gnus-select-method
)))
135 (gnus-error 1 "Couldn't open server on %s"
136 (nth 1 gnus-select-method
))))))
138 (defun gnus-check-group (group)
139 "Try to make sure that the server where GROUP exists is alive."
140 (let ((method (gnus-find-method-for-group group
)))
141 (or (gnus-server-opened method
)
142 (gnus-open-server method
))))
144 (defun gnus-check-server (&optional method silent
)
145 "Check whether the connection to METHOD is down.
146 If METHOD is nil, use `gnus-select-method'.
147 If it is down, start it up (again)."
148 (let ((method (or method gnus-select-method
))
150 ;; Transform virtual server names into select methods.
151 (when (stringp method
)
152 (setq method
(gnus-server-to-method method
)))
153 (if (gnus-server-opened method
)
154 ;; The stream is already opened.
158 (gnus-message 5 "Opening %s server%s..." (car method
)
159 (if (equal (nth 1 method
) "") ""
160 (format " on %s" (nth 1 method
)))))
161 (gnus-run-hooks 'gnus-open-server-hook
)
164 (setq result
(gnus-open-server method
))
165 (quit (message "Quit gnus-check-server")
168 (gnus-message 5 "Opening %s server%s...%s" (car method
)
169 (if (equal (nth 1 method
) "") ""
170 (format " on %s" (nth 1 method
)))
171 (if result
"done" "failed")))))))
173 (defun gnus-get-function (method function
&optional noerror
)
174 "Return a function symbol based on METHOD and FUNCTION."
175 ;; Translate server names into methods.
177 (error "Attempted use of a nil select method"))
178 (when (stringp method
)
179 (setq method
(gnus-server-to-method method
)))
180 ;; Check cache of constructed names.
181 (let* ((method-sym (if gnus-agent
182 (inline (gnus-agent-get-function method
))
184 (method-fns (get method-sym
'gnus-method-functions
))
185 (func (let ((method-fnlist-elt (assq function method-fns
)))
186 (unless method-fnlist-elt
187 (setq method-fnlist-elt
189 (intern (format "%s-%s" method-sym function
))))
190 (put method-sym
'gnus-method-functions
191 (cons method-fnlist-elt method-fns
)))
192 (cdr method-fnlist-elt
))))
193 ;; Maybe complain if there is no function.
194 (unless (fboundp func
)
196 (error "Trying to require a method that doesn't exist"))
197 (require (car method
))
198 (when (not (fboundp func
))
201 (error "No such function: %s" func
))))
206 ;;; Interface functions to the backends.
209 (defun gnus-open-server (gnus-command-method)
210 "Open a connection to GNUS-COMMAND-METHOD."
211 (when (stringp gnus-command-method
)
212 (setq gnus-command-method
(gnus-server-to-method gnus-command-method
)))
213 (let ((elem (assoc gnus-command-method gnus-opened-servers
))
214 (server (gnus-method-to-server-name gnus-command-method
)))
215 ;; If this method was previously denied, we just return nil.
216 (if (eq (nth 1 elem
) 'denied
)
218 (gnus-message 1 "Denied server %s" server
)
221 (let* ((open-server-function (gnus-get-function gnus-command-method
'open-server
))
224 (funcall open-server-function
225 (nth 1 gnus-command-method
)
226 (nthcdr 2 gnus-command-method
))
228 (gnus-message 1 (format
229 "Unable to open server %s due to: %s"
230 server
(error-message-string err
)))
233 (gnus-message 1 "Quit trying to open server %s" server
)
236 ;; If this hasn't been opened before, we add it to the list.
238 (setq elem
(list gnus-command-method nil
)
239 gnus-opened-servers
(cons elem gnus-opened-servers
)))
240 ;; Set the status of this server.
243 (if (eq open-server-function
#'nnagent-open-server
)
244 ;; The agent's backend has a "special" status
248 (gnus-agent-method-p gnus-command-method
))
249 (cond (gnus-server-unopen-status
250 ;; Set the server's status to the unopen
251 ;; status. If that status is offline,
252 ;; recurse to open the agent's backend.
253 (setq open-offline
(eq gnus-server-unopen-status
'offline
))
254 gnus-server-unopen-status
)
256 (not gnus-batch-mode
)
259 "Unable to open server %s, go offline? "
261 (setq open-offline t
)
264 ;; This agentized server was still denied
267 ;; This unagentized server must be denied
270 ;; NOTE: I MUST set the server's status to offline before this
271 ;; recursive call as this status will drive the
272 ;; gnus-get-function (called above) to return the agent's
275 ;; Recursively open this offline server to perform the
276 ;; open-server function of the agent's backend.
277 (let ((gnus-server-unopen-status 'denied
))
278 ;; Bind gnus-server-unopen-status to avoid recursively
279 ;; prompting with "go offline?". This is only a concern
280 ;; when the agent's backend fails to open the server.
281 (gnus-open-server gnus-command-method
))
282 (when (and (eq (cadr elem
) 'ok
) gnus-agent
283 (gnus-agent-method-p gnus-command-method
))
285 (gnus-agent-possibly-synchronize-flags-server
286 gnus-command-method
)))
289 (defun gnus-close-server (gnus-command-method)
290 "Close the connection to GNUS-COMMAND-METHOD."
291 (when (stringp gnus-command-method
)
292 (setq gnus-command-method
(gnus-server-to-method gnus-command-method
)))
293 (funcall (gnus-get-function gnus-command-method
'close-server
)
294 (nth 1 gnus-command-method
)))
296 (defun gnus-request-list (gnus-command-method)
297 "Request the active file from GNUS-COMMAND-METHOD."
298 (when (stringp gnus-command-method
)
299 (setq gnus-command-method
(gnus-server-to-method gnus-command-method
)))
300 (funcall (gnus-get-function gnus-command-method
'request-list
)
301 (nth 1 gnus-command-method
)))
303 (defun gnus-request-list-newsgroups (gnus-command-method)
304 "Request the newsgroups file from GNUS-COMMAND-METHOD."
305 (when (stringp gnus-command-method
)
306 (setq gnus-command-method
(gnus-server-to-method gnus-command-method
)))
307 (funcall (gnus-get-function gnus-command-method
'request-list-newsgroups
)
308 (nth 1 gnus-command-method
)))
310 (defun gnus-request-newgroups (date gnus-command-method
)
311 "Request all new groups since DATE from GNUS-COMMAND-METHOD."
312 (when (stringp gnus-command-method
)
313 (setq gnus-command-method
(gnus-server-to-method gnus-command-method
)))
314 (let ((func (gnus-get-function gnus-command-method
'request-newgroups t
)))
316 (funcall func date
(nth 1 gnus-command-method
)))))
318 (defun gnus-server-opened (gnus-command-method)
319 "Check whether a connection to GNUS-COMMAND-METHOD has been opened."
320 (unless (eq (gnus-server-status gnus-command-method
)
322 (when (stringp gnus-command-method
)
323 (setq gnus-command-method
(gnus-server-to-method gnus-command-method
)))
324 (funcall (inline (gnus-get-function gnus-command-method
'server-opened
))
325 (nth 1 gnus-command-method
))))
327 (defun gnus-status-message (gnus-command-method)
328 "Return the status message from GNUS-COMMAND-METHOD.
329 If GNUS-COMMAND-METHOD is a string, it is interpreted as a group
330 name. The method this group uses will be queried."
331 (let ((gnus-command-method
332 (if (stringp gnus-command-method
)
333 (gnus-find-method-for-group gnus-command-method
)
334 gnus-command-method
)))
335 (funcall (gnus-get-function gnus-command-method
'status-message
)
336 (nth 1 gnus-command-method
))))
338 (defun gnus-request-regenerate (gnus-command-method)
339 "Request a data generation from GNUS-COMMAND-METHOD."
340 (when (stringp gnus-command-method
)
341 (setq gnus-command-method
(gnus-server-to-method gnus-command-method
)))
342 (funcall (gnus-get-function gnus-command-method
'request-regenerate
)
343 (nth 1 gnus-command-method
)))
345 (defun gnus-request-compact-group (group)
346 (let* ((method (gnus-find-method-for-group group
))
347 (gnus-command-method method
)
349 (funcall (gnus-get-function gnus-command-method
350 'request-compact-group
)
351 (gnus-group-real-name group
)
352 (nth 1 gnus-command-method
) t
)))
355 (defun gnus-request-compact (gnus-command-method)
356 "Request groups compaction from GNUS-COMMAND-METHOD."
357 (when (stringp gnus-command-method
)
358 (setq gnus-command-method
(gnus-server-to-method gnus-command-method
)))
359 (funcall (gnus-get-function gnus-command-method
'request-compact
)
360 (nth 1 gnus-command-method
)))
362 (defun gnus-request-group (group &optional dont-check gnus-command-method
)
363 "Request GROUP. If DONT-CHECK, no information is required."
364 (let ((gnus-command-method
365 (or gnus-command-method
(inline (gnus-find-method-for-group group
)))))
366 (when (stringp gnus-command-method
)
367 (setq gnus-command-method
368 (inline (gnus-server-to-method gnus-command-method
))))
369 (funcall (inline (gnus-get-function gnus-command-method
'request-group
))
370 (gnus-group-real-name group
) (nth 1 gnus-command-method
)
373 (defun gnus-list-active-group (group)
374 "Request active information on GROUP."
375 (let ((gnus-command-method (gnus-find-method-for-group group
))
376 (func 'list-active-group
))
377 (when (gnus-check-backend-function func group
)
378 (funcall (gnus-get-function gnus-command-method func
)
379 (gnus-group-real-name group
) (nth 1 gnus-command-method
)))))
381 (defun gnus-request-group-description (group)
382 "Request a description of GROUP."
383 (let ((gnus-command-method (gnus-find-method-for-group group
))
384 (func 'request-group-description
))
385 (when (gnus-check-backend-function func group
)
386 (funcall (gnus-get-function gnus-command-method func
)
387 (gnus-group-real-name group
) (nth 1 gnus-command-method
)))))
389 (defun gnus-request-group-articles (group)
390 "Request a list of existing articles in GROUP."
391 (let ((gnus-command-method (gnus-find-method-for-group group
))
392 (func 'request-group-articles
))
393 (when (gnus-check-backend-function func group
)
394 (funcall (gnus-get-function gnus-command-method func
)
395 (gnus-group-real-name group
) (nth 1 gnus-command-method
)))))
397 (defun gnus-close-group (group)
398 "Request the GROUP be closed."
399 (let ((gnus-command-method (inline (gnus-find-method-for-group group
))))
400 (funcall (gnus-get-function gnus-command-method
'close-group
)
401 (gnus-group-real-name group
) (nth 1 gnus-command-method
))))
403 (defun gnus-retrieve-headers (articles group
&optional fetch-old
)
404 "Request headers for ARTICLES in GROUP.
405 If FETCH-OLD, retrieve all headers (or some subset thereof) in the group."
406 (let ((gnus-command-method (gnus-find-method-for-group group
)))
408 ((and gnus-use-cache
(numberp (car articles
)))
409 (gnus-cache-retrieve-headers articles group fetch-old
))
410 ((and gnus-agent
(gnus-online gnus-command-method
)
411 (gnus-agent-method-p gnus-command-method
))
412 (gnus-agent-retrieve-headers articles group fetch-old
))
414 (funcall (gnus-get-function gnus-command-method
'retrieve-headers
)
415 articles
(gnus-group-real-name group
)
416 (nth 1 gnus-command-method
) fetch-old
)))))
418 (defun gnus-retrieve-articles (articles group
)
419 "Request ARTICLES in GROUP."
420 (let ((gnus-command-method (gnus-find-method-for-group group
)))
421 (funcall (gnus-get-function gnus-command-method
'retrieve-articles
)
422 articles
(gnus-group-real-name group
)
423 (nth 1 gnus-command-method
))))
425 (defun gnus-retrieve-groups (groups gnus-command-method
)
426 "Request active information on GROUPS from GNUS-COMMAND-METHOD."
427 (when (stringp gnus-command-method
)
428 (setq gnus-command-method
(gnus-server-to-method gnus-command-method
)))
429 (funcall (gnus-get-function gnus-command-method
'retrieve-groups
)
430 groups
(nth 1 gnus-command-method
)))
432 (defun gnus-request-type (group &optional article
)
433 "Return the type (`post' or `mail') of GROUP (and ARTICLE)."
434 (let ((gnus-command-method (gnus-find-method-for-group group
)))
435 (if (not (gnus-check-backend-function
436 'request-type
(car gnus-command-method
)))
438 (funcall (gnus-get-function gnus-command-method
'request-type
)
439 (gnus-group-real-name group
) article
))))
441 (defun gnus-request-set-mark (group action
)
442 "Set marks on articles in the back end."
443 (let ((gnus-command-method (gnus-find-method-for-group group
)))
444 (if (not (gnus-check-backend-function
445 'request-set-mark
(car gnus-command-method
)))
447 (funcall (gnus-get-function gnus-command-method
'request-set-mark
)
448 (gnus-group-real-name group
) action
449 (nth 1 gnus-command-method
)))))
451 (defun gnus-request-update-mark (group article mark
)
452 "Allow the back end to change the mark the user tries to put on an article."
453 (let ((gnus-command-method (gnus-find-method-for-group group
)))
454 (if (not (gnus-check-backend-function
455 'request-update-mark
(car gnus-command-method
)))
457 (funcall (gnus-get-function gnus-command-method
'request-update-mark
)
458 (gnus-group-real-name group
) article mark
))))
460 (defun gnus-request-article (article group
&optional buffer
)
461 "Request the ARTICLE in GROUP.
462 ARTICLE can either be an article number or an article Message-ID.
463 If BUFFER, insert the article in that group."
464 (let ((gnus-command-method (gnus-find-method-for-group group
)))
465 (funcall (gnus-get-function gnus-command-method
'request-article
)
466 article
(gnus-group-real-name group
)
467 (nth 1 gnus-command-method
) buffer
)))
469 (defun gnus-request-head (article group
)
470 "Request the head of ARTICLE in GROUP."
471 (let* ((gnus-command-method (gnus-find-method-for-group group
))
472 (head (gnus-get-function gnus-command-method
'request-head t
))
478 (gnus-cache-request-article article group
))
479 (setq res
(cons group article
)
481 ;; Check the agent cache.
482 ((gnus-agent-request-article article group
)
483 (setq res
(cons group article
)
485 ;; Use `head' function.
487 (setq res
(funcall head article
(gnus-group-real-name group
)
488 (nth 1 gnus-command-method
))))
489 ;; Use `article' function.
491 (setq res
(gnus-request-article article group
)
495 (set-buffer nntp-server-buffer
)
496 (goto-char (point-min))
497 (when (search-forward "\n\n" nil t
)
498 (delete-region (1- (point)) (point-max)))
499 (nnheader-fold-continuation-lines)))
502 (defun gnus-request-body (article group
)
503 "Request the body of ARTICLE in GROUP."
504 (let* ((gnus-command-method (gnus-find-method-for-group group
))
505 (head (gnus-get-function gnus-command-method
'request-body t
))
511 (gnus-cache-request-article article group
))
512 (setq res
(cons group article
)
514 ;; Check the agent cache.
515 ((gnus-agent-request-article article group
)
516 (setq res
(cons group article
)
518 ;; Use `head' function.
520 (setq res
(funcall head article
(gnus-group-real-name group
)
521 (nth 1 gnus-command-method
))))
522 ;; Use `article' function.
524 (setq res
(gnus-request-article article group
)
528 (set-buffer nntp-server-buffer
)
529 (goto-char (point-min))
530 (when (search-forward "\n\n" nil t
)
531 (delete-region (point-min) (1- (point))))))
534 (defun gnus-request-post (gnus-command-method)
535 "Post the current buffer using GNUS-COMMAND-METHOD."
536 (when (stringp gnus-command-method
)
537 (setq gnus-command-method
(gnus-server-to-method gnus-command-method
)))
538 (funcall (gnus-get-function gnus-command-method
'request-post
)
539 (nth 1 gnus-command-method
)))
541 (defun gnus-request-scan (group gnus-command-method
)
542 "Request a SCAN being performed in GROUP from GNUS-COMMAND-METHOD.
543 If GROUP is nil, all groups on GNUS-COMMAND-METHOD are scanned."
544 (let ((gnus-command-method
545 (if group
(gnus-find-method-for-group group
) gnus-command-method
))
546 (gnus-inhibit-demon t
)
547 (mail-source-plugged gnus-plugged
))
548 (when (or gnus-plugged
(not (gnus-agent-method-p gnus-command-method
)))
549 (setq gnus-internal-registry-spool-current-method gnus-command-method
)
550 (funcall (gnus-get-function gnus-command-method
'request-scan
)
551 (and group
(gnus-group-real-name group
))
552 (nth 1 gnus-command-method
)))))
554 (defsubst gnus-request-update-info
(info gnus-command-method
)
555 "Request that GNUS-COMMAND-METHOD update INFO."
556 (when (stringp gnus-command-method
)
557 (setq gnus-command-method
(gnus-server-to-method gnus-command-method
)))
558 (when (gnus-check-backend-function
559 'request-update-info
(car gnus-command-method
))
560 (let ((group (gnus-info-group info
)))
561 (and (funcall (gnus-get-function gnus-command-method
562 'request-update-info
)
563 (gnus-group-real-name group
)
564 info
(nth 1 gnus-command-method
))
565 ;; If the minimum article number is greater than 1, then all
566 ;; smaller article numbers are known not to exist; we'll
567 ;; artificially add those to the 'read range.
568 (let* ((active (gnus-active group
))
571 (let* ((range (if (= min
2) 1 (cons 1 (1- min
))))
572 (read (gnus-info-read info
))
573 (new-read (gnus-range-add read
(list range
))))
574 (gnus-info-set-read info new-read
)))
577 (defun gnus-request-expire-articles (articles group
&optional force
)
578 (let* ((gnus-command-method (gnus-find-method-for-group group
))
581 (gnus-get-function gnus-command-method
'request-expire-articles
)
582 articles
(gnus-group-real-name group
) (nth 1 gnus-command-method
)
584 (when (and gnus-agent
585 (gnus-agent-method-p gnus-command-method
))
586 (let ((expired-articles (gnus-sorted-difference articles not-deleted
)))
587 (when expired-articles
588 (gnus-agent-expire expired-articles group
'force
))))
591 (defun gnus-request-move-article (article group server accept-function
592 &optional last move-is-internal
)
593 (let* ((gnus-command-method (gnus-find-method-for-group group
))
594 (result (funcall (gnus-get-function gnus-command-method
595 'request-move-article
)
596 article
(gnus-group-real-name group
)
597 (nth 1 gnus-command-method
) accept-function last move-is-internal
)))
598 (when (and result gnus-agent
599 (gnus-agent-method-p gnus-command-method
))
600 (gnus-agent-unfetch-articles group
(list article
)))
603 (defun gnus-request-accept-article (group &optional gnus-command-method last
605 ;; Make sure there's a newline at the end of the article.
606 (when (stringp gnus-command-method
)
607 (setq gnus-command-method
(gnus-server-to-method gnus-command-method
)))
608 (when (and (not gnus-command-method
)
610 (setq gnus-command-method
(or (gnus-find-method-for-group group
)
611 (gnus-group-name-to-method group
))))
612 (goto-char (point-max))
616 (let ((message-options message-options
))
617 (message-options-set-recipient)
619 (message-narrow-to-head)
620 (let ((mail-parse-charset message-default-charset
))
621 (mail-encode-encoded-word-buffer)))
622 (message-encode-message-body)))
623 (let ((gnus-command-method (or gnus-command-method
624 (gnus-find-method-for-group group
)))
627 (gnus-get-function gnus-command-method
'request-accept-article
)
628 (if (stringp group
) (gnus-group-real-name group
) group
)
629 (cadr gnus-command-method
)
631 (when (and gnus-agent
(gnus-agent-method-p gnus-command-method
))
632 (gnus-agent-regenerate-group group
(list (cdr result
))))
635 (defun gnus-request-replace-article (article group buffer
&optional no-encode
)
637 (let ((message-options message-options
))
638 (message-options-set-recipient)
640 (message-narrow-to-head)
641 (let ((mail-parse-charset message-default-charset
))
642 (mail-encode-encoded-word-buffer)))
643 (message-encode-message-body)))
644 (let* ((func (car (gnus-group-name-to-method group
)))
645 (result (funcall (intern (format "%s-request-replace-article" func
))
646 article
(gnus-group-real-name group
) buffer
)))
647 (when (and gnus-agent
(gnus-agent-method-p gnus-command-method
))
648 (gnus-agent-regenerate-group group
(list article
)))
651 (defun gnus-request-associate-buffer (group)
652 (let ((gnus-command-method (gnus-find-method-for-group group
)))
653 (funcall (gnus-get-function gnus-command-method
'request-associate-buffer
)
654 (gnus-group-real-name group
))))
656 (defun gnus-request-restore-buffer (article group
)
657 "Request a new buffer restored to the state of ARTICLE."
658 (let ((gnus-command-method (gnus-find-method-for-group group
)))
659 (funcall (gnus-get-function gnus-command-method
'request-restore-buffer
)
660 article
(gnus-group-real-name group
)
661 (nth 1 gnus-command-method
))))
663 (defun gnus-request-create-group (group &optional gnus-command-method args
)
664 (when (stringp gnus-command-method
)
665 (setq gnus-command-method
(gnus-server-to-method gnus-command-method
)))
666 (let ((gnus-command-method
667 (or gnus-command-method
(gnus-find-method-for-group group
))))
668 (funcall (gnus-get-function gnus-command-method
'request-create-group
)
669 (gnus-group-real-name group
) (nth 1 gnus-command-method
) args
)))
671 (defun gnus-request-delete-group (group &optional force
)
672 (let* ((gnus-command-method (gnus-find-method-for-group group
))
674 (funcall (gnus-get-function gnus-command-method
'request-delete-group
)
675 (gnus-group-real-name group
) force
(nth 1 gnus-command-method
))))
677 (gnus-cache-delete-group group
)
678 (gnus-agent-delete-group group
))
681 (defun gnus-request-rename-group (group new-name
)
682 (let* ((gnus-command-method (gnus-find-method-for-group group
))
684 (funcall (gnus-get-function gnus-command-method
'request-rename-group
)
685 (gnus-group-real-name group
)
686 (gnus-group-real-name new-name
) (nth 1 gnus-command-method
))))
688 (gnus-cache-rename-group group new-name
)
689 (gnus-agent-rename-group group new-name
))
692 (defun gnus-close-backends ()
693 ;; Send a close request to all backends that support such a request.
694 (let ((methods gnus-valid-select-methods
)
695 (gnus-inhibit-demon t
)
696 func gnus-command-method
)
697 (while (setq gnus-command-method
(pop methods
))
698 (when (fboundp (setq func
(intern
699 (concat (car gnus-command-method
)
703 (defun gnus-asynchronous-p (gnus-command-method)
704 (let ((func (gnus-get-function gnus-command-method
'asynchronous-p t
)))
708 (defun gnus-remove-denial (gnus-command-method)
709 (when (stringp gnus-command-method
)
710 (setq gnus-command-method
(gnus-server-to-method gnus-command-method
)))
711 (let* ((elem (assoc gnus-command-method gnus-opened-servers
))
712 (status (cadr elem
)))
713 ;; If this hasn't been opened before, we add it to the list.
714 (when (eq status
'denied
)
715 ;; Set the status of this server.
716 (setcar (cdr elem
) 'closed
))))
720 ;;; arch-tag: bbc90087-9b7f-4017-a92c-3abf180ac86d
721 ;;; gnus-int.el ends here