2009-12-17 Glenn Morris <rgm@gnu.org>
[gnus] / lisp / nntp.el
1 ;;; nntp.el --- nntp access for Gnus
2
3 ;; Copyright (C) 1987, 1988, 1989, 1990, 1992, 1993,
4 ;;   1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002,
5 ;;   2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
6
7 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; Keywords: news
9
10 ;; This file is part of GNU Emacs.
11
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
16
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 ;; GNU General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
24
25 ;;; Commentary:
26
27 ;;; Code:
28
29 (require 'nnheader)
30 (require 'nnoo)
31 (require 'gnus-util)
32 (require 'gnus)
33 (require 'gnus-group) ;; gnus-group-name-charset
34
35 (nnoo-declare nntp)
36
37 (eval-when-compile (require 'cl))
38
39 (autoload 'auth-source-user-or-password "auth-source")
40
41 (defgroup nntp nil
42   "NNTP access for Gnus."
43   :group 'gnus)
44
45 (defvoo nntp-address nil
46   "Address of the physical nntp server.")
47
48 (defvoo nntp-port-number "nntp"
49   "Port number on the physical nntp server.")
50
51 (defvoo nntp-server-opened-hook '(nntp-send-mode-reader)
52   "*Hook used for sending commands to the server at startup.
53 The default value is `nntp-send-mode-reader', which makes an innd
54 server spawn an nnrpd server.")
55
56 (defvoo nntp-authinfo-function 'nntp-send-authinfo
57   "Function used to send AUTHINFO to the server.
58 It is called with no parameters.")
59
60 (defvoo nntp-server-action-alist
61     '(("nntpd 1\\.5\\.11t"
62        (remove-hook 'nntp-server-opened-hook 'nntp-send-mode-reader))
63       ("NNRP server Netscape"
64        (setq nntp-server-list-active-group nil)))
65   "Alist of regexps to match on server types and actions to be taken.
66 For instance, if you want Gnus to beep every time you connect
67 to innd, you could say something like:
68
69 \(setq nntp-server-action-alist
70        '((\"innd\" (ding))))
71
72 You probably don't want to do that, though.")
73
74 (defvoo nntp-open-connection-function 'nntp-open-network-stream
75   "*Function used for connecting to a remote system.
76 It will be called with the buffer to output in as argument.
77
78 Currently, five such functions are provided (please refer to their
79 respective doc string for more information), three of them establishing
80 direct connections to the nntp server, and two of them using an indirect
81 host.
82
83 Direct connections:
84 - `nntp-open-network-stream' (the default),
85 - `nntp-open-ssl-stream',
86 - `nntp-open-tls-stream',
87 - `nntp-open-netcat-stream'.
88 - `nntp-open-telnet-stream'.
89
90 Indirect connections:
91 - `nntp-open-via-rlogin-and-netcat',
92 - `nntp-open-via-rlogin-and-telnet',
93 - `nntp-open-via-telnet-and-telnet'.")
94
95 (defvoo nntp-never-echoes-commands nil
96   "*Non-nil means the nntp server never echoes commands.
97 It is reported that some nntps server doesn't echo commands.  So, you
98 may want to set this to non-nil in the method for such a server setting
99 `nntp-open-connection-function' to `nntp-open-ssl-stream' for example.
100 Note that the `nntp-open-connection-functions-never-echo-commands'
101 variable overrides the nil value of this variable.")
102
103 (defvoo nntp-open-connection-functions-never-echo-commands
104     '(nntp-open-network-stream)
105   "*List of functions that never echo commands.
106 Add or set a function which you set to `nntp-open-connection-function'
107 to this list if it does not echo commands.  Note that a non-nil value
108 of the `nntp-never-echoes-commands' variable overrides this variable.")
109
110 (defvoo nntp-pre-command nil
111   "*Pre-command to use with the various nntp-open-via-* methods.
112 This is where you would put \"runsocks\" or stuff like that.")
113
114 (defvoo nntp-telnet-command "telnet"
115   "*Telnet command used to connect to the nntp server.
116 This command is used by the methods `nntp-open-telnet-stream',
117 `nntp-open-via-rlogin-and-telnet' and `nntp-open-via-telnet-and-telnet'.")
118
119 (defvoo nntp-telnet-switches '("-8")
120   "*Switches given to the telnet command `nntp-telnet-command'.")
121
122 (defvoo nntp-end-of-line "\r\n"
123   "*String to use on the end of lines when talking to the NNTP server.
124 This is \"\\r\\n\" by default, but should be \"\\n\" when using an indirect
125 connection method (nntp-open-via-*).")
126