Mercurial > emacs
annotate lisp/gnus/nntp.el @ 108046:f61e8ca6c2fd
Merge from mainline.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Mon, 12 Apr 2010 22:58:14 +0000 |
parents | ecbe0edc4f69 |
children | fa10effce8f8 |
rev | line source |
---|---|
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1 ;;; nntp.el --- nntp access for Gnus |
49993
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49725
diff
changeset
|
2 |
64754
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64092
diff
changeset
|
3 ;; Copyright (C) 1987, 1988, 1989, 1990, 1992, 1993, |
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64092
diff
changeset
|
4 ;; 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, |
106815 | 5 ;; 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
17493 | 6 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
7 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
17493 | 8 ;; Keywords: news |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93419
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93419
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93419
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93419
diff
changeset
|
15 ;; (at your option) any later version. |
17493 | 16 |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93419
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93419
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93419
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93419
diff
changeset
|
20 ;; GNU General Public License for more details. |
17493 | 21 |
22 ;; You should have received a copy of the GNU General Public License | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93419
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
17493 | 24 |
25 ;;; Commentary: | |
26 | |
27 ;;; Code: | |
28 | |
107427
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
29 ;; For Emacs < 22.2. |
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
30 (eval-and-compile |
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
31 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))) |
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
32 |
17493 | 33 (require 'nnheader) |
34 (require 'nnoo) | |
35 (require 'gnus-util) | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
36 (require 'gnus) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
37 (require 'gnus-group) ;; gnus-group-name-charset |
17493 | 38 |
39 (nnoo-declare nntp) | |
40 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
41 (eval-when-compile (require 'cl)) |
17493 | 42 |
95820
645fb33380d6
Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents:
94837
diff
changeset
|
43 (autoload 'auth-source-user-or-password "auth-source") |
94837 | 44 |
57015
6d1f39d4f8e6
* nntp.el (nntp): New customization group.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
56927
diff
changeset
|
45 (defgroup nntp nil |
6d1f39d4f8e6
* nntp.el (nntp): New customization group.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
56927
diff
changeset
|
46 "NNTP access for Gnus." |
6d1f39d4f8e6
* nntp.el (nntp): New customization group.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
56927
diff
changeset
|
47 :group 'gnus) |
6d1f39d4f8e6
* nntp.el (nntp): New customization group.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
56927
diff
changeset
|
48 |
17493 | 49 (defvoo nntp-address nil |
50 "Address of the physical nntp server.") | |
51 | |
52 (defvoo nntp-port-number "nntp" | |
53 "Port number on the physical nntp server.") | |
54 | |
55 (defvoo nntp-server-opened-hook '(nntp-send-mode-reader) | |
56 "*Hook used for sending commands to the server at startup. | |
57 The default value is `nntp-send-mode-reader', which makes an innd | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
58 server spawn an nnrpd server.") |
17493 | 59 |
60 (defvoo nntp-authinfo-function 'nntp-send-authinfo | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
61 "Function used to send AUTHINFO to the server. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
62 It is called with no parameters.") |
17493 | 63 |
64 (defvoo nntp-server-action-alist | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
65 '(("nntpd 1\\.5\\.11t" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
66 (remove-hook 'nntp-server-opened-hook 'nntp-send-mode-reader)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
67 ("NNRP server Netscape" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
68 (setq nntp-server-list-active-group nil))) |
17493 | 69 "Alist of regexps to match on server types and actions to be taken. |
70 For instance, if you want Gnus to beep every time you connect | |
71 to innd, you could say something like: | |
72 | |
73 \(setq nntp-server-action-alist | |
74 '((\"innd\" (ding)))) | |
75 | |
76 You probably don't want to do that, though.") | |
77 | |
78 (defvoo nntp-open-connection-function 'nntp-open-network-stream | |
79 "*Function used for connecting to a remote system. | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
80 It will be called with the buffer to output in as argument. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
81 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
82 Currently, five such functions are provided (please refer to their |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
83 respective doc string for more information), three of them establishing |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
84 direct connections to the nntp server, and two of them using an indirect |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
85 host. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
86 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
87 Direct connections: |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
88 - `nntp-open-network-stream' (the default), |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
89 - `nntp-open-ssl-stream', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
90 - `nntp-open-tls-stream', |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
91 - `nntp-open-netcat-stream'. |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
92 - `nntp-open-telnet-stream'. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
93 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
94 Indirect connections: |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
95 - `nntp-open-via-rlogin-and-netcat', |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
96 - `nntp-open-via-rlogin-and-telnet', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
97 - `nntp-open-via-telnet-and-telnet'.") |
17493 | 98 |
76267 | 99 (defvoo nntp-never-echoes-commands nil |
100 "*Non-nil means the nntp server never echoes commands. | |
101 It is reported that some nntps server doesn't echo commands. So, you | |
102 may want to set this to non-nil in the method for such a server setting | |
103 `nntp-open-connection-function' to `nntp-open-ssl-stream' for example. | |
104 Note that the `nntp-open-connection-functions-never-echo-commands' | |
105 variable overrides the nil value of this variable.") | |
106 | |
107 (defvoo nntp-open-connection-functions-never-echo-commands | |
108 '(nntp-open-network-stream) | |
109 "*List of functions that never echo commands. | |
110 Add or set a function which you set to `nntp-open-connection-function' | |
111 to this list if it does not echo commands. Note that a non-nil value | |
112 of the `nntp-never-echoes-commands' variable overrides this variable.") | |
113 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
114 (defvoo nntp-pre-command nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
115 "*Pre-command to use with the various nntp-open-via-* methods. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
116 This is where you would put \"runsocks\" or stuff like that.") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
117 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
118 (defvoo nntp-telnet-command "telnet" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
119 "*Telnet command used to connect to the nntp server. |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
120 This command is used by the methods `nntp-open-telnet-stream', |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
121 `nntp-open-via-rlogin-and-telnet' and `nntp-open-via-telnet-and-telnet'.") |
17493 | 122 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
123 (defvoo nntp-telnet-switches '("-8") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
124 "*Switches given to the telnet command `nntp-telnet-command'.") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
125 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
126 (defvoo nntp-end-of-line "\r\n" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
127 "*String to use on the end of lines when talking to the NNTP server. |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
128 This is \"\\r\\n\" by default, but should be \"\\n\" when using an indirect |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
129 connection method (nntp-open-via-*).") |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
130 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
131 (defvoo nntp-via-rlogin-command "rsh" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
132 "*Rlogin command used to connect to an intermediate host. |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
133 This command is used by the methods `nntp-open-via-rlogin-and-telnet' |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
134 and `nntp-open-via-rlogin-and-netcat'. The default is \"rsh\", but \"ssh\" |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
135 is a popular alternative.") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
136 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
137 (defvoo nntp-via-rlogin-command-switches nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
138 "*Switches given to the rlogin command `nntp-via-rlogin-command'. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
139 If you use \"ssh\" for `nntp-via-rlogin-command', you may set this to |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
140 \(\"-C\") in order to compress all data connections, otherwise set this |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
141 to \(\"-t\" \"-e\" \"none\") or (\"-C\" \"-t\" \"-e\" \"none\") if the telnet |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
142 command requires a pseudo-tty allocation on an intermediate host.") |
17493 | 143 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
144 (defvoo nntp-via-telnet-command "telnet" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
145 "*Telnet command used to connect to an intermediate host. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
146 This command is used by the `nntp-open-via-telnet-and-telnet' method.") |
17493 | 147 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
148 (defvoo nntp-via-telnet-switches '("-8") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
149 "*Switches given to the telnet command `nntp-via-telnet-command'.") |
17493 | 150 |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
151 (defvoo nntp-netcat-command "nc" |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
152 "*Netcat command used to connect to the nntp server. |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
153 This command is used by the `nntp-open-netcat-stream' and |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
154 `nntp-open-via-rlogin-and-netcat' methods.") |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
155 |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
156 (defvoo nntp-netcat-switches nil |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
157 "*Switches given to the netcat command `nntp-netcat-command'.") |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
158 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
159 (defvoo nntp-via-user-name nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
160 "*User name to log in on an intermediate host with. |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
161 This variable is used by the various nntp-open-via-* methods.") |
17493 | 162 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
163 (defvoo nntp-via-user-password nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
164 "*Password to use to log in on an intermediate host with. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
165 This variable is used by the `nntp-open-via-telnet-and-telnet' method.") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
166 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
167 (defvoo nntp-via-address nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
168 "*Address of an intermediate host to connect to. |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
169 This variable is used by the various nntp-open-via-* methods.") |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19598
diff
changeset
|
170 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
171 (defvoo nntp-via-envuser nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
172 "*Whether both telnet client and server support the ENVIRON option. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
173 If non-nil, there will be no prompt for a login name.") |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19598
diff
changeset
|
174 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
175 (defvoo nntp-via-shell-prompt "bash\\|\$ *\r?$\\|> *\r?" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
176 "*Regular expression to match the shell prompt on an intermediate host. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
177 This variable is used by the `nntp-open-via-telnet-and-telnet' method.") |
17493 | 178 |
179 (defvoo nntp-large-newsgroup 50 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
180 "*The number of articles which indicates a large newsgroup. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
181 If the number of articles is greater than the value, verbose |
17493 | 182 messages will be shown to indicate the current status.") |
183 | |
184 (defvoo nntp-maximum-request 400 | |
185 "*The maximum number of the requests sent to the NNTP server at one time. | |
186 If Emacs hangs up while retrieving headers, set the variable to a | |
187 lower value.") | |
188 | |
189 (defvoo nntp-nov-is-evil nil | |
190 "*If non-nil, nntp will never attempt to use XOVER when talking to the server.") | |
191 | |
192 (defvoo nntp-xover-commands '("XOVER" "XOVERVIEW") | |
193 "*List of strings that are used as commands to fetch NOV lines from a server. | |
194 The strings are tried in turn until a positive response is gotten. If | |
195 none of the commands are successful, nntp will just grab headers one | |
196 by one.") | |
197 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19598
diff
changeset
|
198 (defvoo nntp-nov-gap 5 |
17493 | 199 "*Maximum allowed gap between two articles. |
200 If the gap between two consecutive articles is bigger than this | |
201 variable, split the XOVER request into two requests.") | |
202 | |
78546 | 203 (defvoo nntp-xref-number-is-evil nil |
204 "*If non-nil, Gnus never trusts article numbers in the Xref header. | |
205 Some news servers, e.g., ones running Diablo, run multiple engines | |
206 having the same articles but article numbers are not kept synchronized | |
207 between them. If you connect to such a server, set this to a non-nil | |
208 value, and Gnus never uses article numbers (that appear in the Xref | |
209 header and vary by which engine is chosen) to refer to articles.") | |
210 | |
17493 | 211 (defvoo nntp-prepare-server-hook nil |
212 "*Hook run before a server is opened. | |
213 If can be used to set up a server remotely, for instance. Say you | |
214 have an account at the machine \"other.machine\". This machine has | |
215 access to an NNTP server that you can't access locally. You could | |
216 then use this hook to rsh to the remote machine and start a proxy NNTP | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
217 server there that you can connect to. See also |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
218 `nntp-open-connection-function'") |
17493 | 219 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
220 (defvoo nntp-coding-system-for-read 'binary |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
221 "*Coding system to read from NNTP.") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
222 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
223 (defvoo nntp-coding-system-for-write 'binary |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
224 "*Coding system to write to NNTP.") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
225 |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
226 ;; Marks |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
227 (defvoo nntp-marks-is-evil nil |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
228 "*If non-nil, Gnus will never generate and use marks file for nntp groups. |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
229 See `nnml-marks-is-evil' for more information.") |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
230 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
231 (defvoo nntp-marks-file-name ".marks") |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
232 (defvoo nntp-marks nil) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
233 (defvar nntp-marks-modtime (gnus-make-hashtable)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
234 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
235 (defcustom nntp-marks-directory |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
236 (nnheader-concat gnus-directory "marks/") |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
237 "*The directory where marks for nntp groups will be stored." |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
238 :group 'nntp |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
239 :type 'directory) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
240 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
241 (defcustom nntp-authinfo-file "~/.authinfo" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
242 ".netrc-like file that holds nntp authinfo passwords." |
57015
6d1f39d4f8e6
* nntp.el (nntp): New customization group.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
56927
diff
changeset
|
243 :group 'nntp |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
244 :type |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
245 '(choice file |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
246 (repeat :tag "Entries" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
247 :menu-tag "Inline" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
248 (list :format "%v" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
249 :value ("" ("login" . "") ("password" . "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
250 (string :tag "Host") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
251 (checklist :inline t |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
252 (cons :format "%v" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
253 (const :format "" "login") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
254 (string :format "Login: %v")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
255 (cons :format "%v" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
256 (const :format "" "password") |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
257 (string :format "Password: %v"))))))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
258 |
17493 | 259 |
260 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
261 (defvoo nntp-connection-timeout nil |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
262 "*Number of seconds to wait before an nntp connection times out. |
33575
93288a69f66f
2000-11-17 Katsumi Yamaoka <yamaoka@jpl.org>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
263 If this variable is nil, which is the default, no timers are set. |
93288a69f66f
2000-11-17 Katsumi Yamaoka <yamaoka@jpl.org>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
264 NOTE: This variable is never seen to work in Emacs 20 and XEmacs 21.") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
265 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
266 (defvoo nntp-prepare-post-hook nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
267 "*Hook run just before posting an article. It is supposed to be used |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
268 to insert Cancel-Lock headers.") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
269 |
17493 | 270 ;;; Internal variables. |
271 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
272 (defvar nntp-record-commands nil |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
273 "*If non-nil, nntp will record all commands in the \"*nntp-log*\" buffer.") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
274 |
17493 | 275 (defvar nntp-have-messaged nil) |
276 | |
277 (defvar nntp-process-wait-for nil) | |
278 (defvar nntp-process-to-buffer nil) | |
279 (defvar nntp-process-callback nil) | |
280 (defvar nntp-process-decode nil) | |
281 (defvar nntp-process-start-point nil) | |
282 (defvar nntp-inside-change-function nil) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
283 (defvoo nntp-last-command-time nil) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
284 (defvoo nntp-last-command nil) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
285 (defvoo nntp-authinfo-password nil) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
286 (defvoo nntp-authinfo-user nil) |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
287 (defvoo nntp-authinfo-force nil) |
17493 | 288 |
289 (defvar nntp-connection-list nil) | |
290 | |
291 (defvoo nntp-server-type nil) | |
292 (defvoo nntp-connection-alist nil) | |
293 (defvoo nntp-status-string "") | |
294 (defconst nntp-version "nntp 5.0") | |
295 (defvoo nntp-inhibit-erase nil) | |
296 (defvoo nntp-inhibit-output nil) | |
297 | |
298 (defvoo nntp-server-xover 'try) | |
299 (defvoo nntp-server-list-active-group 'try) | |
300 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
301 (defvar nntp-async-needs-kluge |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
302 (string-match "^GNU Emacs 20\\.3\\." (emacs-version)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
303 "*When non-nil, nntp will poll asynchronous connections |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
304 once a second. By default, this is turned on only for Emacs |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
305 20.3, which has a bug that breaks nntp's normal method of |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
306 noticing asynchronous data.") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
307 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
308 (defvar nntp-async-timer nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
309 (defvar nntp-async-process-list nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
310 |
64754
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64092
diff
changeset
|
311 (defvar nntp-ssl-program |
49993
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49725
diff
changeset
|
312 "openssl s_client -quiet -ssl3 -connect %s:%p" |
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49725
diff
changeset
|
313 "A string containing commands for SSL connections. |
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49725
diff
changeset
|
314 Within a string, %s is replaced with the server address and %p with |
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49725
diff
changeset
|
315 port number on server. The program should accept IMAP commands on |
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49725
diff
changeset
|
316 stdin and return responses to stdout.") |
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49725
diff
changeset
|
317 |
67418
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65742
diff
changeset
|
318 (defvar nntp-authinfo-rejected nil |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65742
diff
changeset
|
319 "A custom error condition used to report 'Authentication Rejected' errors. |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65742
diff
changeset
|
320 Condition handlers that match just this condition ensure that the nntp |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65742
diff
changeset
|
321 backend doesn't catch this error.") |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65742
diff
changeset
|
322 (put 'nntp-authinfo-rejected 'error-conditions '(error nntp-authinfo-rejected)) |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65742
diff
changeset
|
323 (put 'nntp-authinfo-rejected 'error-message "Authorization Rejected") |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65742
diff
changeset
|
324 |
17493 | 325 |
326 | |
327 ;;; Internal functions. | |
328 | |
329 (defsubst nntp-send-string (process string) | |
330 "Send STRING to PROCESS." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
331 ;; We need to store the time to provide timeouts, and |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
332 ;; to store the command so the we can replay the command |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
333 ;; if the server gives us an AUTHINFO challenge. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
334 (setq nntp-last-command-time (current-time) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
335 nntp-last-command string) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
336 (when nntp-record-commands |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
337 (nntp-record-command string)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
338 (process-send-string process (concat string nntp-end-of-line)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
339 (or (memq (process-status process) '(open run)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
340 (nntp-report "Server closed connection"))) |
17493 | 341 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
342 (defun nntp-record-command (string) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
343 "Record the command STRING." |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
344 (with-current-buffer (get-buffer-create "*nntp-log*") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
345 (goto-char (point-max)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
346 (let ((time (current-time))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
347 (insert (format-time-string "%Y%m%dT%H%M%S" time) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
348 "." (format "%03d" (/ (nth 2 time) 1000)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
349 " " nntp-address " " string "\n")))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
350 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
351 (defun nntp-report (&rest args) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
352 "Report an error from the nntp backend. The first string in ARGS |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
353 can be a format string. For some commands, the failed command may be |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
354 retried once before actually displaying the error report." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
355 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
356 (when nntp-record-commands |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
357 (nntp-record-command "*** CALLED nntp-report ***")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
358 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
359 (nnheader-report 'nntp args) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
360 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
361 (apply 'error args)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
362 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
363 (defun nntp-report-1 (&rest args) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
364 "Throws out to nntp-with-open-group-error so that the connection may |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
365 be restored and the command retried." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
366 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
367 (when nntp-record-commands |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
368 (nntp-record-command "*** CONNECTION LOST ***")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
369 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
370 (throw 'nntp-with-open-group-error t)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
371 |
86225 | 372 (defmacro nntp-insert-buffer-substring (buffer &optional start end) |
373 "Copy string from unibyte buffer to multibyte current buffer." | |
374 (if (featurep 'xemacs) | |
375 `(insert-buffer-substring ,buffer ,start ,end) | |
376 `(if enable-multibyte-characters | |
377 (insert (with-current-buffer ,buffer | |
378 (mm-string-to-multibyte | |
379 ,(if (or start end) | |
380 `(buffer-substring (or ,start (point-min)) | |
381 (or ,end (point-max))) | |
382 '(buffer-string))))) | |
383 (insert-buffer-substring ,buffer ,start ,end)))) | |
384 | |
385 (defmacro nntp-copy-to-buffer (buffer start end) | |
386 "Copy string from unibyte current buffer to multibyte buffer." | |
387 (if (featurep 'xemacs) | |
388 `(copy-to-buffer ,buffer ,start ,end) | |
389 `(let ((string (buffer-substring ,start ,end))) | |
390 (with-current-buffer ,buffer | |
391 (erase-buffer) | |
392 (insert (if enable-multibyte-characters | |
393 (mm-string-to-multibyte string) | |
394 string)) | |
395 (goto-char (point-min)) | |
396 nil)))) | |
397 | |
17493 | 398 (defsubst nntp-wait-for (process wait-for buffer &optional decode discard) |
399 "Wait for WAIT-FOR to arrive from PROCESS." | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
400 |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
401 (with-current-buffer (process-buffer process) |
17493 | 402 (goto-char (point-min)) |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
403 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
404 (while (and (or (not (memq (char-after (point)) '(?2 ?3 ?4 ?5))) |
67418
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65742
diff
changeset
|
405 (looking-at "48[02]")) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
406 (memq (process-status process) '(open run))) |
67418
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65742
diff
changeset
|
407 (cond ((looking-at "480") |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
408 (nntp-handle-authinfo process)) |
67418
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65742
diff
changeset
|
409 ((looking-at "482") |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65742
diff
changeset
|
410 (nnheader-report 'nntp (get 'nntp-authinfo-rejected 'error-message)) |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65742
diff
changeset
|
411 (signal 'nntp-authinfo-rejected nil)) |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65742
diff
changeset
|
412 ((looking-at "^.*\n") |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65742
diff
changeset
|
413 (delete-region (point) (progn (forward-line 1) (point))))) |
17493 | 414 (nntp-accept-process-output process) |
415 (goto-char (point-min))) | |
416 (prog1 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
417 (cond |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
418 ((looking-at "[45]") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
419 (progn |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
420 (nntp-snarf-error-message) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
421 nil)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
422 ((not (memq (process-status process) '(open run))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
423 (nntp-report "Server closed connection")) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
424 (t |
17493 | 425 (goto-char (point-max)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
426 (let ((limit (point-min)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
427 response) |
17493 | 428 (while (not (re-search-backward wait-for limit t)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
429 (nntp-accept-process-output process) |
17493 | 430 ;; We assume that whatever we wait for is less than 1000 |
431 ;; characters long. | |
432 (setq limit (max (- (point-max) 1000) (point-min))) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
433 (goto-char (point-max))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
434 (setq response (match-string 0)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
435 (with-current-buffer nntp-server-buffer |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
436 (setq nntp-process-response response))) |
17493 | 437 (nntp-decode-text (not decode)) |
438 (unless discard | |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
439 (with-current-buffer buffer |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
440 (goto-char (point-max)) |
86225 | 441 (nntp-insert-buffer-substring (process-buffer process)) |
17493 | 442 ;; Nix out "nntp reading...." message. |
443 (when nntp-have-messaged | |
444 (setq nntp-have-messaged nil) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
445 (nnheader-message 5 "")))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
446 t)) |
17493 | 447 (unless discard |
448 (erase-buffer))))) | |
449 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
450 (defun nntp-kill-buffer (buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
451 (when (buffer-name buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
452 (kill-buffer buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
453 (nnheader-init-server-buffer))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
454 |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
455 (defun nntp-erase-buffer (buffer) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
456 "Erase contents of BUFFER." |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
457 (with-current-buffer buffer |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
458 (erase-buffer))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
459 |
17493 | 460 (defsubst nntp-find-connection (buffer) |
461 "Find the connection delivering to BUFFER." | |
462 (let ((alist nntp-connection-alist) | |
463 (buffer (if (stringp buffer) (get-buffer buffer) buffer)) | |
464 process entry) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
465 (while (and alist (setq entry (pop alist))) |
17493 | 466 (when (eq buffer (cadr entry)) |
467 (setq process (car entry) | |
468 alist nil))) | |
469 (when process | |
470 (if (memq (process-status process) '(open run)) | |
471 process | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
472 (nntp-kill-buffer (process-buffer process)) |
17493 | 473 (setq nntp-connection-alist (delq entry nntp-connection-alist)) |
474 nil)))) | |
475 | |
476 (defsubst nntp-find-connection-entry (buffer) | |
477 "Return the entry for the connection to BUFFER." | |
478 (assq (nntp-find-connection buffer) nntp-connection-alist)) | |
479 | |
480 (defun nntp-find-connection-buffer (buffer) | |
481 "Return the process connection buffer tied to BUFFER." | |
482 (let ((process (nntp-find-connection buffer))) | |
483 (when process | |
484 (process-buffer process)))) | |
485 | |
486 (defsubst nntp-retrieve-data (command address port buffer | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
487 &optional wait-for callback decode) |
17493 | 488 "Use COMMAND to retrieve data into BUFFER from PORT on ADDRESS." |
489 (let ((process (or (nntp-find-connection buffer) | |
490 (nntp-open-connection buffer)))) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
491 (if process |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
492 (progn |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
493 (unless (or nntp-inhibit-erase nnheader-callback-function) |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
494 (nntp-erase-buffer (process-buffer process))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
495 (condition-case err |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
496 (progn |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
497 (when command |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
498 (nntp-send-string process command)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
499 (cond |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
500 ((eq callback 'ignore) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
501 t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
502 ((and callback wait-for) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
503 (nntp-async-wait process wait-for buffer decode callback) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
504 t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
505 (wait-for |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
506 (nntp-wait-for process wait-for buffer decode)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
507 (t t))) |
67418
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65742
diff
changeset
|
508 (nntp-authinfo-rejected |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65742
diff
changeset
|
509 (signal 'nntp-authinfo-rejected (cdr err))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
510 (error |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
511 (nnheader-report 'nntp "Couldn't open connection to %s: %s" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
512 address err)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
513 (quit |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
514 (message "Quit retrieving data from nntp") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
515 (signal 'quit nil) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
516 nil))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
517 (nnheader-report 'nntp "Couldn't open connection to %s" address)))) |
17493 | 518 |
519 (defsubst nntp-send-command (wait-for &rest strings) | |
520 "Send STRINGS to server and wait until WAIT-FOR returns." | |
521 (when (and (not nnheader-callback-function) | |
522 (not nntp-inhibit-output)) | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
523 (nntp-erase-buffer nntp-server-buffer)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
524 (let* ((command (mapconcat 'identity strings " ")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
525 (process (nntp-find-connection nntp-server-buffer)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
526 (buffer (and process (process-buffer process))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
527 (pos (and buffer (with-current-buffer buffer (point))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
528 (if process |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
529 (prog1 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
530 (nntp-retrieve-data command |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
531 nntp-address nntp-port-number |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
532 nntp-server-buffer |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
533 wait-for nnheader-callback-function) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
534 ;; If nothing to wait for, still remove possibly echo'ed commands. |
76267 | 535 ;; We don't have echoes if `nntp-never-echoes-commands' is non-nil |
536 ;; or the value of `nntp-open-connection-function' is in | |
537 ;; `nntp-open-connection-functions-never-echo-commands', so we | |
538 ;; skip this in that cases. | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
539 (unless (or wait-for |
76267 | 540 nntp-never-echoes-commands |
541 (memq | |
542 nntp-open-connection-function | |
543 nntp-open-connection-functions-never-echo-commands)) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
544 (nntp-accept-response) |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
545 (with-current-buffer buffer |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
546 (goto-char pos) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
547 (if (looking-at (regexp-quote command)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
548 (delete-region pos (progn (forward-line 1) |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
549 (point-at-bol))))))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
550 (nnheader-report 'nntp "Couldn't open connection to %s." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
551 nntp-address)))) |
17493 | 552 |
553 (defun nntp-send-command-nodelete (wait-for &rest strings) | |
554 "Send STRINGS to server and wait until WAIT-FOR returns." | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
555 (let* ((command (mapconcat 'identity strings " ")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
556 (process (nntp-find-connection nntp-server-buffer)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
557 (buffer (and process (process-buffer process))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
558 (pos (and buffer (with-current-buffer buffer (point))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
559 (if process |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
560 (prog1 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
561 (nntp-retrieve-data command |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
562 nntp-address nntp-port-number |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
563 nntp-server-buffer |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
564 wait-for nnheader-callback-function) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
565 ;; If nothing to wait for, still remove possibly echo'ed commands |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
566 (unless wait-for |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
567 (nntp-accept-response) |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
568 (with-current-buffer buffer |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
569 (goto-char pos) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
570 (if (looking-at (regexp-quote command)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
571 (delete-region pos (progn (forward-line 1) |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
572 (point-at-bol))))))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
573 (nnheader-report 'nntp "Couldn't open connection to %s." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
574 nntp-address)))) |
17493 | 575 |
576 (defun nntp-send-command-and-decode (wait-for &rest strings) | |
577 "Send STRINGS to server and wait until WAIT-FOR returns." | |
578 (when (and (not nnheader-callback-function) | |
579 (not nntp-inhibit-output)) | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
580 (nntp-erase-buffer nntp-server-buffer)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
581 (let* ((command (mapconcat 'identity strings " ")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
582 (process (nntp-find-connection nntp-server-buffer)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
583 (buffer (and process (process-buffer process))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
584 (pos (and buffer (with-current-buffer buffer (point))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
585 (if process |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
586 (prog1 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
587 (nntp-retrieve-data command |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
588 nntp-address nntp-port-number |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
589 nntp-server-buffer |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
590 wait-for nnheader-callback-function t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
591 ;; If nothing to wait for, still remove possibly echo'ed commands |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
592 (unless wait-for |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
593 (nntp-accept-response) |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
594 (with-current-buffer buffer |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
595 (goto-char pos) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
596 (if (looking-at (regexp-quote command)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
597 (delete-region pos (progn (forward-line 1) (point-at-bol)))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
598 ))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
599 (nnheader-report 'nntp "Couldn't open connection to %s." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
600 nntp-address)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
601 |
17493 | 602 |
603 (defun nntp-send-buffer (wait-for) | |
604 "Send the current buffer to server and wait until WAIT-FOR returns." | |
605 (when (and (not nnheader-callback-function) | |
606 (not nntp-inhibit-output)) | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
607 (nntp-erase-buffer |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
608 (nntp-find-connection-buffer nntp-server-buffer))) |
17493 | 609 (nntp-encode-text) |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
610 ;; Make sure we did not forget to encode some of the content. |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
611 (assert (save-excursion (goto-char (point-min)) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
612 (not (re-search-forward "[^\000-\377]" nil t)))) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
613 (mm-disable-multibyte) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
614 (process-send-region (nntp-find-connection nntp-server-buffer) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
615 (point-min) (point-max)) |
17493 | 616 (nntp-retrieve-data |
617 nil nntp-address nntp-port-number nntp-server-buffer | |
618 wait-for nnheader-callback-function)) | |
619 | |
620 | |
621 | |
622 ;;; Interface functions. | |
623 | |
624 (nnoo-define-basics nntp) | |
625 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
626 (defsubst nntp-next-result-arrived-p () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
627 (cond |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
628 ;; A result that starts with a 2xx code is terminated by |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
629 ;; a line with only a "." on it. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
630 ((eq (char-after) ?2) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
631 (if (re-search-forward "\n\\.\r?\n" nil t) |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
632 (progn |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
633 ;; Some broken news servers add another dot at the end. |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
634 ;; Protect against inflooping there. |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
635 (while (looking-at "^\\.\r?\n") |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
636 (forward-line 1)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
637 t) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
638 nil)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
639 ;; A result that starts with a 3xx or 4xx code is terminated |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
640 ;; by a newline. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
641 ((looking-at "[34]") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
642 (if (search-forward "\n" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
643 t |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
644 nil)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
645 ;; No result here. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
646 (t |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
647 nil))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
648 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
649 (eval-when-compile |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
650 (defvar nntp-with-open-group-internal nil) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
651 (defvar nntp-report-n nil)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
652 |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
653 (defun nntp-with-open-group-function (-group -server -connectionless -bodyfun) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
654 "Protect against servers that don't like clients that keep idle connections opens. |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
655 The problem being that these servers may either close a connection or |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
656 simply ignore any further requests on a connection. Closed |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
657 connections are not detected until `accept-process-output' has updated |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
658 the `process-status'. Dropped connections are not detected until the |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
659 connection timeouts (which may be several minutes) or |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
660 `nntp-connection-timeout' has expired. When these occur |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
661 `nntp-with-open-group', opens a new connection then re-issues the NNTP |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
662 command whose response triggered the error." |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
663 (letf ((nntp-report-n (symbol-function 'nntp-report)) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
664 ((symbol-function 'nntp-report) (symbol-function 'nntp-report-1)) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
665 (nntp-with-open-group-internal nil)) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
666 (while (catch 'nntp-with-open-group-error |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
667 ;; Open the connection to the server |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
668 ;; NOTE: Existing connections are NOT tested. |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
669 (nntp-possibly-change-group -group -server -connectionless) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
670 |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
671 (let ((-timer |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
672 (and nntp-connection-timeout |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
673 (run-at-time |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
674 nntp-connection-timeout nil |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
675 (lambda () |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
676 (let* ((-process (nntp-find-connection |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
677 nntp-server-buffer)) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
678 (-buffer (and -process |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
679 (process-buffer -process)))) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
680 ;; When I an able to identify the |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
681 ;; connection to the server AND I've |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
682 ;; received NO reponse for |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
683 ;; nntp-connection-timeout seconds. |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
684 (when (and -buffer (eq 0 (buffer-size -buffer))) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
685 ;; Close the connection. Take no |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
686 ;; other action as the accept input |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
687 ;; code will handle the closed |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
688 ;; connection. |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
689 (nntp-kill-buffer -buffer)))))))) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
690 (unwind-protect |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
691 (setq nntp-with-open-group-internal |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
692 (condition-case nil |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
693 (funcall -bodyfun) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
694 (quit |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
695 (unless debug-on-quit |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
696 (nntp-close-server)) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
697 (signal 'quit nil)))) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
698 (when -timer |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
699 (nnheader-cancel-timer -timer))) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
700 nil)) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
701 (setf (symbol-function 'nntp-report) nntp-report-n)) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
702 nntp-with-open-group-internal)) |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
703 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
704 (defmacro nntp-with-open-group (group server &optional connectionless &rest forms) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
705 "Protect against servers that don't like clients that keep idle connections opens. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
706 The problem being that these servers may either close a connection or |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
707 simply ignore any further requests on a connection. Closed |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
708 connections are not detected until `accept-process-output' has updated |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
709 the `process-status'. Dropped connections are not detected until the |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
710 connection timeouts (which may be several minutes) or |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
711 `nntp-connection-timeout' has expired. When these occur |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
712 `nntp-with-open-group', opens a new connection then re-issues the NNTP |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
713 command whose response triggered the error." |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
714 (declare (indent 2) (debug (form form [&optional symbolp] def-body))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
715 (when (and (listp connectionless) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
716 (not (eq connectionless nil))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
717 (setq forms (cons connectionless forms) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
718 connectionless nil)) |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
719 `(nntp-with-open-group-function ,group ,server ,connectionless (lambda () ,@forms))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
720 |
17493 | 721 (deffoo nntp-retrieve-headers (articles &optional group server fetch-old) |
722 "Retrieve the headers of ARTICLES." | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
723 (nntp-with-open-group |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
724 group server |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
725 (with-current-buffer (nntp-find-connection-buffer nntp-server-buffer) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
726 (erase-buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
727 (if (and (not gnus-nov-is-evil) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
728 (not nntp-nov-is-evil) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
729 (nntp-retrieve-headers-with-xover articles fetch-old)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
730 ;; We successfully retrieved the headers via XOVER. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
731 'nov |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
732 ;; XOVER didn't work, so we do it the hard, slow and inefficient |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
733 ;; way. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
734 (let ((number (length articles)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
735 (articles articles) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
736 (count 0) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
737 (received 0) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
738 (last-point (point-min)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
739 (buf (nntp-find-connection-buffer nntp-server-buffer)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
740 (nntp-inhibit-erase t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
741 article) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
742 ;; Send HEAD commands. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
743 (while (setq article (pop articles)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
744 (nntp-send-command |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
745 nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
746 "HEAD" (if (numberp article) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
747 (int-to-string article) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
748 ;; `articles' is either a list of article numbers |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
749 ;; or a list of article IDs. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
750 article)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
751 (incf count) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
752 ;; Every 400 requests we have to read the stream in |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
753 ;; order to avoid deadlocks. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
754 (when (or (null articles) ;All requests have been sent. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
755 (zerop (% count nntp-maximum-request))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
756 (nntp-accept-response) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
757 (while (progn |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
758 (set-buffer buf) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
759 (goto-char last-point) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
760 ;; Count replies. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
761 (while (nntp-next-result-arrived-p) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
762 (setq last-point (point)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
763 (incf received)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
764 (< received count)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
765 ;; If number of headers is greater than 100, give |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
766 ;; informative messages. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
767 (and (numberp nntp-large-newsgroup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
768 (> number nntp-large-newsgroup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
769 (zerop (% received 20)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
770 (nnheader-message 6 "NNTP: Receiving headers... %d%%" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
771 (/ (* received 100) number))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
772 (nntp-accept-response)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
773 (and (numberp nntp-large-newsgroup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
774 (> number nntp-large-newsgroup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
775 (nnheader-message 6 "NNTP: Receiving headers...done")) |
17493 | 776 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
777 ;; Now all of replies are received. Fold continuation lines. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
778 (nnheader-fold-continuation-lines) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
779 ;; Remove all "\r"'s. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
780 (nnheader-strip-cr) |
86225 | 781 (nntp-copy-to-buffer nntp-server-buffer (point-min) (point-max)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
782 'headers))))) |
17493 | 783 |
784 (deffoo nntp-retrieve-groups (groups &optional server) | |
785 "Retrieve group info on GROUPS." | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
786 (nntp-with-open-group |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
787 nil server |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
788 (when (nntp-find-connection-buffer nntp-server-buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
789 (catch 'done |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
790 (save-excursion |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
791 ;; Erase nntp-server-buffer before nntp-inhibit-erase. |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
792 (nntp-erase-buffer nntp-server-buffer) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
793 (set-buffer (nntp-find-connection-buffer nntp-server-buffer)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
794 ;; The first time this is run, this variable is `try'. So we |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
795 ;; try. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
796 (when (eq nntp-server-list-active-group 'try) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
797 (nntp-try-list-active (car groups))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
798 (erase-buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
799 (let ((count 0) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
800 (groups groups) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
801 (received 0) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
802 (last-point (point-min)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
803 (nntp-inhibit-erase t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
804 (buf (nntp-find-connection-buffer nntp-server-buffer)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
805 (command (if nntp-server-list-active-group |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
806 "LIST ACTIVE" "GROUP"))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
807 (while groups |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
808 ;; Timeout may have killed the buffer. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
809 (unless (gnus-buffer-live-p buf) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
810 (nnheader-report 'nntp "Connection to %s is closed." server) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
811 (throw 'done nil)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
812 ;; Send the command to the server. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
813 (nntp-send-command nil command (pop groups)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
814 (incf count) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
815 ;; Every 400 requests we have to read the stream in |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
816 ;; order to avoid deadlocks. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
817 (when (or (null groups) ;All requests have been sent. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
818 (zerop (% count nntp-maximum-request))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
819 (nntp-accept-response) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
820 (while (and (gnus-buffer-live-p buf) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
821 (progn |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
822 ;; Search `blue moon' in this file for the |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
823 ;; reason why set-buffer here. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
824 (set-buffer buf) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
825 (goto-char last-point) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
826 ;; Count replies. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
827 (while (re-search-forward "^[0-9]" nil t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
828 (incf received)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
829 (setq last-point (point)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
830 (< received count))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
831 (nntp-accept-response)))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
832 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
833 ;; Wait for the reply from the final command. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
834 (unless (gnus-buffer-live-p buf) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
835 (nnheader-report 'nntp "Connection to %s is closed." server) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
836 (throw 'done nil)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
837 (set-buffer buf) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
838 (goto-char (point-max)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
839 (re-search-backward "^[0-9]" nil t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
840 (when (looking-at "^[23]") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
841 (while (and (gnus-buffer-live-p buf) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
842 (progn |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
843 (set-buffer buf) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
844 (goto-char (point-max)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
845 (if (not nntp-server-list-active-group) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
846 (not (re-search-backward "\r?\n" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
847 (- (point) 3) t)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
848 (not (re-search-backward "^\\.\r?\n" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
849 (- (point) 4) t))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
850 (nntp-accept-response))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
851 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
852 ;; Now all replies are received. We remove CRs. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
853 (unless (gnus-buffer-live-p buf) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
854 (nnheader-report 'nntp "Connection to %s is closed." server) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
855 (throw 'done nil)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
856 (set-buffer buf) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
857 (goto-char (point-min)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
858 (while (search-forward "\r" nil t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
859 (replace-match "" t t)) |
17493 | 860 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
861 (if (not nntp-server-list-active-group) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
862 (progn |
86225 | 863 (nntp-copy-to-buffer nntp-server-buffer |
864 (point-min) (point-max)) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
865 'group) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
866 ;; We have read active entries, so we just delete the |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
867 ;; superfluous gunk. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
868 (goto-char (point-min)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
869 (while (re-search-forward "^[.2-5]" nil t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
870 (delete-region (match-beginning 0) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
871 (progn (forward-line 1) (point)))) |
86225 | 872 (nntp-copy-to-buffer nntp-server-buffer (point-min) (point-max)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
873 'active))))))) |
17493 | 874 |
875 (deffoo nntp-retrieve-articles (articles &optional group server) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
876 (nntp-with-open-group |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
877 group server |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
878 (save-excursion |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
879 (let ((number (length articles)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
880 (articles articles) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
881 (count 0) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
882 (received 0) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
883 (last-point (point-min)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
884 (buf (nntp-find-connection-buffer nntp-server-buffer)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
885 (nntp-inhibit-erase t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
886 (map (apply 'vector articles)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
887 (point 1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
888 article) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
889 (set-buffer buf) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
890 (erase-buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
891 ;; Send ARTICLE command. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
892 (while (setq article (pop articles)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
893 (nntp-send-command |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
894 nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
895 "ARTICLE" (if (numberp article) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
896 (int-to-string article) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
897 ;; `articles' is either a list of article numbers |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
898 ;; or a list of article IDs. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
899 article)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
900 (incf count) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
901 ;; Every 400 requests we have to read the stream in |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
902 ;; order to avoid deadlocks. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
903 (when (or (null articles) ;All requests have been sent. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
904 (zerop (% count nntp-maximum-request))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
905 (nntp-accept-response) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
906 (while (progn |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
907 (set-buffer buf) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
908 (goto-char last-point) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
909 ;; Count replies. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
910 (while (nntp-next-result-arrived-p) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
911 (aset map received (cons (aref map received) (point))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
912 (setq last-point (point)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
913 (incf received)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
914 (< received count)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
915 ;; If number of headers is greater than 100, give |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
916 ;; informative messages. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
917 (and (numberp nntp-large-newsgroup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
918 (> number nntp-large-newsgroup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
919 (zerop (% received 20)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
920 (nnheader-message 6 "NNTP: Receiving articles... %d%%" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
921 (/ (* received 100) number))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
922 (nntp-accept-response)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
923 (and (numberp nntp-large-newsgroup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
924 (> number nntp-large-newsgroup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
925 (nnheader-message 6 "NNTP: Receiving articles...done")) |
17493 | 926 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
927 ;; Now we have all the responses. We go through the results, |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
928 ;; wash it and copy it over to the server buffer. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
929 (set-buffer nntp-server-buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
930 (erase-buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
931 (setq last-point (point-min)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
932 (mapcar |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
933 (lambda (entry) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
934 (narrow-to-region |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
935 (setq point (goto-char (point-max))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
936 (progn |
86225 | 937 (nntp-insert-buffer-substring buf last-point (cdr entry)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
938 (point-max))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
939 (setq last-point (cdr entry)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
940 (nntp-decode-text) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
941 (widen) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
942 (cons (car entry) point)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
943 map))))) |
17493 | 944 |
945 (defun nntp-try-list-active (group) | |
946 (nntp-list-active-group group) | |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
947 (with-current-buffer nntp-server-buffer |
17493 | 948 (goto-char (point-min)) |
949 (cond ((or (eobp) | |
950 (looking-at "5[0-9]+")) | |
951 (setq nntp-server-list-active-group nil)) | |
952 (t | |
953 (setq nntp-server-list-active-group t))))) | |
954 | |
955 (deffoo nntp-list-active-group (group &optional server) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
956 "Return the active info on GROUP (which can be a regexp)." |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
957 (nntp-with-open-group |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
958 nil server |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
959 (nntp-send-command "^\\.*\r?\n" "LIST ACTIVE" group))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
960 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
961 (deffoo nntp-request-group-articles (group &optional server) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
962 "Return the list of existing articles in GROUP." |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
963 (nntp-with-open-group |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
964 nil server |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
965 (nntp-send-command "^\\.*\r?\n" "LISTGROUP" group))) |
17493 | 966 |
967 (deffoo nntp-request-article (article &optional group server buffer command) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
968 (nntp-with-open-group |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
969 group server |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
970 (when (nntp-send-command-and-decode |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
971 "\r?\n\\.\r?\n" "ARTICLE" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
972 (if (numberp article) (int-to-string article) article)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
973 (if (and buffer |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
974 (not (equal buffer nntp-server-buffer))) |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
975 (with-current-buffer nntp-server-buffer |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
976 (copy-to-buffer buffer (point-min) (point-max)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
977 (nntp-find-group-and-number group)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
978 (nntp-find-group-and-number group))))) |
17493 | 979 |
980 (deffoo nntp-request-head (article &optional group server) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
981 (nntp-with-open-group |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
982 group server |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
983 (when (nntp-send-command |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
984 "\r?\n\\.\r?\n" "HEAD" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
985 (if (numberp article) (int-to-string article) article)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
986 (prog1 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
987 (nntp-find-group-and-number group) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
988 (nntp-decode-text))))) |
17493 | 989 |
990 (deffoo nntp-request-body (article &optional group server) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
991 (nntp-with-open-group |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
992 group server |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
993 (nntp-send-command-and-decode |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
994 "\r?\n\\.\r?\n" "BODY" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
995 (if (numberp article) (int-to-string article) article)))) |
17493 | 996 |
997 (deffoo nntp-request-group (group &optional server dont-check) | |
64754
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64092
diff
changeset
|
998 (nntp-with-open-group |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
999 nil server |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1000 (when (nntp-send-command "^[245].*\n" "GROUP" group) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1001 (let ((entry (nntp-find-connection-entry nntp-server-buffer))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1002 (setcar (cddr entry) group))))) |
17493 | 1003 |
1004 (deffoo nntp-close-group (group &optional server) | |
1005 t) | |
1006 | |
1007 (deffoo nntp-server-opened (&optional server) | |
1008 "Say whether a connection to SERVER has been opened." | |
1009 (and (nnoo-current-server-p 'nntp server) | |
1010 nntp-server-buffer | |
1011 (gnus-buffer-live-p nntp-server-buffer) | |
1012 (nntp-find-connection nntp-server-buffer))) | |
1013 | |
1014 (deffoo nntp-open-server (server &optional defs connectionless) | |
1015 (nnheader-init-server-buffer) | |
1016 (if (nntp-server-opened server) | |
1017 t | |
1018 (when (or (stringp (car defs)) | |
1019 (numberp (car defs))) | |
1020 (setq defs (cons (list 'nntp-port-number (car defs)) (cdr defs)))) | |
1021 (unless (assq 'nntp-address defs) | |
1022 (setq defs (append defs (list (list 'nntp-address server))))) | |
1023 (nnoo-change-server 'nntp server defs) | |
1024 (unless connectionless | |
1025 (or (nntp-find-connection nntp-server-buffer) | |
1026 (nntp-open-connection nntp-server-buffer))))) | |
1027 | |
1028 (deffoo nntp-close-server (&optional server) | |
1029 (nntp-possibly-change-group nil server t) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1030 (let ((process (nntp-find-connection nntp-server-buffer))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1031 (while process |
17493 | 1032 (when (memq (process-status process) '(open run)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1033 (ignore-errors |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1034 (nntp-send-string process "QUIT") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1035 (unless (eq nntp-open-connection-function 'nntp-open-network-stream) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1036 ;; Ok, this is evil, but when using telnet and stuff |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1037 ;; as the connection method, it's important that the |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1038 ;; QUIT command actually is sent out before we kill |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1039 ;; the process. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1040 (sleep-for 1)))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1041 (nntp-kill-buffer (process-buffer process)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1042 (setq process (car (pop nntp-connection-alist)))) |
17493 | 1043 (nnoo-close-server 'nntp))) |
1044 | |
1045 (deffoo nntp-request-close () | |
1046 (let (process) | |
1047 (while (setq process (pop nntp-connection-list)) | |
1048 (when (memq (process-status process) '(open run)) | |
1049 (ignore-errors | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1050 (nntp-send-string process "QUIT") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1051 (unless (eq nntp-open-connection-function 'nntp-open-network-stream) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1052 ;; Ok, this is evil, but when using telnet and stuff |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1053 ;; as the connection method, it's important that the |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1054 ;; QUIT command actually is sent out before we kill |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1055 ;; the process. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1056 (sleep-for 1)))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1057 (nntp-kill-buffer (process-buffer process))))) |
17493 | 1058 |
1059 (deffoo nntp-request-list (&optional server) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1060 (nntp-with-open-group |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1061 nil server |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1062 (nntp-send-command-and-decode "\r?\n\\.\r?\n" "LIST"))) |
17493 | 1063 |
1064 (deffoo nntp-request-list-newsgroups (&optional server) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1065 (nntp-with-open-group |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1066 nil server |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1067 (nntp-send-command "\r?\n\\.\r?\n" "LIST NEWSGROUPS"))) |
17493 | 1068 |
1069 (deffoo nntp-request-newgroups (date &optional server) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1070 (nntp-with-open-group |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1071 nil server |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1072 (with-current-buffer nntp-server-buffer |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1073 (let* ((time (date-to-time date)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1074 (ls (- (cadr time) (nth 8 (decode-time time))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1075 (cond ((< ls 0) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1076 (setcar time (1- (car time))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1077 (setcar (cdr time) (+ ls 65536))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1078 ((>= ls 65536) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1079 (setcar time (1+ (car time))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1080 (setcar (cdr time) (- ls 65536))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1081 (t |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1082 (setcar (cdr time) ls))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1083 (prog1 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1084 (nntp-send-command |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1085 "^\\.\r?\n" "NEWGROUPS" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1086 (format-time-string "%y%m%d %H%M%S" time) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1087 "GMT") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1088 (nntp-decode-text)))))) |
17493 | 1089 |
1090 (deffoo nntp-request-post (&optional server) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1091 (nntp-with-open-group |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1092 nil server |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1093 (when (nntp-send-command "^[23].*\r?\n" "POST") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1094 (let ((response (with-current-buffer nntp-server-buffer |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1095 nntp-process-response)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1096 server-id) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1097 (when (and response |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1098 (string-match "^[23].*\\(<[^\t\n @<>]+@[^\t\n @<>]+>\\)" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1099 response)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1100 (setq server-id (match-string 1 response)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1101 (narrow-to-region (goto-char (point-min)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1102 (if (search-forward "\n\n" nil t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1103 (1- (point)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1104 (point-max))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1105 (unless (mail-fetch-field "Message-ID") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1106 (goto-char (point-min)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1107 (insert "Message-ID: " server-id "\n")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1108 (widen)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1109 (run-hooks 'nntp-prepare-post-hook) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1110 (nntp-send-buffer "^[23].*\n"))))) |
17493 | 1111 |
1112 (deffoo nntp-request-type (group article) | |
1113 'news) | |
1114 | |
1115 (deffoo nntp-asynchronous-p () | |
1116 t) | |
1117 | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1118 (deffoo nntp-request-set-mark (group actions &optional server) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1119 (unless nntp-marks-is-evil |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1120 (nntp-possibly-create-directory group server) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1121 (nntp-open-marks group server) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1122 (dolist (action actions) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1123 (let ((range (nth 0 action)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1124 (what (nth 1 action)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1125 (marks (nth 2 action))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1126 (assert (or (eq what 'add) (eq what 'del)) nil |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1127 "Unknown request-set-mark action: %s" what) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1128 (dolist (mark marks) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1129 (setq nntp-marks (gnus-update-alist-soft |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1130 mark |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1131 (funcall (if (eq what 'add) 'gnus-range-add |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1132 'gnus-remove-from-range) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1133 (cdr (assoc mark nntp-marks)) range) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1134 nntp-marks))))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1135 (nntp-save-marks group server)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1136 nil) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1137 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1138 (deffoo nntp-request-update-info (group info &optional server) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1139 (unless nntp-marks-is-evil |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1140 (nntp-possibly-create-directory group server) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1141 (when (nntp-marks-changed-p group server) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1142 (nnheader-message 8 "Updating marks for %s..." group) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1143 (nntp-open-marks group server) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1144 ;; Update info using `nntp-marks'. |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1145 (mapc (lambda (pred) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1146 (unless (memq (cdr pred) gnus-article-unpropagated-mark-lists) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1147 (gnus-info-set-marks |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1148 info |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1149 (gnus-update-alist-soft |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1150 (cdr pred) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1151 (cdr (assq (cdr pred) nntp-marks)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1152 (gnus-info-marks info)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1153 t))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1154 gnus-article-mark-lists) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1155 (let ((seen (cdr (assq 'read nntp-marks)))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1156 (gnus-info-set-read info |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1157 (if (and (integerp (car seen)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1158 (null (cdr seen))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1159 (list (cons (car seen) (car seen))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1160 seen))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1161 (nnheader-message 8 "Updating marks for %s...done" group))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1162 nil) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1163 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1164 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1165 |
17493 | 1166 ;;; Hooky functions. |
1167 | |
1168 (defun nntp-send-mode-reader () | |
1169 "Send the MODE READER command to the nntp server. | |
1170 This function is supposed to be called from `nntp-server-opened-hook'. | |
1171 It will make innd servers spawn an nnrpd process to allow actual article | |
1172 reading." | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1173 (nntp-send-command "^.*\n" "MODE READER")) |
17493 | 1174 |
107427
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
1175 (declare-function netrc-parse "netrc" (file)) |
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
1176 (declare-function netrc-machine "netrc" |
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
1177 (list machine &optional port defaultport)) |
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
1178 (declare-function netrc-get "netrc" (alist type)) |
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
1179 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1180 (defun nntp-send-authinfo (&optional send-if-force) |
17493 | 1181 "Send the AUTHINFO to the nntp server. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1182 It will look in the \"~/.authinfo\" file for matching entries. If |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1183 nothing suitable is found there, it will prompt for a user name |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1184 and a password. |
17493 | 1185 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1186 If SEND-IF-FORCE, only send authinfo to the server if the |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1187 .authinfo file has the FORCE token." |
107427
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
1188 (require 'netrc) |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1189 (let* ((list (netrc-parse nntp-authinfo-file)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1190 (alist (netrc-machine list nntp-address "nntp")) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1191 (force (or (netrc-get alist "force") nntp-authinfo-force)) |
107427
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
1192 (auth-info |
101804 | 1193 (auth-source-user-or-password '("login" "password") nntp-address "nntp")) |
1194 (auth-user (nth 0 auth-info)) | |
1195 (auth-passwd (nth 1 auth-info)) | |
95820
645fb33380d6
Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents:
94837
diff
changeset
|
1196 (user (or |
94837 | 1197 ;; this is preferred to netrc-* |
101804 | 1198 auth-user |
95820
645fb33380d6
Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents:
94837
diff
changeset
|
1199 (netrc-get alist "login") |
94837 | 1200 nntp-authinfo-user)) |
1201 (passwd (or | |
1202 ;; this is preferred to netrc-* | |
101804 | 1203 auth-passwd |
94837 | 1204 (netrc-get alist "password")))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1205 (when (or (not send-if-force) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1206 force) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1207 (unless user |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1208 (setq user (read-string (format "NNTP (%s) user name: " nntp-address)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1209 nntp-authinfo-user user)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1210 (unless (member user '(nil "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1211 (nntp-send-command "^3.*\r?\n" "AUTHINFO USER" user) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1212 (when t ;???Should check if AUTHINFO succeeded |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1213 (nntp-send-command |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1214 "^2.*\r?\n" "AUTHINFO PASS" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1215 (or passwd |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1216 nntp-authinfo-password |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1217 (setq nntp-authinfo-password |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1218 (read-passwd (format "NNTP (%s@%s) password: " |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1219 user nntp-address)))))))))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1220 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1221 (defun nntp-send-nosy-authinfo () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1222 "Send the AUTHINFO to the nntp server." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1223 (let ((user (read-string (format "NNTP (%s) user name: " nntp-address)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1224 (unless (member user '(nil "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1225 (nntp-send-command "^3.*\r?\n" "AUTHINFO USER" user) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1226 (when t ;???Should check if AUTHINFO succeeded |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1227 (nntp-send-command "^2.*\r?\n" "AUTHINFO PASS" |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1228 (read-passwd (format "NNTP (%s@%s) password: " |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1229 user nntp-address))))))) |
17493 | 1230 |
1231 (defun nntp-send-authinfo-from-file () | |
1232 "Send the AUTHINFO to the nntp server. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1233 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1234 The authinfo login name is taken from the user's login name and the |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1235 password contained in '~/.nntp-authinfo'." |
17493 | 1236 (when (file-exists-p "~/.nntp-authinfo") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1237 (with-temp-buffer |
17493 | 1238 (insert-file-contents "~/.nntp-authinfo") |
1239 (goto-char (point-min)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1240 (nntp-send-command "^3.*\r?\n" "AUTHINFO USER" (user-login-name)) |
17493 | 1241 (nntp-send-command |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1242 "^2.*\r?\n" "AUTHINFO PASS" |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1243 (buffer-substring (point) (point-at-eol)))))) |
17493 | 1244 |
1245 ;;; Internal functions. | |
1246 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1247 (defun nntp-handle-authinfo (process) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1248 "Take care of an authinfo response from the server." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1249 (let ((last nntp-last-command)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1250 (funcall nntp-authinfo-function) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1251 ;; We have to re-send the function that was interrupted by |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1252 ;; the authinfo request. |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1253 (nntp-erase-buffer nntp-server-buffer) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1254 (nntp-send-string process last))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1255 |
17493 | 1256 (defun nntp-make-process-buffer (buffer) |
1257 "Create a new, fresh buffer usable for nntp process connections." | |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1258 (with-current-buffer |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1259 (generate-new-buffer |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1260 (format " *server %s %s %s*" |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1261 nntp-address nntp-port-number |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1262 (gnus-buffer-exists-p buffer))) |
86225 | 1263 (mm-disable-multibyte) |
17493 | 1264 (set (make-local-variable 'after-change-functions) nil) |
1265 (set (make-local-variable 'nntp-process-wait-for) nil) | |
1266 (set (make-local-variable 'nntp-process-callback) nil) | |
1267 (set (make-local-variable 'nntp-process-to-buffer) nil) | |
1268 (set (make-local-variable 'nntp-process-start-point) nil) | |
1269 (set (make-local-variable 'nntp-process-decode) nil) | |
1270 (current-buffer))) | |
1271 | |
1272 (defun nntp-open-connection (buffer) | |
1273 "Open a connection to PORT on ADDRESS delivering output to BUFFER." | |
1274 (run-hooks 'nntp-prepare-server-hook) | |
1275 (let* ((pbuffer (nntp-make-process-buffer buffer)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1276 (timer |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1277 (and nntp-connection-timeout |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1278 (run-at-time |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1279 nntp-connection-timeout nil |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1280 `(lambda () |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1281 (nntp-kill-buffer ,pbuffer))))) |
17493 | 1282 (process |
1283 (condition-case () | |
19992
36e81448237d
(nntp-coding-system-for-write): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
1284 (let ((coding-system-for-read nntp-coding-system-for-read) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1285 (coding-system-for-write nntp-coding-system-for-write)) |
19598
611e0de24d43
(nntp-coding-system-for-read): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17493
diff
changeset
|
1286 (funcall nntp-open-connection-function pbuffer)) |
17493 | 1287 (error nil) |
33575
93288a69f66f
2000-11-17 Katsumi Yamaoka <yamaoka@jpl.org>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1288 (quit |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1289 (message "Quit opening connection to %s" nntp-address) |
33575
93288a69f66f
2000-11-17 Katsumi Yamaoka <yamaoka@jpl.org>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1290 (nntp-kill-buffer pbuffer) |
93288a69f66f
2000-11-17 Katsumi Yamaoka <yamaoka@jpl.org>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1291 (signal 'quit nil) |
93288a69f66f
2000-11-17 Katsumi Yamaoka <yamaoka@jpl.org>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1292 nil)))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1293 (when timer |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1294 (nnheader-cancel-timer timer)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1295 (unless process |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1296 (nntp-kill-buffer pbuffer)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1297 (when (and (buffer-name pbuffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1298 process) |
62943
11d53dd5abd9
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-345
Miles Bader <miles@gnu.org>
parents:
62907
diff
changeset
|
1299 (gnus-set-process-query-on-exit-flag process nil) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1300 (if (and (nntp-wait-for process "^2.*\n" buffer nil t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1301 (memq (process-status process) '(open run))) |
17493 | 1302 (prog1 |
1303 (caar (push (list process buffer nil) nntp-connection-alist)) | |
1304 (push process nntp-connection-list) | |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1305 (with-current-buffer pbuffer |
17493 | 1306 (nntp-read-server-type) |
1307 (erase-buffer) | |
1308 (set-buffer nntp-server-buffer) | |
1309 (let ((nnheader-callback-function nil)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1310 (run-hooks 'nntp-server-opened-hook) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1311 (nntp-send-authinfo t)))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1312 (nntp-kill-buffer (process-buffer process)) |
17493 | 1313 nil)))) |
1314 | |
1315 (defun nntp-open-network-stream (buffer) | |
1316 (open-network-stream "nntpd" buffer nntp-address nntp-port-number)) | |
1317 | |
95820
645fb33380d6
Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents:
94837
diff
changeset
|
1318 (autoload 'format-spec "format-spec") |
645fb33380d6
Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents:
94837
diff
changeset
|
1319 (autoload 'format-spec-make "format-spec") |
645fb33380d6
Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents:
94837
diff
changeset
|
1320 (autoload 'open-tls-stream "tls") |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1321 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1322 (defun nntp-open-ssl-stream (buffer) |
49993
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49725
diff
changeset
|
1323 (let* ((process-connection-type nil) |
64754
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64092
diff
changeset
|
1324 (proc (start-process "nntpd" buffer |
49993
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49725
diff
changeset
|
1325 shell-file-name |
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49725
diff
changeset
|
1326 shell-command-switch |
64754
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64092
diff
changeset
|
1327 (format-spec nntp-ssl-program |
49993
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49725
diff
changeset
|
1328 (format-spec-make |
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49725
diff
changeset
|
1329 ?s nntp-address |
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49725
diff
changeset
|
1330 ?p nntp-port-number))))) |
62943
11d53dd5abd9
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-345
Miles Bader <miles@gnu.org>
parents:
62907
diff
changeset
|
1331 (gnus-set-process-query-on-exit-flag proc nil) |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1332 (with-current-buffer buffer |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1333 (let ((nntp-connection-alist (list proc buffer nil))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1334 (nntp-wait-for-string "^\r*20[01]")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1335 (beginning-of-line) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1336 (delete-region (point-min) (point)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1337 proc))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1338 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1339 (defun nntp-open-tls-stream (buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1340 (let ((proc (open-tls-stream "nntpd" buffer nntp-address nntp-port-number))) |
62943
11d53dd5abd9
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-345
Miles Bader <miles@gnu.org>
parents:
62907
diff
changeset
|
1341 (gnus-set-process-query-on-exit-flag proc nil) |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1342 (with-current-buffer buffer |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1343 (let ((nntp-connection-alist (list proc buffer nil))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1344 (nntp-wait-for-string "^\r*20[01]")) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1345 (beginning-of-line) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1346 (delete-region (point-min) (point)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1347 proc))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1348 |
17493 | 1349 (defun nntp-read-server-type () |
1350 "Find out what the name of the server we have connected to is." | |
1351 ;; Wait for the status string to arrive. | |
1352 (setq nntp-server-type (buffer-string)) | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1353 (let ((case-fold-search t)) |
17493 | 1354 ;; Run server-specific commands. |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1355 (dolist (entry nntp-server-action-alist) |
17493 | 1356 (when (string-match (car entry) nntp-server-type) |
1357 (if (and (listp (cadr entry)) | |
1358 (not (eq 'lambda (caadr entry)))) | |
1359 (eval (cadr entry)) | |
1360 (funcall (cadr entry))))))) | |
1361 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1362 (defun nntp-async-wait (process wait-for buffer decode callback) |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1363 (with-current-buffer (process-buffer process) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1364 (unless nntp-inside-change-function |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1365 (erase-buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1366 (setq nntp-process-wait-for wait-for |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1367 nntp-process-to-buffer buffer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1368 nntp-process-decode decode |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1369 nntp-process-callback callback |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1370 nntp-process-start-point (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1371 (setq after-change-functions '(nntp-after-change-function)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1372 (if nntp-async-needs-kluge |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1373 (nntp-async-kluge process)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1374 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1375 (defun nntp-async-kluge (process) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1376 ;; emacs 20.3 bug: process output with encoding 'binary |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1377 ;; doesn't trigger after-change-functions. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1378 (unless nntp-async-timer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1379 (setq nntp-async-timer |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1380 (run-at-time 1 1 'nntp-async-timer-handler))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1381 (add-to-list 'nntp-async-process-list process)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1382 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1383 (defun nntp-async-timer-handler () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1384 (mapcar |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1385 (lambda (proc) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1386 (if (memq (process-status proc) '(open run)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1387 (nntp-async-trigger proc) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1388 (nntp-async-stop proc))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1389 nntp-async-process-list)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1390 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1391 (defun nntp-async-stop (proc) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1392 (setq nntp-async-process-list (delq proc nntp-async-process-list)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1393 (when (and nntp-async-timer (not nntp-async-process-list)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1394 (nnheader-cancel-timer nntp-async-timer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1395 (setq nntp-async-timer nil))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1396 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1397 (defun nntp-after-change-function (beg end len) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1398 (unwind-protect |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1399 ;; we only care about insertions at eob |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1400 (when (and (eq 0 len) (eq (point-max) end)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1401 (save-match-data |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1402 (let ((proc (get-buffer-process (current-buffer)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1403 (when proc |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1404 (nntp-async-trigger proc))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1405 ;; any throw from after-change-functions will leave it |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1406 ;; set to nil. so we reset it here, if necessary. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1407 (when quit-flag |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1408 (setq after-change-functions '(nntp-after-change-function))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1409 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1410 (defun nntp-async-trigger (process) |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1411 (with-current-buffer (process-buffer process) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1412 (when nntp-process-callback |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1413 ;; do we have an error message? |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1414 (goto-char nntp-process-start-point) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1415 (if (memq (following-char) '(?4 ?5)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1416 ;; wants credentials? |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1417 (if (looking-at "480") |
33575
93288a69f66f
2000-11-17 Katsumi Yamaoka <yamaoka@jpl.org>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1418 (nntp-handle-authinfo process) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1419 ;; report error message. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1420 (nntp-snarf-error-message) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1421 (nntp-do-callback nil)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1422 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1423 ;; got what we expect? |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1424 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1425 (when (re-search-backward |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1426 nntp-process-wait-for nntp-process-start-point t) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1427 (let ((response (match-string 0))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1428 (with-current-buffer nntp-server-buffer |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1429 (setq nntp-process-response response))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1430 (nntp-async-stop process) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1431 ;; convert it. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1432 (when (gnus-buffer-exists-p nntp-process-to-buffer) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1433 (let ((buf (current-buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1434 (start nntp-process-start-point) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1435 (decode nntp-process-decode)) |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1436 (with-current-buffer nntp-process-to-buffer |
17493 | 1437 (goto-char (point-max)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1438 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1439 (narrow-to-region (point) (point)) |
86225 | 1440 (nntp-insert-buffer-substring buf start) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1441 (when decode |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1442 (nntp-decode-text)))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1443 ;; report it. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1444 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1445 (nntp-do-callback |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1446 (buffer-name (get-buffer nntp-process-to-buffer)))))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1447 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1448 (defun nntp-do-callback (arg) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1449 (let ((callback nntp-process-callback) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1450 (nntp-inside-change-function t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1451 (setq nntp-process-callback nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1452 (funcall callback arg))) |
17493 | 1453 |
1454 (defun nntp-snarf-error-message () | |
1455 "Save the error message in the current buffer." | |
1456 (let ((message (buffer-string))) | |
1457 (while (string-match "[\r\n]+" message) | |
1458 (setq message (replace-match " " t t message))) | |
1459 (nnheader-report 'nntp message) | |
1460 message)) | |
1461 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1462 (defun nntp-accept-process-output (process) |
17493 | 1463 "Wait for output from PROCESS and message some dots." |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1464 (with-current-buffer (or (nntp-find-connection-buffer nntp-server-buffer) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1465 nntp-server-buffer) |
49725
f13275d94b11
(nntp-accept-process-output): Don't use point-max to get the buffer's size.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49598
diff
changeset
|
1466 (let ((len (/ (buffer-size) 1024)) |
17493 | 1467 message-log-max) |
1468 (unless (< len 10) | |
1469 (setq nntp-have-messaged t) | |
1470 (nnheader-message 7 "nntp read: %dk" len))) | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1471 (prog1 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1472 (nnheader-accept-process-output process) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1473 ;; accept-process-output may update status of process to indicate |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1474 ;; that the server has closed the connection. This MUST be |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1475 ;; handled here as the buffer restored by the save-excursion may |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1476 ;; be the process's former output buffer (i.e. now killed) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1477 (or (and process |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1478 (memq (process-status process) '(open run))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1479 (nntp-report "Server closed connection"))))) |
17493 | 1480 |
1481 (defun nntp-accept-response () | |
1482 "Wait for output from the process that outputs to BUFFER." | |
1483 (nntp-accept-process-output (nntp-find-connection nntp-server-buffer))) | |
1484 | |
1485 (defun nntp-possibly-change-group (group server &optional connectionless) | |
1486 (let ((nnheader-callback-function nil)) | |
1487 (when server | |
1488 (or (nntp-server-opened server) | |
1489 (nntp-open-server server nil connectionless))) | |
1490 | |
1491 (unless connectionless | |
1492 (or (nntp-find-connection nntp-server-buffer) | |
1493 (nntp-open-connection nntp-server-buffer)))) | |
1494 | |
1495 (when group | |
1496 (let ((entry (nntp-find-connection-entry nntp-server-buffer))) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1497 (cond ((not entry) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1498 (nntp-report "Server closed connection")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1499 ((not (equal group (caddr entry))) |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1500 (with-current-buffer (process-buffer (car entry)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1501 (erase-buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1502 (nntp-send-command "^[245].*\n" "GROUP" group) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1503 (setcar (cddr entry) group) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1504 (erase-buffer) |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1505 (nntp-erase-buffer nntp-server-buffer))))))) |
17493 | 1506 |
1507 (defun nntp-decode-text (&optional cr-only) | |
1508 "Decode the text in the current buffer." | |
1509 (goto-char (point-min)) | |
1510 (while (search-forward "\r" nil t) | |
1511 (delete-char -1)) | |
1512 (unless cr-only | |
1513 ;; Remove trailing ".\n" end-of-transfer marker. | |
1514 (goto-char (point-max)) | |
1515 (forward-line -1) | |
1516 (when (looking-at ".\n") | |
1517 (delete-char 2)) | |
1518 ;; Delete status line. | |
1519 (goto-char (point-min)) | |
33575
93288a69f66f
2000-11-17 Katsumi Yamaoka <yamaoka@jpl.org>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1520 (while (looking-at "[1-5][0-9][0-9] .*\n") |
93288a69f66f
2000-11-17 Katsumi Yamaoka <yamaoka@jpl.org>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1521 ;; For some unknown reason, there is more than one status line. |
93288a69f66f
2000-11-17 Katsumi Yamaoka <yamaoka@jpl.org>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1522 (delete-region (point) (progn (forward-line 1) (point)))) |
17493 | 1523 ;; Remove "." -> ".." encoding. |
1524 (while (search-forward "\n.." nil t) | |
1525 (delete-char -1)))) | |
1526 | |
1527 (defun nntp-encode-text () | |
1528 "Encode the text in the current buffer." | |
1529 (save-excursion | |
1530 ;; Replace "." at beginning of line with "..". | |
1531 (goto-char (point-min)) | |
1532 (while (re-search-forward "^\\." nil t) | |
1533 (insert ".")) | |
1534 (goto-char (point-max)) | |
1535 ;; Insert newline at the end of the buffer. | |
1536 (unless (bolp) | |
1537 (insert "\n")) | |
1538 ;; Insert `.' at end of buffer (end of text mark). | |
1539 (goto-char (point-max)) | |
23010
196f32d1873f
(nntp-encode-text): Properly encode outgoing text by
Richard M. Stallman <rms@gnu.org>
parents:
20236
diff
changeset
|
1540 (insert ".\n") |
196f32d1873f
(nntp-encode-text): Properly encode outgoing text by
Richard M. Stallman <rms@gnu.org>
parents:
20236
diff
changeset
|
1541 (goto-char (point-min)) |
196f32d1873f
(nntp-encode-text): Properly encode outgoing text by
Richard M. Stallman <rms@gnu.org>
parents:
20236
diff
changeset
|
1542 (while (not (eobp)) |
196f32d1873f
(nntp-encode-text): Properly encode outgoing text by
Richard M. Stallman <rms@gnu.org>
parents:
20236
diff
changeset
|
1543 (end-of-line) |
196f32d1873f
(nntp-encode-text): Properly encode outgoing text by
Richard M. Stallman <rms@gnu.org>
parents:
20236
diff
changeset
|
1544 (delete-char 1) |
196f32d1873f
(nntp-encode-text): Properly encode outgoing text by
Richard M. Stallman <rms@gnu.org>
parents:
20236
diff
changeset
|
1545 (insert nntp-end-of-line)))) |
17493 | 1546 |
1547 (defun nntp-retrieve-headers-with-xover (articles &optional fetch-old) | |
1548 (set-buffer nntp-server-buffer) | |
1549 (erase-buffer) | |
1550 (cond | |
1551 | |
1552 ;; This server does not talk NOV. | |
1553 ((not nntp-server-xover) | |
1554 nil) | |
1555 | |
1556 ;; We don't care about gaps. | |
1557 ((or (not nntp-nov-gap) | |
1558 fetch-old) | |
1559 (nntp-send-xover-command | |
1560 (if fetch-old | |
1561 (if (numberp fetch-old) | |
1562 (max 1 (- (car articles) fetch-old)) | |
1563 1) | |
1564 (car articles)) | |
1565 (car (last articles)) 'wait) | |
1566 | |
1567 (goto-char (point-min)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1568 (when (looking-at "[1-5][0-9][0-9] .*\n") |
17493 | 1569 (delete-region (point) (progn (forward-line 1) (point)))) |
1570 (while (search-forward "\r" nil t) | |
1571 (replace-match "" t t)) | |
1572 (goto-char (point-max)) | |
1573 (forward-line -1) | |
1574 (when (looking-at "\\.") | |
1575 (delete-region (point) (progn (forward-line 1) (point))))) | |
1576 | |
1577 ;; We do it the hard way. For each gap, an XOVER command is sent | |
1578 ;; to the server. We do not wait for a reply from the server, we | |
1579 ;; just send them off as fast as we can. That means that we have | |
1580 ;; to count the number of responses we get back to find out when we | |
1581 ;; have gotten all we asked for. | |
1582 ((numberp nntp-nov-gap) | |
1583 (let ((count 0) | |
1584 (received 0) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1585 last-point |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1586 in-process-buffer-p |
17493 | 1587 (buf nntp-server-buffer) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1588 (process-buffer (nntp-find-connection-buffer nntp-server-buffer)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1589 first last status) |
17493 | 1590 ;; We have to check `nntp-server-xover'. If it gets set to nil, |
1591 ;; that means that the server does not understand XOVER, but we | |
1592 ;; won't know that until we try. | |
1593 (while (and nntp-server-xover articles) | |
1594 (setq first (car articles)) | |
1595 ;; Search forward until we find a gap, or until we run out of | |
1596 ;; articles. | |
1597 (while (and (cdr articles) | |
1598 (< (- (nth 1 articles) (car articles)) nntp-nov-gap)) | |
1599 (setq articles (cdr articles))) | |
1600 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1601 (setq in-process-buffer-p (stringp nntp-server-xover)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1602 (nntp-send-xover-command first (setq last (car articles))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1603 (setq articles (cdr articles)) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
42628
diff
changeset
|
1604 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1605 (when (and nntp-server-xover in-process-buffer-p) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1606 ;; Don't count tried request. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1607 (setq count (1+ count)) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
42628
diff
changeset
|
1608 |
17493 | 1609 ;; Every 400 requests we have to read the stream in |
1610 ;; order to avoid deadlocks. | |
1611 (when (or (null articles) ;All requests have been sent. | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1612 (= 1 (% count nntp-maximum-request))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1613 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1614 (nntp-accept-response) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1615 ;; On some Emacs versions the preceding function has a |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1616 ;; tendency to change the buffer. Perhaps. It's quite |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1617 ;; difficult to reproduce, because it only seems to happen |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1618 ;; once in a blue moon. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1619 (set-buffer process-buffer) |
17493 | 1620 (while (progn |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1621 (goto-char (or last-point (point-min))) |
17493 | 1622 ;; Count replies. |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1623 (while (re-search-forward "^\\([0-9][0-9][0-9]\\) .*\n" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1624 nil t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1625 (incf received) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1626 (setq status (match-string 1)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1627 (if (string-match "^[45]" status) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1628 (setq status 'error) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1629 (setq status 'ok))) |
17493 | 1630 (setq last-point (point)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1631 (or (< received count) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1632 (if (eq status 'error) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1633 nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1634 ;; I haven't started reading the final response |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1635 (progn |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1636 (goto-char (point-max)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1637 (forward-line -1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1638 (not (looking-at "^\\.\r?\n")))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1639 ;; I haven't read the end of the final response |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1640 (nntp-accept-response) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1641 (set-buffer process-buffer)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1642 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1643 ;; Some nntp servers seem to have an extension to the XOVER |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1644 ;; extension. On these servers, requesting an article range |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1645 ;; preceeding the active range does not return an error as |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1646 ;; specified in the RFC. What we instead get is the NOV entry |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1647 ;; for the first available article. Obviously, a client can |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1648 ;; use that entry to avoid making unnecessary requests. The |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1649 ;; only problem is for a client that assumes that the response |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1650 ;; will always be within the requested ranage. For such a |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1651 ;; client, we can get N copies of the same entry (one for each |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1652 ;; XOVER command sent to the server). |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1653 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1654 (when (<= count 1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1655 (goto-char (point-min)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1656 (when (re-search-forward "^[0-9][0-9][0-9] .*\n\\([0-9]+\\)" nil t) |
62907
88db2adda4b7
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-339
Miles Bader <miles@gnu.org>
parents:
62428
diff
changeset
|
1657 (let ((low-limit (string-to-number |
64754
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64092
diff
changeset
|
1658 (buffer-substring (match-beginning 1) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1659 (match-end 1))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1660 (while (and articles (<= (car articles) low-limit)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1661 (setq articles (cdr articles)))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1662 (set-buffer buf)) |
17493 | 1663 |
1664 (when nntp-server-xover | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1665 (when in-process-buffer-p |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1666 (set-buffer buf) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1667 (goto-char (point-max)) |
86225 | 1668 (nntp-insert-buffer-substring process-buffer) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1669 (set-buffer process-buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1670 (erase-buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1671 (set-buffer buf)) |
17493 | 1672 |
1673 ;; We remove any "." lines and status lines. | |
1674 (goto-char (point-min)) | |
1675 (while (search-forward "\r" nil t) | |
1676 (delete-char -1)) | |
1677 (goto-char (point-min)) | |
1678 (delete-matching-lines "^\\.$\\|^[1-5][0-9][0-9] ") | |
1679 t)))) | |
1680 | |
1681 nntp-server-xover) | |
1682 | |
1683 (defun nntp-send-xover-command (beg end &optional wait-for-reply) | |
1684 "Send the XOVER command to the server." | |
1685 (let ((range (format "%d-%d" beg end)) | |
1686 (nntp-inhibit-erase t)) | |
1687 (if (stringp nntp-server-xover) | |
1688 ;; If `nntp-server-xover' is a string, then we just send this | |
1689 ;; command. | |
1690 (if wait-for-reply | |
1691 (nntp-send-command-nodelete | |
1692 "\r?\n\\.\r?\n" nntp-server-xover range) | |
1693 ;; We do not wait for the reply. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1694 (nntp-send-command-nodelete nil nntp-server-xover range)) |
17493 | 1695 (let ((commands nntp-xover-commands)) |
1696 ;; `nntp-xover-commands' is a list of possible XOVER commands. | |
1697 ;; We try them all until we get at positive response. | |
1698 (while (and commands (eq nntp-server-xover 'try)) | |
1699 (nntp-send-command-nodelete "\r?\n\\.\r?\n" (car commands) range) | |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1700 (with-current-buffer nntp-server-buffer |
17493 | 1701 (goto-char (point-min)) |
1702 (and (looking-at "[23]") ; No error message. | |
1703 ;; We also have to look at the lines. Some buggy | |
1704 ;; servers give back simple lines with just the | |
1705 ;; article number. How... helpful. | |
1706 (progn | |
1707 (forward-line 1) | |
78013 | 1708 ;; More text after number, or a dot. |
1709 (looking-at "[0-9]+\t...\\|\\.\r?\n")) | |
17493 | 1710 (setq nntp-server-xover (car commands)))) |
1711 (setq commands (cdr commands))) | |
1712 ;; If none of the commands worked, we disable XOVER. | |
1713 (when (eq nntp-server-xover 'try) | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1714 (nntp-erase-buffer nntp-server-buffer) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1715 (setq nntp-server-xover nil)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1716 nntp-server-xover)))) |
17493 | 1717 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1718 (defun nntp-find-group-and-number (&optional group) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1719 (save-excursion |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1720 (save-restriction |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1721 ;; FIXME: This is REALLY FISHY: set-buffer after save-restriction?!? |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1722 (set-buffer nntp-server-buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1723 (narrow-to-region (goto-char (point-min)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1724 (or (search-forward "\n\n" nil t) (point-max))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1725 (goto-char (point-min)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1726 ;; We first find the number by looking at the status line. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1727 (let ((number (and (looking-at "2[0-9][0-9] +\\([0-9]+\\) ") |
62907
88db2adda4b7
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-339
Miles Bader <miles@gnu.org>
parents:
62428
diff
changeset
|
1728 (string-to-number |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1729 (buffer-substring (match-beginning 1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1730 (match-end 1))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1731 newsgroups xref) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1732 (and number (zerop number) (setq number nil)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1733 (if number |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1734 ;; Then we find the group name. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1735 (setq group |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1736 (cond |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1737 ;; If there is only one group in the Newsgroups |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1738 ;; header, then it seems quite likely that this |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1739 ;; article comes from that group, I'd say. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1740 ((and (setq newsgroups |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1741 (mail-fetch-field "newsgroups")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1742 (not (string-match "," newsgroups))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1743 newsgroups) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1744 ;; If there is more than one group in the |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1745 ;; Newsgroups header, then the Xref header should |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1746 ;; be filled out. We hazard a guess that the group |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1747 ;; that has this article number in the Xref header |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1748 ;; is the one we are looking for. This might very |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1749 ;; well be wrong if this article happens to have |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1750 ;; the same number in several groups, but that's |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1751 ;; life. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1752 ((and (setq xref (mail-fetch-field "xref")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1753 number |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1754 (string-match |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1755 (format "\\([^ :]+\\):%d" number) xref)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1756 (match-string 1 xref)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1757 (t ""))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1758 (cond |
78546 | 1759 ((and (not nntp-xref-number-is-evil) |
1760 (setq xref (mail-fetch-field "xref")) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1761 (string-match |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1762 (if group |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1763 (concat "\\(" (regexp-quote group) "\\):\\([0-9]+\\)") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1764 "\\([^ :]+\\):\\([0-9]+\\)") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1765 xref)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1766 (setq group (match-string 1 xref) |
62907
88db2adda4b7
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-339
Miles Bader <miles@gnu.org>
parents:
62428
diff
changeset
|
1767 number (string-to-number (match-string 2 xref)))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1768 ((and (setq newsgroups |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1769 (mail-fetch-field "newsgroups")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1770 (not (string-match "," newsgroups))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1771 (setq group newsgroups)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1772 (group) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1773 (t (setq group "")))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1774 (when (string-match "\r" group) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1775 (setq group (substring group 0 (match-beginning 0)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1776 (cons group number))))) |
17493 | 1777 |
1778 (defun nntp-wait-for-string (regexp) | |
1779 "Wait until string arrives in the buffer." | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1780 (let ((buf (current-buffer)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1781 proc) |
17493 | 1782 (goto-char (point-min)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1783 (while (and (setq proc (get-buffer-process buf)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1784 (memq (process-status proc) '(open run)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1785 (not (re-search-forward regexp nil t))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1786 (accept-process-output proc) |
17493 | 1787 (set-buffer buf) |
1788 (goto-char (point-min))))) | |
1789 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1790 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1791 ;; ========================================================================== |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1792 ;; Obsolete nntp-open-* connection methods -- drv |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1793 ;; ========================================================================== |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1794 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1795 (defvoo nntp-open-telnet-envuser nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1796 "*If non-nil, telnet session (client and server both) will support the ENVIRON option and not prompt for login name.") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1797 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1798 (defvoo nntp-telnet-shell-prompt "bash\\|\$ *\r?$\\|> *\r?" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1799 "*Regular expression to match the shell prompt on the remote machine.") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1800 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1801 (defvoo nntp-rlogin-program "rsh" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1802 "*Program used to log in on remote machines. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1803 The default is \"rsh\", but \"ssh\" is a popular alternative.") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1804 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1805 (defvoo nntp-rlogin-parameters '("telnet" "-8" "${NNTPSERVER:=news}" "nntp") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1806 "*Parameters to `nntp-open-rlogin'. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1807 That function may be used as `nntp-open-connection-function'. In that |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1808 case, this list will be used as the parameter list given to rsh.") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1809 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1810 (defvoo nntp-rlogin-user-name nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1811 "*User name on remote system when using the rlogin connect method.") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1812 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1813 (defvoo nntp-telnet-parameters |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1814 '("exec" "telnet" "-8" "${NNTPSERVER:=news}" "nntp") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1815 "*Parameters to `nntp-open-telnet'. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1816 That function may be used as `nntp-open-connection-function'. In that |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1817 case, this list will be executed as a command after logging in |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1818 via telnet.") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1819 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1820 (defvoo nntp-telnet-user-name nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1821 "User name to log in via telnet with.") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1822 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1823 (defvoo nntp-telnet-passwd nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1824 "Password to use to log in via telnet with.") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1825 |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1826 (defun nntp-service-to-port (svc) |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1827 (cond |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1828 ((integerp svc) (number-to-string svc)) |
106614
6609f07cf9fd
replace [:digit:] with [0-9] for XEmacs.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
101804
diff
changeset
|
1829 ((string-match "\\`[0-9]+\\'" svc) svc) |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1830 (t |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1831 (with-temp-buffer |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1832 (ignore-errors (insert-file-contents "/etc/services")) |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1833 (goto-char (point-min)) |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1834 (if (re-search-forward (concat "^" (regexp-quote svc) |
106614
6609f07cf9fd
replace [:digit:] with [0-9] for XEmacs.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
101804
diff
changeset
|
1835 "[ \t]+\\([0-9]+\\)/tcp")) |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1836 (match-string 1) |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1837 svc))))) |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1838 |
17493 | 1839 (defun nntp-open-telnet (buffer) |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1840 (with-current-buffer buffer |
17493 | 1841 (erase-buffer) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19598
diff
changeset
|
1842 (let ((proc (apply |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19598
diff
changeset
|
1843 'start-process |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19598
diff
changeset
|
1844 "nntpd" buffer nntp-telnet-command nntp-telnet-switches)) |
17493 | 1845 (case-fold-search t)) |
1846 (when (memq (process-status proc) '(open run)) | |
33575
93288a69f66f
2000-11-17 Katsumi Yamaoka <yamaoka@jpl.org>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1847 (nntp-wait-for-string "^r?telnet") |
17493 | 1848 (process-send-string proc "set escape \^X\n") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1849 (cond |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1850 ((and nntp-open-telnet-envuser nntp-telnet-user-name) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1851 (process-send-string proc (concat "open " "-l" nntp-telnet-user-name |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1852 nntp-address "\n"))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1853 (t |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1854 (process-send-string proc (concat "open " nntp-address "\n")))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1855 (cond |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1856 ((not nntp-open-telnet-envuser) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1857 (nntp-wait-for-string "^\r*.?login:") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1858 (process-send-string |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1859 proc (concat |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1860 (or nntp-telnet-user-name |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1861 (setq nntp-telnet-user-name (read-string "login: "))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1862 "\n")))) |
17493 | 1863 (nntp-wait-for-string "^\r*.?password:") |
1864 (process-send-string | |
1865 proc (concat | |
1866 (or nntp-telnet-passwd | |
1867 (setq nntp-telnet-passwd | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1868 (read-passwd "Password: "))) |
17493 | 1869 "\n")) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1870 (nntp-wait-for-string nntp-telnet-shell-prompt) |
17493 | 1871 (process-send-string |
1872 proc (concat (mapconcat 'identity nntp-telnet-parameters " ") "\n")) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1873 (nntp-wait-for-string "^\r*20[01]") |
17493 | 1874 (beginning-of-line) |
1875 (delete-region (point-min) (point)) | |
1876 (process-send-string proc "\^]") | |
33575
93288a69f66f
2000-11-17 Katsumi Yamaoka <yamaoka@jpl.org>
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1877 (nntp-wait-for-string "^r?telnet") |
17493 | 1878 (process-send-string proc "mode character\n") |
1879 (accept-process-output proc 1) | |
1880 (sit-for 1) | |
1881 (goto-char (point-min)) | |
1882 (forward-line 1) | |
1883 (delete-region (point) (point-max))) | |
1884 proc))) | |
1885 | |
1886 (defun nntp-open-rlogin (buffer) | |
1887 "Open a connection to SERVER using rsh." | |
1888 (let ((proc (if nntp-rlogin-user-name | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1889 (apply 'start-process |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1890 "nntpd" buffer nntp-rlogin-program |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1891 nntp-address "-l" nntp-rlogin-user-name |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1892 nntp-rlogin-parameters) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1893 (apply 'start-process |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1894 "nntpd" buffer nntp-rlogin-program nntp-address |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1895 nntp-rlogin-parameters)))) |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1896 (with-current-buffer buffer |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1897 (nntp-wait-for-string "^\r*20[01]") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1898 (beginning-of-line) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1899 (delete-region (point-min) (point)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23870
diff
changeset
|
1900 proc))) |
17493 | 1901 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1902 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1903 ;; ========================================================================== |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1904 ;; Replacements for the nntp-open-* functions -- drv |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1905 ;; ========================================================================== |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1906 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1907 (defun nntp-open-telnet-stream (buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1908 "Open a nntp connection by telnet'ing the news server. |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1909 `nntp-open-netcat-stream' is recommended in place of this function |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1910 because it is more reliable. |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1911 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1912 Please refer to the following variables to customize the connection: |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1913 - `nntp-pre-command', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1914 - `nntp-telnet-command', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1915 - `nntp-telnet-switches', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1916 - `nntp-address', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1917 - `nntp-port-number', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1918 - `nntp-end-of-line'." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1919 (let ((command `(,nntp-telnet-command |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1920 ,@nntp-telnet-switches |
93386 | 1921 ,nntp-address |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1922 ,(nntp-service-to-port nntp-port-number))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1923 proc) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1924 (and nntp-pre-command |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1925 (push nntp-pre-command command)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1926 (setq proc (apply 'start-process "nntpd" buffer command)) |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1927 (with-current-buffer buffer |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1928 (nntp-wait-for-string "^\r*20[01]") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1929 (beginning-of-line) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1930 (delete-region (point-min) (point)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1931 proc))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1932 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1933 (defun nntp-open-via-rlogin-and-telnet (buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1934 "Open a connection to an nntp server through an intermediate host. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1935 First rlogin to the remote host, and then telnet the real news server |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1936 from there. |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1937 `nntp-open-via-rlogin-and-netcat' is recommended in place of this function |
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1938 because it is more reliable. |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1939 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1940 Please refer to the following variables to customize the connection: |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1941 - `nntp-pre-command', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1942 - `nntp-via-rlogin-command', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1943 - `nntp-via-rlogin-command-switches', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1944 - `nntp-via-user-name', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1945 - `nntp-via-address', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1946 - `nntp-telnet-command', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1947 - `nntp-telnet-switches', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1948 - `nntp-address', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1949 - `nntp-port-number', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1950 - `nntp-end-of-line'." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1951 (let ((command `(,nntp-via-address |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1952 ,nntp-telnet-command |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1953 ,@nntp-telnet-switches)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1954 proc) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1955 (when nntp-via-user-name |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1956 (setq command `("-l" ,nntp-via-user-name ,@command))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1957 (when nntp-via-rlogin-command-switches |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1958 (setq command (append nntp-via-rlogin-command-switches command))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1959 (push nntp-via-rlogin-command command) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1960 (and nntp-pre-command |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1961 (push nntp-pre-command command)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1962 (setq proc (apply 'start-process "nntpd" buffer command)) |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
1963 (with-current-buffer buffer |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1964 (nntp-wait-for-string "^r?telnet") |
93386 | 1965 (process-send-string proc (concat "open " nntp-address " " |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1966 (nntp-service-to-port nntp-port-number) |
93386 | 1967 "\n")) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1968 (nntp-wait-for-string "^\r*20[01]") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1969 (beginning-of-line) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1970 (delete-region (point-min) (point)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1971 (process-send-string proc "\^]") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1972 (nntp-wait-for-string "^r?telnet") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1973 (process-send-string proc "mode character\n") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1974 (accept-process-output proc 1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1975 (sit-for 1) |
17493 | 1976 (goto-char (point-min)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1977 (forward-line 1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1978 (delete-region (point) (point-max))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1979 proc)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
1980 |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1981 (defun nntp-open-via-rlogin-and-netcat (buffer) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1982 "Open a connection to an nntp server through an intermediate host. |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1983 First rlogin to the remote host, and then connect to the real news |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1984 server from there using the netcat command. |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1985 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1986 Please refer to the following variables to customize the connection: |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1987 - `nntp-pre-command', |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1988 - `nntp-via-rlogin-command', |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1989 - `nntp-via-rlogin-command-switches', |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1990 - `nntp-via-user-name', |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1991 - `nntp-via-address', |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1992 - `nntp-netcat-command', |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1993 - `nntp-netcat-switches', |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1994 - `nntp-address', |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1995 - `nntp-port-number'." |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1996 (let ((command `(,@(when nntp-pre-command |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1997 (list nntp-pre-command)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
1998 ,nntp-via-rlogin-command |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
1999 ,@nntp-via-rlogin-command-switches |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2000 ,@(when nntp-via-user-name |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2001 (list "-l" nntp-via-user-name)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2002 ,nntp-via-address |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2003 ,nntp-netcat-command |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2004 ,@nntp-netcat-switches |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2005 ,nntp-address |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2006 ,(nntp-service-to-port nntp-port-number)))) |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2007 ;; A non-nil connection type results in mightily odd behavior where |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2008 ;; (process-send-string proc "\^M") ends up sending a "\n" to the |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2009 ;; ssh process. --Stef |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2010 ;; Also a nil connection allow ssh-askpass to work under X11. |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2011 (let ((process-connection-type nil)) |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2012 (apply 'start-process "nntpd" buffer command)))) |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2013 |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2014 (defun nntp-open-netcat-stream (buffer) |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2015 "Open a connection to an nntp server through netcat. |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2016 I.e. use the `nc' command rather than Emacs's builtin networking code. |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2017 |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2018 Please refer to the following variables to customize the connection: |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2019 - `nntp-pre-command', |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2020 - `nntp-netcat-command', |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2021 - `nntp-netcat-switches', |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2022 - `nntp-address', |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2023 - `nntp-port-number'." |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2024 (let ((command `(,nntp-netcat-command |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2025 ,@nntp-netcat-switches |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2026 ,nntp-address |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2027 ,(nntp-service-to-port nntp-port-number)))) |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2028 (and nntp-pre-command (push nntp-pre-command command)) |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2029 (let ((process-connection-type nil)) ;See `nntp-open-via-rlogin-and-netcat'. |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2030 (apply 'start-process "nntpd" buffer command)))) |
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2031 |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2032 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2033 (defun nntp-open-via-telnet-and-telnet (buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2034 "Open a connection to an nntp server through an intermediate host. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2035 First telnet the remote host, and then telnet the real news server |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2036 from there. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2037 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2038 Please refer to the following variables to customize the connection: |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2039 - `nntp-pre-command', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2040 - `nntp-via-telnet-command', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2041 - `nntp-via-telnet-switches', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2042 - `nntp-via-address', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2043 - `nntp-via-envuser', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2044 - `nntp-via-user-name', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2045 - `nntp-via-user-password', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2046 - `nntp-via-shell-prompt', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2047 - `nntp-telnet-command', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2048 - `nntp-telnet-switches', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2049 - `nntp-address', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2050 - `nntp-port-number', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2051 - `nntp-end-of-line'." |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
2052 (with-current-buffer buffer |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2053 (erase-buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2054 (let ((command `(,nntp-via-telnet-command ,@nntp-via-telnet-switches)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2055 (case-fold-search t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2056 proc) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2057 (and nntp-pre-command (push nntp-pre-command command)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2058 (setq proc (apply 'start-process "nntpd" buffer command)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2059 (when (memq (process-status proc) '(open run)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2060 (nntp-wait-for-string "^r?telnet") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2061 (process-send-string proc "set escape \^X\n") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2062 (cond |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2063 ((and nntp-via-envuser nntp-via-user-name) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2064 (process-send-string proc (concat "open " "-l" nntp-via-user-name |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2065 nntp-via-address "\n"))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2066 (t |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2067 (process-send-string proc (concat "open " nntp-via-address |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2068 "\n")))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2069 (when (not nntp-via-envuser) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2070 (nntp-wait-for-string "^\r*.?login:") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2071 (process-send-string proc |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2072 (concat |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2073 (or nntp-via-user-name |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2074 (setq nntp-via-user-name |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2075 (read-string "login: "))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2076 "\n"))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2077 (nntp-wait-for-string "^\r*.?password:") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2078 (process-send-string proc |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2079 (concat |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2080 (or nntp-via-user-password |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2081 (setq nntp-via-user-password |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2082 (read-passwd "Password: "))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2083 "\n")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2084 (nntp-wait-for-string nntp-via-shell-prompt) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2085 (let ((real-telnet-command `("exec" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2086 ,nntp-telnet-command |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2087 ,@nntp-telnet-switches |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2088 ,nntp-address |
93419
4482f387c2fe
(nntp-netcat-command): Rename from nntp-via-netcat-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93386
diff
changeset
|
2089 ,(nntp-service-to-port nntp-port-number)))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2090 (process-send-string proc |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2091 (concat (mapconcat 'identity |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2092 real-telnet-command " ") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2093 "\n"))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2094 (nntp-wait-for-string "^\r*20[01]") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2095 (beginning-of-line) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2096 (delete-region (point-min) (point)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2097 (process-send-string proc "\^]") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2098 (nntp-wait-for-string "^r?telnet") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2099 (process-send-string proc "mode character\n") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2100 (accept-process-output proc 1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2101 (sit-for 1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2102 (goto-char (point-min)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2103 (forward-line 1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2104 (delete-region (point) (point-max))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56281
diff
changeset
|
2105 proc))) |
17493 | 2106 |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2107 ;; Marks handling |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2108 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2109 (defun nntp-marks-directory (server) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2110 (expand-file-name server nntp-marks-directory)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2111 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2112 (defvar nntp-server-to-method-cache nil |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2113 "Alist of servers and select methods.") |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2114 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2115 (defun nntp-group-pathname (server group &optional file) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2116 "Return an absolute file name of FILE for GROUP on SERVER." |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2117 (let ((method (cdr (assoc server nntp-server-to-method-cache)))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2118 (unless method |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2119 (push (cons server (setq method (or (gnus-server-to-method server) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2120 (gnus-find-method-for-group group)))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2121 nntp-server-to-method-cache)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2122 (nnmail-group-pathname |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2123 (mm-decode-coding-string group |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2124 (inline (gnus-group-name-charset method group))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2125 (nntp-marks-directory server) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2126 file))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2127 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2128 (defun nntp-possibly-create-directory (group server) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2129 (let ((dir (nntp-group-pathname server group)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2130 (file-name-coding-system nnmail-pathname-coding-system)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2131 (unless (file-exists-p dir) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2132 (make-directory (directory-file-name dir) t) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2133 (nnheader-message 5 "Creating nntp marks directory %s" dir)))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2134 |
95820
645fb33380d6
Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents:
94837
diff
changeset
|
2135 (autoload 'time-less-p "time-date") |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2136 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2137 (defun nntp-marks-changed-p (group server) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2138 (let ((file (nntp-group-pathname server group nntp-marks-file-name)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2139 (file-name-coding-system nnmail-pathname-coding-system)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2140 (if (null (gnus-gethash file nntp-marks-modtime)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2141 t ;; never looked at marks file, assume it has changed |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2142 (time-less-p (gnus-gethash file nntp-marks-modtime) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2143 (nth 5 (file-attributes file)))))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2144 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2145 (defun nntp-save-marks (group server) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2146 (let ((file-name-coding-system nnmail-pathname-coding-system) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2147 (file (nntp-group-pathname server group nntp-marks-file-name))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2148 (condition-case err |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2149 (progn |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2150 (nntp-possibly-create-directory group server) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2151 (with-temp-file file |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2152 (erase-buffer) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2153 (gnus-prin1 nntp-marks) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2154 (insert "\n")) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2155 (gnus-sethash file |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2156 (nth 5 (file-attributes file)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2157 nntp-marks-modtime)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2158 (error (or (gnus-yes-or-no-p |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2159 (format "Could not write to %s (%s). Continue? " file err)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2160 (error "Cannot write to %s (%s)" file err)))))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2161 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2162 (defun nntp-open-marks (group server) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2163 (let ((file (nntp-group-pathname server group nntp-marks-file-name)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2164 (file-name-coding-system nnmail-pathname-coding-system)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2165 (if (file-exists-p file) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2166 (condition-case err |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2167 (with-temp-buffer |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2168 (gnus-sethash file (nth 5 (file-attributes file)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2169 nntp-marks-modtime) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2170 (nnheader-insert-file-contents file) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2171 (setq nntp-marks (read (current-buffer))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2172 (dolist (el gnus-article-unpropagated-mark-lists) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2173 (setq nntp-marks (gnus-remassoc el nntp-marks)))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2174 (error (or (gnus-yes-or-no-p |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2175 (format "Error reading nntp marks file %s (%s). Continuing will use marks from .newsrc.eld. Continue? " file err)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2176 (error "Cannot read nntp marks file %s (%s)" file err)))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2177 ;; User didn't have a .marks file. Probably first time |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2178 ;; user of the .marks stuff. Bootstrap it from .newsrc.eld. |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2179 (let ((info (gnus-get-info |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2180 (gnus-group-prefixed-name |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2181 group |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2182 (gnus-server-to-method (format "nntp:%s" server))))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2183 (decoded-name (mm-decode-coding-string |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2184 group |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2185 (gnus-group-name-charset |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2186 (gnus-server-to-method server) group)))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2187 (nnheader-message 7 "Bootstrapping marks for %s..." decoded-name) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2188 (setq nntp-marks (gnus-info-marks info)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2189 (push (cons 'read (gnus-info-read info)) nntp-marks) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2190 (dolist (el gnus-article-unpropagated-mark-lists) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2191 (setq nntp-marks (gnus-remassoc el nntp-marks))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2192 (nntp-save-marks group server) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2193 (nnheader-message 7 "Bootstrapping marks for %s...done" |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2194 decoded-name))))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78546
diff
changeset
|
2195 |
17493 | 2196 (provide 'nntp) |
2197 | |
92778
054fe9aaf3e3
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
2198 ;; arch-tag: 8655466a-b1b5-4929-9c45-7b1b2e767271 |
17493 | 2199 ;;; nntp.el ends here |