annotate lisp/gnus/gnus-int.el @ 98:0d2f883870bc r20-1b1

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