annotate lisp/gnus/nntp.el @ 7:c153ca296910

Added tag r19-15b4 for changeset 27bc7f280385
author cvs
date Mon, 13 Aug 2007 08:47:16 +0200
parents ac2d302a0011
children 0293115a14e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; nntp.el --- nntp access for Gnus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; Copyright (C) 1987,88,89,90,92,93,94,95,96 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Keywords: news
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (require 'nnheader)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (require 'nnoo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (eval-when-compile (require 'cl))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (nnoo-declare nntp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (eval-and-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (unless (fboundp 'open-network-stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (require 'tcp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (eval-when-compile (require 'cl))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (eval-and-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (autoload 'cancel-timer "timer")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (autoload 'telnet "telnet" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (autoload 'telnet-send-input "telnet" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (autoload 'timezone-parse-date "timezone"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (defvoo nntp-server-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 "*Hooks for the NNTP server.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 If the kanji code of the NNTP server is different from the local kanji
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 code, the correct kanji code of the buffer associated with the NNTP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 server must be specified as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 \(setq nntp-server-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;; Server's Kanji code is EUC (NEmacs hack).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (make-local-variable 'kanji-fileio-code)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (setq kanji-fileio-code 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 If you'd like to change something depending on the server in this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 hook, use the variable `nntp-address'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (defvoo nntp-server-opened-hook '(nntp-send-mode-reader)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 "*Hook used for sending commands to the server at startup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 The default value is `nntp-send-mode-reader', which makes an innd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 server spawn an nnrpd server. Another useful function to put in this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 hook might be `nntp-send-authinfo', which will prompt for a password
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 to allow posting from the server. Note that this is only necessary to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 do on servers that use strict access control.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (add-hook 'nntp-server-opened-hook 'nntp-send-mode-reader)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (defvoo nntp-server-action-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 '(("nntpd 1\\.5\\.11t"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (remove-hook 'nntp-server-opened-hook 'nntp-send-mode-reader)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 "Alist of regexps to match on server types and actions to be taken.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 For instance, if you want Gnus to beep every time you connect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 to innd, you could say something like:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 \(setq nntp-server-action-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 '((\"innd\" (ding))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 You probably don't want to do that, though.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (defvoo nntp-open-server-function 'nntp-open-network-stream
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 "*Function used for connecting to a remote system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 It will be called with the address of the remote system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 Two pre-made functions are `nntp-open-network-stream', which is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 default, and simply connects to some port or other on the remote
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 system (see nntp-port-number). The other is `nntp-open-rlogin', which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 does an rlogin on the remote system, and then does a telnet to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 NNTP server available there (see nntp-rlogin-parameters).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (defvoo nntp-rlogin-parameters '("telnet" "${NNTPSERVER:=localhost}" "nntp")
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
95 "*Parameters to `nntp-open-rlogin'.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 That function may be used as `nntp-open-server-function'. In that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 case, this list will be used as the parameter list given to rsh.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (defvoo nntp-rlogin-user-name nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 "*User name on remote system when using the rlogin connect method.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
102 (defvoo nntp-telnet-parameters '("exec" "telnet" "-8" "${NNTPSERVER:=localhost}" "nntp")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
103 "*Parameters to `nntp-open-telnet'.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
104 That function may be used as `nntp-open-server-function'. In that
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
105 case, this list will be executed as a command after logging in
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
106 via telnet.")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
107
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
108 (defvoo nntp-telnet-user-name nil
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
109 "User name to log in via telnet with.")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
110
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
111 (defvoo nntp-telnet-passwd nil
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
112 "Password to use to log in via telnet with.")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
113
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (defvoo nntp-address nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 "*The name of the NNTP server.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (defvoo nntp-port-number "nntp"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 "*Port number to connect to.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (defvoo nntp-end-of-line "\r\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 "String to use on the end of lines when talking to the NNTP server.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 This is \"\\r\\n\" by default, but should be \"\\n\" when
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
123 using rlogin or telnet to communicate with the server.")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (defvoo nntp-large-newsgroup 50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 "*The number of the articles which indicates a large newsgroup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 If the number of the articles is greater than the value, verbose
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 messages will be shown to indicate the current status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (defvoo nntp-buggy-select (memq system-type '(fujitsu-uts))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 "*t if your select routine is buggy.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 If the select routine signals error or fall into infinite loop while
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 waiting for the server response, the variable must be set to t. In
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 case of Fujitsu UTS, it is set to T since `accept-process-output'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 doesn't work properly.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (defvoo nntp-maximum-request 400
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 "*The maximum number of the requests sent to the NNTP server at one time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 If Emacs hangs up while retrieving headers, set the variable to a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 lower value.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (defvoo nntp-debug-read 10000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 "*Display '...' every 10Kbytes of a message being received if it is non-nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 If it is a number, dots are displayed per the number.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (defvoo nntp-nov-is-evil nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 "*If non-nil, nntp will never attempt to use XOVER when talking to the server.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (defvoo nntp-xover-commands '("XOVER" "XOVERVIEW")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 "*List of strings that are used as commands to fetch NOV lines from a server.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 The strings are tried in turn until a positive response is gotten. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 none of the commands are successful, nntp will just grab headers one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 by one.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (defvoo nntp-nov-gap 20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 "*Maximum allowed gap between two articles.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 If the gap between two consecutive articles is bigger than this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 variable, split the XOVER request into two requests.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (defvoo nntp-connection-timeout nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 "*Number of seconds to wait before an nntp connection times out.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 If this variable is nil, which is the default, no timers are set.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (defvoo nntp-command-timeout nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 "*Number of seconds to wait for a response when sending a command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 If this variable is nil, which is the default, no timers are set.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (defvoo nntp-retry-on-break nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 "*If non-nil, re-send the command when the user types `C-g'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (defvoo nntp-news-default-headers nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 "*If non-nil, override `mail-default-headers' when posting news.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (defvoo nntp-prepare-server-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 "*Hook run before a server is opened.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 If can be used to set up a server remotely, for instance. Say you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 have an account at the machine \"other.machine\". This machine has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 access to an NNTP server that you can't access locally. You could
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 then use this hook to rsh to the remote machine and start a proxy NNTP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 server there that you can connect to.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (defvoo nntp-async-number 5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 "*How many articles should be prefetched when in asynchronous mode.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (defvoo nntp-warn-about-losing-connection t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 "*If non-nil, beep when a server closes connection.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (defconst nntp-version "nntp 4.0"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 "Version numbers of this version of NNTP.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (defvar nntp-server-buffer nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 "Buffer associated with the NNTP server process.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (defvoo nntp-server-process nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 "The NNTP server process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 You'd better not use this variable in NNTP front-end program, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 instead use `nntp-server-buffer'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (defvoo nntp-status-string nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 "Save the server response message.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (defvar nntp-opened-connections nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 "All (possibly) opened connections.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (defvoo nntp-server-xover 'try)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (defvoo nntp-server-list-active-group 'try)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (defvoo nntp-current-group "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (defvoo nntp-server-type nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (defvoo nntp-async-process nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (defvoo nntp-async-buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (defvoo nntp-async-articles nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (defvoo nntp-async-fetched nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (defvoo nntp-async-group-alist nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 ;;; Interface functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (nnoo-define-basics nntp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (deffoo nntp-retrieve-headers (articles &optional group server fetch-old)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 "Retrieve the headers of ARTICLES."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (nntp-possibly-change-server group server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (if (and (not gnus-nov-is-evil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (not nntp-nov-is-evil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (nntp-retrieve-headers-with-xover articles fetch-old))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 ;; We successfully retrieved the headers via XOVER.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 'nov
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 ;; XOVER didn't work, so we do it the hard, slow and inefficient
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 ;; way.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (let ((number (length articles))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (received 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (message-log-max nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (last-point (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 ;; Send HEAD command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (while articles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (nntp-send-strings-to-server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 "HEAD" (if (numberp (car articles))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (int-to-string (car articles))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 ;; `articles' is either a list of article numbers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 ;; or a list of article IDs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (car articles)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (setq articles (cdr articles)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 count (1+ count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 ;; Every 400 header requests we have to read the stream in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 ;; order to avoid deadlocks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (when (or (null articles) ;All requests have been sent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (zerop (% count nntp-maximum-request)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (nntp-accept-response)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (while (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (goto-char last-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 ;; Count replies.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (while (re-search-forward "^[0-9]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (setq received (1+ received)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (setq last-point (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (< received count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 ;; If number of headers is greater than 100, give
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 ;; informative messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (and (numberp nntp-large-newsgroup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (> number nntp-large-newsgroup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (zerop (% received 20))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (nnheader-message 7 "NNTP: Receiving headers... %d%%"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (/ (* received 100) number)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (nntp-accept-response))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 ;; Wait for text of last command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (re-search-backward "^[0-9]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (when (looking-at "^[23]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (while (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (goto-char (- (point-max) 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (not (looking-at "^\\.\r?\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (nntp-accept-response)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (and (numberp nntp-large-newsgroup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (> number nntp-large-newsgroup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (nnheader-message 7 "NNTP: Receiving headers...done"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 ;; Now all of replies are received. Fold continuation lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (nnheader-fold-continuation-lines)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 ;; Remove all "\r"'s.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (while (search-forward "\r" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (replace-match "" t t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 'headers))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (deffoo nntp-retrieve-groups (groups &optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 "Retrieve group info on GROUPS."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (nntp-possibly-change-server nil server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 ;; The first time this is run, this variable is `try'. So we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 ;; try.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (when (eq nntp-server-list-active-group 'try)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (nntp-try-list-active (car groups)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (let ((count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (received 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (last-point (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (command (if nntp-server-list-active-group "LIST ACTIVE" "GROUP")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (while groups
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 ;; Send the command to the server.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (nntp-send-strings-to-server command (car groups))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (setq groups (cdr groups))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (setq count (1+ count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 ;; Every 400 requests we have to read the stream in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 ;; order to avoid deadlocks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (when (or (null groups) ;All requests have been sent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (zerop (% count nntp-maximum-request)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (nntp-accept-response)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (while (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (goto-char last-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 ;; Count replies.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (while (re-search-forward "^[0-9]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (setq received (1+ received)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (setq last-point (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (< received count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (nntp-accept-response))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 ;; Wait for the reply from the final command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (when nntp-server-list-active-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (re-search-backward "^[0-9]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (when (looking-at "^[23]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (while (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (goto-char (- (point-max) 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (not (looking-at "^\\.\r?\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (nntp-accept-response))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 ;; Now all replies are received. We remove CRs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (while (search-forward "\r" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (replace-match "" t t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (if (not nntp-server-list-active-group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 'group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 ;; We have read active entries, so we just delete the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 ;; superfluos gunk.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (while (re-search-forward "^[.2-5]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (delete-region (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (progn (forward-line 1) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 'active))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (deffoo nntp-open-server (server &optional defs connectionless)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 "Open the virtual server SERVER.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 If CONNECTIONLESS is non-nil, don't attempt to connect to any physical
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 servers."
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
354 (nnheader-init-server-buffer)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 ;; Called with just a port number as the defs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (when (or (stringp (car defs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (numberp (car defs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (setq defs `((nntp-port-number ,(car defs)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (unless (assq 'nntp-address defs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (setq defs (append defs `((nntp-address ,server)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (nnoo-change-server 'nntp server defs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (if (nntp-server-opened server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (or (nntp-server-opened server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 connectionless
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (prog2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (run-hooks 'nntp-prepare-server-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (nntp-open-server-semi-internal nntp-address nntp-port-number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (nnheader-insert "")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (deffoo nntp-close-server (&optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 "Close connection to SERVER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (nntp-possibly-change-server nil server t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 ;; Un-set default sentinel function before closing connection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (and nntp-server-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (eq 'nntp-default-sentinel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (process-sentinel nntp-server-process))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (set-process-sentinel nntp-server-process nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 ;; We cannot send QUIT command unless the process is running.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (when (nntp-server-opened server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (nntp-send-command nil "QUIT")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 ;; Give the QUIT time to arrive.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (sleep-for 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (nntp-close-server-internal server)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (deffoo nntp-request-close ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 "Close all server connections."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (let (proc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (while nntp-opened-connections
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (when (setq proc (pop nntp-opened-connections))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 ;; Un-set default sentinel function before closing connection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (when (eq 'nntp-default-sentinel (process-sentinel proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (set-process-sentinel proc nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (process-send-string proc (concat "QUIT" nntp-end-of-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (error nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 ;; Give the QUIT time to reach the server before we close
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 ;; down the process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (sleep-for 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (delete-process proc)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (and nntp-async-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (buffer-name nntp-async-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (kill-buffer nntp-async-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (let ((alist (cddr (assq 'nntp nnoo-state-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 entry)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (while (setq entry (pop alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (and (setq proc (cdr (assq 'nntp-async-buffer entry)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (buffer-name proc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (kill-buffer proc))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (nnoo-close-server 'nntp)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
413 (setq nntp-async-group-alist nil
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
414 nntp-async-articles nil)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (deffoo nntp-server-opened (&optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 "Say whether a connection to SERVER has been opened."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (and (nnoo-current-server-p 'nntp server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 nntp-server-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (buffer-name nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 nntp-server-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (memq (process-status nntp-server-process) '(open run))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (deffoo nntp-status-message (&optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 "Return server status as a string."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (if (and nntp-status-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 ;; NNN MESSAGE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (string-match "[0-9][0-9][0-9][ \t]+\\([^\r]*\\).*$"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 nntp-status-string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (substring nntp-status-string (match-beginning 1) (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 ;; Empty message if nothing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (or nntp-status-string "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (deffoo nntp-request-article (id &optional group server buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 "Request article ID (Message-ID or number)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (nntp-possibly-change-server group server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (let (found)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 ;; First we see whether we can get the article from the async buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (when (and (numberp id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 nntp-async-articles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (memq id nntp-async-fetched))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (set-buffer nntp-async-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (let ((opoint (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (art (if (numberp id) (int-to-string id) id))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (when (and (or (re-search-forward (concat "^2.. +" art) nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (re-search-forward (concat "^2.. +" art) opoint t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (setq beg (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 end (re-search-forward "^\\.\r?\n" nil t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (setq found t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (set-buffer (or buffer nntp-server-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (insert-buffer-substring nntp-async-buffer beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (let ((nntp-server-buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (nntp-decode-text)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (delete-region beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (when nntp-async-articles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (nntp-async-fetch-articles id))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (if found
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 id
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 ;; The article was not in the async buffer, so we fetch it now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (if buffer (set-process-buffer nntp-server-process buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (let ((nntp-server-buffer (or buffer nntp-server-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (art (or (and (numberp id) (int-to-string id)) id)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (and (nntp-send-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 ;; A bit odd regexp to ensure working over rlogin.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 "^\\.\r?\n" "ARTICLE" art)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (if (numberp id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (cons nntp-current-group id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 ;; We find out what the article number was.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (nntp-find-group-and-number)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (nntp-decode-text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (and nntp-async-articles (nntp-async-fetch-articles id)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (when buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (set-process-buffer nntp-server-process nntp-server-buffer))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (deffoo nntp-request-body (id &optional group server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 "Request body of article ID (Message-ID or number)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (nntp-possibly-change-server group server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 ;; If NEmacs, end of message may look like: "\256\215" (".^M")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (nntp-send-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 "^\\.\r?\n" "BODY" (or (and (numberp id) (int-to-string id)) id))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 (nntp-decode-text)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 (deffoo nntp-request-head (id &optional group server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 "Request head of article ID (Message-ID or number)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 (nntp-possibly-change-server group server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (when (nntp-send-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 "^\\.\r?\n" "HEAD" (if (numberp id) (int-to-string id) id))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (if (numberp id) id
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 ;; We find out what the article number was.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (nntp-find-group-and-number)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (nntp-decode-text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (nnheader-fold-continuation-lines))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (deffoo nntp-request-stat (id &optional group server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 "Request STAT of article ID (Message-ID or number)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (nntp-possibly-change-server group server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 (nntp-send-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 "^[23].*\r?\n" "STAT" (or (and (numberp id) (int-to-string id)) id)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 (deffoo nntp-request-type (group &optional article)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 'news)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 (deffoo nntp-request-group (group &optional server dont-check)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 "Select GROUP."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (nntp-possibly-change-server nil server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (setq nntp-current-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (when (nntp-send-command "^2.*\r?\n" "GROUP" group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 group)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 (deffoo nntp-request-asynchronous (group &optional server articles)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 "Enable pre-fetch in GROUP."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (when nntp-async-articles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (nntp-async-request-group group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 (when nntp-async-number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (if (not (or (nntp-async-server-opened)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (nntp-async-open-server)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 ;; Couldn't open the second connection
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 (message "Can't open second connection to %s" nntp-address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 (ding)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (setq nntp-async-articles nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (sit-for 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 ;; We opened the second connection (or it was opened already).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 (setq nntp-async-articles articles)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (setq nntp-async-fetched nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 ;; Clear any old data.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (set-buffer nntp-async-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (erase-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 ;; Select the correct current group on this server.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (nntp-async-send-strings "GROUP" group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (deffoo nntp-list-active-group (group &optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 "Return the active info on GROUP (which can be a regexp."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (nntp-possibly-change-server group server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (nntp-send-command "^.*\r?\n" "LIST ACTIVE" group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (deffoo nntp-request-group-description (group &optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 "Get the description of GROUP."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 (nntp-possibly-change-server nil server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (nntp-send-command "^.*\r?\n" "XGTITLE" group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 (nntp-decode-text)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 (deffoo nntp-close-group (group &optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 "Close GROUP."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (setq nntp-current-group nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (deffoo nntp-request-list (&optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 "List all active groups."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (nntp-possibly-change-server nil server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 (nntp-send-command "^\\.\r?\n" "LIST")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (nntp-decode-text)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (deffoo nntp-request-list-newsgroups (&optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 "Get descriptions on all groups on SERVER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (nntp-possibly-change-server nil server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (nntp-send-command "^\\.\r?\n" "LIST NEWSGROUPS")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (nntp-decode-text)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (deffoo nntp-request-newgroups (date &optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 "List groups that have arrived since DATE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (nntp-possibly-change-server nil server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (let* ((date (timezone-parse-date date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (time-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 (format "%s%02d%02d %s%s%s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (substring (aref date 0) 2) (string-to-int (aref date 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (string-to-int (aref date 2)) (substring (aref date 3) 0 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (aref date 3) 3 5) (substring (aref date 3) 6 8))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (nntp-send-command "^\\.\r?\n" "NEWGROUPS" time-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (nntp-decode-text))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (deffoo nntp-request-list-distributions (&optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 "List distributions."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (nntp-possibly-change-server nil server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (nntp-send-command "^\\.\r?\n" "LIST DISTRIBUTIONS")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 (nntp-decode-text)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 (deffoo nntp-request-last (&optional group server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 "Decrease the current article pointer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (nntp-possibly-change-server group server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 (nntp-send-command "^[23].*\r?\n" "LAST"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 (deffoo nntp-request-next (&optional group server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 "Advance the current article pointer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 (nntp-possibly-change-server group server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 (nntp-send-command "^[23].*\r?\n" "NEXT"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 (deffoo nntp-request-post (&optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 "Post the current buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 (nntp-possibly-change-server nil server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (when (nntp-send-command "^[23].*\r?\n" "POST")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 (nnheader-insert "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (nntp-encode-text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 (nntp-send-region-to-server (point-min) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 ;; 1.2a NNTP's post command is buggy. "^M" (\r) is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 ;; appended to end of the status message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (nntp-wait-for-response "^[23].*\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 ;;; Internal functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 (defun nntp-send-mode-reader ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 "Send the MODE READER command to the nntp server.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 This function is supposed to be called from `nntp-server-opened-hook'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 It will make innd servers spawn an nnrpd process to allow actual article
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 reading."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (nntp-send-command "^.*\r?\n" "MODE READER"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (defun nntp-send-nosy-authinfo ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 "Send the AUTHINFO to the nntp server.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 This function is supposed to be called from `nntp-server-opened-hook'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 It will prompt for a password."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (nntp-send-command "^.*\r?\n" "AUTHINFO USER"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (read-string "NNTP user name: "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (nntp-send-command "^.*\r?\n" "AUTHINFO PASS"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 (read-string "NNTP password: ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (defun nntp-send-authinfo ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 "Send the AUTHINFO to the nntp server.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 This function is supposed to be called from `nntp-server-opened-hook'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 It will prompt for a password."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 (nntp-send-command "^.*\r?\n" "AUTHINFO USER" (user-login-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (nntp-send-command "^.*\r?\n" "AUTHINFO PASS"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 (read-string "NNTP password: ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 (defun nntp-send-authinfo-from-file ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 "Send the AUTHINFO to the nntp server.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 This function is supposed to be called from `nntp-server-opened-hook'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 It will prompt for a password."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 (when (file-exists-p "~/.nntp-authinfo")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 (set-buffer (get-buffer-create " *authinfo*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 (insert-file-contents "~/.nntp-authinfo")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 (nntp-send-command "^.*\r?\n" "AUTHINFO USER" (user-login-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 (nntp-send-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 "^.*\r?\n" "AUTHINFO PASS"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (buffer-substring (point) (progn (end-of-line) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (kill-buffer (current-buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (defun nntp-default-sentinel (proc status)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 "Default sentinel function for NNTP server process."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 (let ((servers (cddr (assq 'nntp nnoo-state-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 ;; Go through the alist of server names and find the name of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 ;; server that the process that sent the signal is connected to.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 ;; If you get my drift.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 (if (equal proc nntp-server-process)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 (setq server nntp-address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 (while (and servers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 (not (equal proc (cdr (assq 'nntp-server-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 (car servers))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 (setq servers (cdr servers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 (setq server (caar servers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 (when (and server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 nntp-warn-about-losing-connection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 (nnheader-message 3 "nntp: Connection closed to server %s" server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 (setq nntp-current-group "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 (ding))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 (defun nntp-kill-connection (server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 "Choke the connection to SERVER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 (let ((proc (cdr (assq 'nntp-server-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 (assoc server (cddr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 (assq 'nntp nnoo-state-alist)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 (when proc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 (delete-process (process-name proc)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 (nntp-close-server server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 (nnheader-report
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 'nntp (message "Connection timed out to server %s" server))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 (ding)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 (sit-for 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 ;; Encoding and decoding of NNTP text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 (defun nntp-decode-text ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 "Decode text transmitted by NNTP.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 0. Delete status line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 1. Delete `^M' at end of line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 2. Delete `.' at end of buffer (end of text mark).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 3. Delete `.' at beginning of line."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 ;; Insert newline at end of buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 (or (bolp) (insert "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 ;; Delete status line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 (delete-region (goto-char (point-min)) (progn (forward-line 1) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 ;; Delete `^M's.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 (while (search-forward "\r" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 (replace-match "" t t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 ;; Delete `.' at end of the buffer (end of text mark).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 (forward-line -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 (when (looking-at "^\\.\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 (delete-region (point) (progn (forward-line 1) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 ;; Replace `..' at beginning of line with `.'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 ;; (replace-regexp "^\\.\\." ".")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 (while (search-forward "\n.." nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 (delete-char -1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 (defun nntp-encode-text ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 "Encode text in current buffer for NNTP transmission.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 1. Insert `.' at beginning of line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 2. Insert `.' at end of buffer (end of text mark)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 ;; Replace `.' at beginning of line with `..'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 (goto-char (point-min))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
737 (while (re-search-forward "^\\." nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 (insert "."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 ;; Insert newline at end of buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 (or (bolp) (insert "\n"))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
742 ;(goto-char (point-min))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
743 ;(while (not (eobp))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
744 ; (end-of-line)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
745 ; (insert "\r")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
746 ; (forward-line 1))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 ;; Insert `.' at end of buffer (end of text mark).
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
748 (goto-char (point-max))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 (insert "." nntp-end-of-line)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
751
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 ;;; Synchronous Communication with NNTP servers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 (defvar nntp-retry-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 (defun nntp-send-command (response cmd &rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 "Wait for server RESPONSE after sending CMD and optional ARGS to server."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 (let ((timer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 (and nntp-command-timeout
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 (nnheader-run-at-time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 nntp-command-timeout nil 'nntp-kill-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 (nnoo-current-server 'nntp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 (nntp-retry-command t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 (while nntp-retry-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 (setq nntp-retry-command nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 ;; Clear communication buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 (if nntp-retry-on-break
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 (apply 'nntp-send-strings-to-server cmd args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 (setq result
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 (if response
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 (nntp-wait-for-response response)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 (quit (setq nntp-retry-command t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 (apply 'nntp-send-strings-to-server cmd args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 (setq result
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 (if response
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 (nntp-wait-for-response response)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (when timer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 (nnheader-cancel-timer timer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 (defun nntp-kill-command (server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 "Kill and restart the connection to SERVER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 (let ((proc (cdr (assq
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 'nntp-server-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 (assoc server (cddr (assq 'nntp nnoo-state-alist)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 (when proc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 (delete-process (process-name proc)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 (nntp-close-server server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 (nntp-open-server server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 (when nntp-current-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 (nntp-request-group nntp-current-group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 (setq nntp-retry-command t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 (defun nntp-send-command-old (response cmd &rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 "Wait for server RESPONSE after sending CMD and optional ARGS to server."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 ;; Clear communication buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 (apply 'nntp-send-strings-to-server cmd args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 (if response
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 (nntp-wait-for-response response)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 (defun nntp-wait-for-response (regexp &optional slow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 "Wait for server response which matches REGEXP."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 (let ((status t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 (wait t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 (dotnum 0) ;Number of "." being displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 (dotsize ;How often "." displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 (if (numberp nntp-debug-read) nntp-debug-read 10000)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 ;; Wait for status response (RFC977).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 ;; 1xx - Informative message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 ;; 2xx - Command ok.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 ;; 3xx - Command ok so far, send the rest of it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 ;; 4xx - Command was correct, but couldn't be performed for some
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 ;; reason.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 ;; 5xx - Command unimplemented, or incorrect, or a serious
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 ;; program error occurred.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 (nntp-accept-response)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 (while wait
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 (if slow
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 (cond ((re-search-forward "^[23][0-9][0-9]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 (setq wait nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 ((re-search-forward "^[45][0-9][0-9]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 (setq status nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 (setq wait nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 (t (nntp-accept-response)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 (if (not wait) (delete-region (point-min)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 (progn (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 (cond ((looking-at "[23]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 (setq wait nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 ((looking-at "[45]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 (setq status nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 (setq wait nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 (t (nntp-accept-response)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 ;; Save status message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 (setq nntp-status-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 (nnheader-replace-chars-in-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 (buffer-substring (point-min) (point)) ?\r ? ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 (when status
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 (setq wait t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (while wait
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 (if (bolp) (forward-line -1) (beginning-of-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 (if (looking-at regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 (setq wait nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 (when nntp-debug-read
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 (let ((newnum (/ (buffer-size) dotsize))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 (message-log-max nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 (unless (= dotnum newnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 (setq dotnum newnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 (nnheader-message 7 "NNTP: Reading %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 (make-string dotnum ?.)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 (nntp-accept-response)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 ;; Remove "...".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 (when (and nntp-debug-read (> dotnum 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 (message ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 ;; Successfully received server response.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 ;;; Low-Level Interface to NNTP Server.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (defun nntp-find-group-and-number ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 (narrow-to-region (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 (or (search-forward "\n\n" nil t) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 ;; We first find the number by looking at the status line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 (let ((number (and (looking-at "2[0-9][0-9] +\\([0-9]+\\) ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 (string-to-int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 (buffer-substring (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 (match-end 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 group newsgroups xref)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 (and number (zerop number) (setq number nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 ;; Then we find the group name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 (setq group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 ;; If there is only one group in the Newsgroups header,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 ;; then it seems quite likely that this article comes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 ;; from that group, I'd say.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 ((and (setq newsgroups (mail-fetch-field "newsgroups"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 (not (string-match "," newsgroups)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 newsgroups)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 ;; If there is more than one group in the Newsgroups
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 ;; header, then the Xref header should be filled out.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 ;; We hazard a guess that the group that has this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 ;; article number in the Xref header is the one we are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 ;; looking for. This might very well be wrong if this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 ;; article happens to have the same number in several
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 ;; groups, but that's life.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 ((and (setq xref (mail-fetch-field "xref"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 (string-match (format "\\([^ :]+\\):%d" number) xref))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 (substring xref (match-beginning 1) (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 (t "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 (when (string-match "\r" group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 (setq group (substring group 0 (match-beginning 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 (cons group number)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 (defun nntp-retrieve-headers-with-xover (articles &optional fetch-old)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 ;; This server does not talk NOV.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 ((not nntp-server-xover)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 ;; We don't care about gaps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 ((or (not nntp-nov-gap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 fetch-old)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 (nntp-send-xover-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 (if fetch-old
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 (if (numberp fetch-old)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 (max 1 (- (car articles) fetch-old))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 (car articles))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (nntp-last-element articles) 'wait)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 (when (looking-at "[1-5][0-9][0-9] ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 (delete-region (point) (progn (forward-line 1) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 (while (search-forward "\r" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 (replace-match "" t t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 (forward-line -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 (when (looking-at "\\.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (delete-region (point) (progn (forward-line 1) (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 ;; We do it the hard way. For each gap, an XOVER command is sent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 ;; to the server. We do not wait for a reply from the server, we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 ;; just send them off as fast as we can. That means that we have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 ;; to count the number of responses we get back to find out when we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 ;; have gotten all we asked for.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 ((numberp nntp-nov-gap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 (let ((count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 (received 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 (last-point (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 (buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 first)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 ;; We have to check `nntp-server-xover'. If it gets set to nil,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 ;; that means that the server does not understand XOVER, but we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 ;; won't know that until we try.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 (while (and nntp-server-xover articles)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 (setq first (car articles))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 ;; Search forward until we find a gap, or until we run out of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 ;; articles.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 (while (and (cdr articles)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (< (- (nth 1 articles) (car articles)) nntp-nov-gap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 (setq articles (cdr articles)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 (when (nntp-send-xover-command first (car articles))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 (setq articles (cdr articles)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 count (1+ count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 ;; Every 400 requests we have to read the stream in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 ;; order to avoid deadlocks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 (when (or (null articles) ;All requests have been sent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 (zerop (% count nntp-maximum-request)))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
985 (accept-process-output nntp-server-process 1)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 ;; On some Emacs versions the preceding function has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 ;; a tendency to change the buffer. Perhaps. It's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 ;; quite difficult to reproduce, because it only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 ;; seems to happen once in a blue moon.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 (set-buffer buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 (while (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 (goto-char last-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 ;; Count replies.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 (while (re-search-forward "^[0-9][0-9][0-9] " nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 (setq received (1+ received)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 (setq last-point (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 (< received count))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
998 (accept-process-output nntp-server-process)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 (set-buffer buf)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 (when nntp-server-xover
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 ;; Wait for the reply from the final command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 (re-search-backward "^[0-9][0-9][0-9] " nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 (when (looking-at "^[23]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 (while (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 (forward-line -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 (not (looking-at "^\\.\r?\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 (nntp-accept-response)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 ;; We remove any "." lines and status lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 (while (search-forward "\r" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 (delete-char -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 (delete-matching-lines "^\\.$\\|^[1-5][0-9][0-9] ")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 nntp-server-xover)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 (defun nntp-send-xover-command (beg end &optional wait-for-reply)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 "Send the XOVER command to the server."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 (let ((range (format "%d-%d" (or beg 1) (or end beg 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 (if (stringp nntp-server-xover)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 ;; If `nntp-server-xover' is a string, then we just send this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 ;; command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 (if wait-for-reply
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 (nntp-send-command "^\\.\r?\n" nntp-server-xover range)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 ;; We do not wait for the reply.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 (nntp-send-strings-to-server nntp-server-xover range))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 (let ((commands nntp-xover-commands))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 ;; `nntp-xover-commands' is a list of possible XOVER commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 ;; We try them all until we get at positive response.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 (while (and commands (eq nntp-server-xover 'try))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 (nntp-send-command "^\\.\r?\n" (car commands) range)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 (and (looking-at "[23]") ; No error message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 ;; We also have to look at the lines. Some buggy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 ;; servers give back simple lines with just the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 ;; article number. How... helpful.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 (looking-at "[0-9]+\t...")) ; More text after number.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 (setq nntp-server-xover (car commands))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 (setq commands (cdr commands)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 ;; If none of the commands worked, we disable XOVER.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 (when (eq nntp-server-xover 'try)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 (setq nntp-server-xover nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 nntp-server-xover))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 (defun nntp-send-strings-to-server (&rest strings)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 "Send STRINGS to the server."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 (let ((cmd (concat (mapconcat 'identity strings " ") nntp-end-of-line)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 ;; We open the nntp server if it is down.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 (or (nntp-server-opened (nnoo-current-server 'nntp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 (nntp-open-server (nnoo-current-server 'nntp))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1062 (error "Couldn't open server: " (nntp-status-message)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 ;; Send the strings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 (process-send-string nntp-server-process cmd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 (defun nntp-send-region-to-server (begin end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 "Send the current buffer region (from BEGIN to END) to the server."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 (let ((cur (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 ;; Copy the buffer over to the send buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 (nnheader-set-temp-buffer " *nntp send*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 (insert-buffer-substring cur begin end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 (set-buffer cur)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 (erase-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 ;; `process-send-region' does not work if the text to be sent is very
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 ;; large, so we send it piecemeal.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 (let ((last (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 (size 100)) ;Size of text sent at once.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 (while (and (/= last (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 (memq (process-status nntp-server-process) '(open run)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 (process-send-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 nntp-server-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 last (setq last (min (+ last size) (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 ;; Read any output from the server. May be unnecessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 (accept-process-output)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 (kill-buffer (current-buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 (defun nntp-open-server-semi-internal (server &optional service)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 "Open SERVER.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 If SERVER is nil, use value of environment variable `NNTPSERVER'.
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1093 If SERVICE, use this as the port number."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 (nnheader-insert "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 (let ((server (or server (getenv "NNTPSERVER")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 (status nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 (timer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 (and nntp-connection-timeout
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 (nnheader-run-at-time nntp-connection-timeout
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 nil 'nntp-kill-connection server))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 (setq nntp-status-string "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 (nnheader-message 5 "nntp: Connecting to server on %s..." nntp-address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 (cond ((and server (nntp-open-server-internal server service))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 (setq nntp-address server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 (setq status
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 (nntp-wait-for-response "^[23].*\r?\n" 'slow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 (error nil)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1111 ;(quit nil)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1112 ))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 (unless status
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 (nntp-close-server-internal server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 (nnheader-report
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 'nntp "Couldn't open connection to %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 (if (and nntp-address
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 (not (equal nntp-address "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 nntp-address server)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 (when nntp-server-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 (set-process-sentinel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 nntp-server-process 'nntp-default-sentinel)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 ;; You can send commands at startup like AUTHINFO here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 ;; Added by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 (run-hooks 'nntp-server-opened-hook)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 ((null server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 (nnheader-report 'nntp "NNTP server is not specified."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 (t ; We couldn't open the server.
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1129 (nnheader-report 'nntp (buffer-string))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 (when timer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 (nnheader-cancel-timer timer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 (message "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 (unless status
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 (nnoo-close-server 'nntp server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 (setq nntp-async-number nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 status)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 (defvar nntp-default-directories '("~" "/tmp" "/")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 "Directories to as current directory in the nntp server buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 (defun nntp-open-server-internal (server &optional service)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 "Open connection to news server on SERVER by SERVICE (default is nntp)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 (let (proc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 ;; Make sure we have a valid current directory for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 ;; nntp server buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 (unless (file-exists-p default-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 (let ((dirs nntp-default-directories))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 (while dirs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 (when (file-exists-p (car dirs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 (setq default-directory (car dirs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 dirs nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 (setq dirs (cdr dirs)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 ((and (setq proc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 (funcall nntp-open-server-function server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 (error nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 (memq (process-status proc) '(open run)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 (setq nntp-server-process proc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 (setq nntp-address server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 ;; Suggested by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 (process-kill-without-query proc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 (run-hooks 'nntp-server-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 (push proc nntp-opened-connections)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 (nntp-read-server-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 (nnheader-report 'nntp "Couldn't open server %s" server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 (nntp-close-server)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 nntp-server-process)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 (nnheader-report 'nntp "Couldn't open server %s" server))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 (defun nntp-read-server-type ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 "Find out what the name of the server we have connected to is."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 ;; Wait for the status string to arrive.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 (nntp-wait-for-response "^.*\n" t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 (setq nntp-server-type (buffer-string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 (let ((alist nntp-server-action-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 entry)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 ;; Run server-specific commmands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 (while alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 (setq entry (pop alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 (when (string-match (car entry) nntp-server-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 (if (and (listp (cadr entry))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 (not (eq 'lambda (caadr entry))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 (eval (cadr entry))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 (funcall (cadr entry)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 (defun nntp-open-network-stream (server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 (open-network-stream
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 "nntpd" nntp-server-buffer server nntp-port-number))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 (defun nntp-open-rlogin (server)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1197 "Open a connection to SERVER using rsh."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 (let ((proc (if nntp-rlogin-user-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 (start-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 "nntpd" nntp-server-buffer "rsh"
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1201 server "-l" nntp-rlogin-user-name
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 (mapconcat 'identity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 nntp-rlogin-parameters " "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 (start-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 "nntpd" nntp-server-buffer "rsh" server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 (mapconcat 'identity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 nntp-rlogin-parameters " ")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1210 (defun nntp-wait-for-string (regexp)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1211 "Wait until string arrives in the buffer."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1212 (let ((buf (current-buffer)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 (goto-char (point-min))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1214 (while (not (re-search-forward regexp nil t))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1215 (accept-process-output nntp-server-process)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1216 (set-buffer buf)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1217 (goto-char (point-min)))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1218
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1219 (defun nntp-open-telnet (server)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1220 (save-excursion
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1221 (set-buffer nntp-server-buffer)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1222 (erase-buffer)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1223 (let ((proc (start-process
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1224 "nntpd" nntp-server-buffer "telnet" "-8"))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1225 (case-fold-search t))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1226 (when (memq (process-status proc) '(open run))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1227 (process-send-string proc "set escape \^X\n")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1228 (process-send-string proc (concat "open " server "\n"))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1229 (nntp-wait-for-string "^\r*.?login:")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1230 (process-send-string
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1231 proc (concat
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1232 (or nntp-telnet-user-name
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1233 (setq nntp-telnet-user-name (read-string "login: ")))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1234 "\n"))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1235 (nntp-wait-for-string "^\r*.?password:")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1236 (process-send-string
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1237 proc (concat
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1238 (or nntp-telnet-passwd
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1239 (setq nntp-telnet-passwd
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1240 (nnmail-read-passwd "Password: ")))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1241 "\n"))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1242 (erase-buffer)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1243 (nntp-wait-for-string "bash\\|\$ *\r?$\\|> *\r?")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1244 (process-send-string
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1245 proc (concat (mapconcat 'identity nntp-telnet-parameters " ") "\n"))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1246 (nntp-wait-for-string "^\r*200")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1247 (beginning-of-line)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1248 (delete-region (point-min) (point))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1249 (process-send-string proc "\^]")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1250 (nntp-wait-for-string "^telnet")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1251 (process-send-string proc "mode character\n")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1252 (accept-process-output proc 1)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1253 (sit-for 1)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1254 (goto-char (point-min))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1255 (forward-line 1)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1256 (delete-region (point) (point-max)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1257 proc)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 (defun nntp-close-server-internal (&optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 "Close connection to news server."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 (nntp-possibly-change-server nil server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 (if nntp-server-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 (delete-process nntp-server-process))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 (setq nntp-server-process nil)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1265 ;(setq nntp-address "")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1266 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 (defun nntp-accept-response ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 "Read response of server.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 It is well-known that the communication speed will be much improved by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 defining this function as macro."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 ;; To deal with server process exiting before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 ;; accept-process-output is called.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 ;; Suggested by Jason Venner <jason@violet.berkeley.edu>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 ;; This is a copy of `nntp-default-sentinel'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 (let ((buf (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 (if (or (not nntp-server-process)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 (not (memq (process-status nntp-server-process) '(open run))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 (error "nntp: Process connection closed; %s" (nntp-status-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 (if nntp-buggy-select
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 ;; We cannot use `accept-process-output'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 ;; Fujitsu UTS requires messages during sleep-for.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 ;; I don't know why.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 (nnheader-message 5 "NNTP: Reading...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 (sleep-for 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 (nnheader-message 5 ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 (condition-case errorcode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 (accept-process-output nntp-server-process 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 (cond ((string-equal "select error: Invalid argument"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 (nth 1 errorcode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 ;; Ignore select error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 (signal (car errorcode) (cdr errorcode))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 (set-buffer buf))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 (defun nntp-last-element (list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 "Return last element of LIST."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 (while (cdr list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 (setq list (cdr list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 (car list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 (defun nntp-possibly-change-server (newsgroup server &optional connectionless)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 "Check whether the virtual server needs changing."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 (when (and server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 (not (nntp-server-opened server)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 ;; This virtual server isn't open, so we (re)open it here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 (nntp-open-server server nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 (when (and newsgroup
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 (not (equal newsgroup nntp-current-group)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 ;; Set the proper current group.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 (nntp-request-group newsgroup server)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 (defun nntp-try-list-active (group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 (nntp-list-active-group group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 (cond ((looking-at "5[0-9]+")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 (setq nntp-server-list-active-group nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 (setq nntp-server-list-active-group t)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 (defun nntp-async-server-opened ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 (and nntp-async-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 (memq (process-status nntp-async-process) '(open run))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 (defun nntp-async-open-server ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 (set-buffer (generate-new-buffer " *async-nntp*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 (setq nntp-async-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 (buffer-disable-undo (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 (let ((nntp-server-process nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 (nntp-server-buffer nntp-async-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 (nntp-open-server-semi-internal nntp-address nntp-port-number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 (if (not (setq nntp-async-process nntp-server-process))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 (setq nntp-async-number nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 (set-process-buffer nntp-async-process nntp-async-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 (defun nntp-async-fetch-articles (article)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 (if (stringp article)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 (let ((articles (cdr (memq (assq article nntp-async-articles)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 nntp-async-articles)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 (max (cond ((numberp nntp-async-number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 nntp-async-number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 ((eq nntp-async-number t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 (length nntp-async-articles))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 (t 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 nart)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 (while (and (>= (setq max (1- max)) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 articles)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 (or (memq (setq nart (caar articles)) nntp-async-fetched)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 (nntp-async-send-strings "ARTICLE " (int-to-string nart))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 (setq nntp-async-fetched (cons nart nntp-async-fetched))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 (setq articles (cdr articles))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 (defun nntp-async-send-strings (&rest strings)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 (let ((cmd (concat (mapconcat 'identity strings " ") nntp-end-of-line)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 (or (nntp-async-server-opened)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 (nntp-async-open-server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 (error (nntp-status-message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 (process-send-string nntp-async-process cmd)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 (defun nntp-async-request-group (group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 (if (equal group nntp-current-group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 (let ((asyncs (assoc group nntp-async-group-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 ;; A new group has been selected, so we push the current state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 ;; of async articles on an alist, and pull the old state off.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 (setq nntp-async-group-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 (cons (list nntp-current-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 nntp-async-articles nntp-async-fetched
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 nntp-async-process)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 (delq asyncs nntp-async-group-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 (and asyncs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 (setq nntp-async-articles (nth 1 asyncs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 (setq nntp-async-fetched (nth 2 asyncs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 (setq nntp-async-process (nth 3 asyncs)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 (provide 'nntp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 ;;; nntp.el ends here