Importing gnus-5.6.22
[elisp/gnus.git-] / lisp / nntp.el
1 ;;; nntp.el --- nntp access for Gnus
2 ;;; Copyright (C) 1987-90,92-97 Free Software Foundation, Inc.
3
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
5 ;; Keywords: news
6
7 ;; This file is part of GNU Emacs.
8
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; any later version.
13
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ;; GNU General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING.  If not, write to
21 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22
23 ;;; Commentary:
24
25 ;;; Code:
26
27 (require 'nnheader)
28 (require 'nnoo)
29 (require 'gnus-util)
30
31 (nnoo-declare nntp)
32
33 (eval-and-compile
34   (unless (fboundp 'open-network-stream)
35     (require 'tcp)))
36
37 (eval-when-compile (require 'cl))
38
39 (defvoo nntp-address nil
40   "Address of the physical nntp server.")
41
42 (defvoo nntp-port-number "nntp"
43   "Port number on the physical nntp server.")
44
45 (defvoo nntp-server-opened-hook '(nntp-send-mode-reader)
46   "*Hook used for sending commands to the server at startup.
47 The default value is `nntp-send-mode-reader', which makes an innd
48 server spawn an nnrpd server.  Another useful function to put in this
49 hook might be `nntp-send-authinfo', which will prompt for a password
50 to allow posting from the server.  Note that this is only necessary to
51 do on servers that use strict access control.")
52
53 (defvoo nntp-authinfo-function 'nntp-send-authinfo
54   "Function used to send AUTHINFO to the server.")
55
56 (defvoo nntp-server-action-alist
57   '(("nntpd 1\\.5\\.11t"
58      (remove-hook 'nntp-server-opened-hook 'nntp-send-mode-reader))
59     ("NNRP server Netscape"
60      (setq nntp-server-list-active-group nil)))
61   "Alist of regexps to match on server types and actions to be taken.
62 For instance, if you want Gnus to beep every time you connect
63 to innd, you could say something like:
64
65 \(setq nntp-server-action-alist
66        '((\"innd\" (ding))))
67
68 You probably don't want to do that, though.")
69
70 (defvoo nntp-open-connection-function 'nntp-open-network-stream
71   "*Function used for connecting to a remote system.
72 It will be called with the buffer to output in.
73
74 Two pre-made functions are `nntp-open-network-stream', which is the
75 default, and simply connects to some port or other on the remote
76 system (see nntp-port-number).  The other are `nntp-open-rlogin',
77 which does an rlogin on the remote system, and then does a telnet to
78 the NNTP server available there (see nntp-rlogin-parameters) and
79 `nntp-open-telnet' which telnets to a remote system, logs in and does
80 the same.")
81
82 (defvoo nntp-rlogin-program "rsh"
83   "*Program used to log in on remote machines.
84 The default is \"rsh\", but \"ssh\" is a popular alternative.")
85
86 (defvoo nntp-rlogin-parameters '("telnet" "-8" "${NNTPSERVER:=news}" "nntp")
87   "*Parameters to `nntp-open-rlogin'.
88 That function may be used as `nntp-open-connection-function'.  In that
89 case, this list will be used as the parameter list given to rsh.")
90
91 (defvoo nntp-rlogin-user-name nil
92   "*User name on remote system when using the rlogin connect method.")
93
94 (defvoo nntp-telnet-parameters '("exec" "telnet" "-8" "${NNTPSERVER:=news}" "nntp")
95   "*Parameters to `nntp-open-telnet'.
96 That function may be used as `nntp-open-connection-function'.  In that
97 case, this list will be executed as a command after logging in
98 via telnet.")
99
100 (defvoo nntp-telnet-user-name nil
101   "User name to log in via telnet with.")
102
103 (defvoo nntp-telnet-passwd nil
104   "Password to use to log in via telnet with.")
105
106 (defvoo nntp-open-telnet-envuser nil
107   "*If non-nil, telnet session (client and server both) will support the ENVIRON option and not prompt for login name.")
108
109 (defvoo nntp-telnet-shell-prompt "bash\\|\$ *\r?$\\|> *\r?"
110   "*Regular expression to match the shell prompt on the remote machine.")
111
112 (defvoo nntp-telnet-command "telnet"
113   "Command used to start telnet.")
114
115 (defvoo nntp-telnet-switches '("-8")
116   "Switches given to the telnet command.")
117
118 (defvoo nntp-end-of-line "\r\n"
119   "String to use on the end of lines when talking to the NNTP server.
120 This is \"\\r\\n\" by default, but should be \"\\n\" when
121 using rlogin or telnet to communicate with the server.")
122
123 (defvoo nntp-large-newsgroup 50
124   "*The number of the articles which indicates a large newsgroup.
125 If the number of the articles is greater than the value, verbose
126 messages will be shown to indicate the current status.")
127
128 (defvoo nntp-maximum-request 400
129   "*The maximum number of the requests sent to the NNTP server at one time.
130 If Emacs hangs up while retrieving headers, set the variable to a
131 lower value.")
132
133 (defvoo nntp-nov-is-evil nil
134   "*If non-nil, nntp will never attempt to use XOVER when talking to the server.")
135
136 (defvoo nntp-xover-commands '("XOVER" "XOVERVIEW")
137   "*List of strings that are used as commands to fetch NOV lines from a server.
138 The strings are tried in turn until a positive response is gotten.  If
139 none of the commands are successful, nntp will just grab headers one
140 by one.")
141
142 (defvoo nntp-nov-gap 5
143   "*Maximum allowed gap between two articles.
144 If the gap between two consecutive articles is bigger than this
145 variable, split the XOVER request into two requests.")
146
147 (defvoo nntp-prepare-server-hook nil
148   "*Hook run before a server is opened.
149 If can be used to set up a server remotely, for instance.  Say you
150 have an account at the machine \"other.machine\".  This machine has
151 access to an NNTP server that you can't access locally.  You could
152 then use this hook to rsh to the remote machine and start a proxy NNTP
153 server there that you can connect to.  See also
154 `nntp-open-connection-function'")
155
156 (defvoo nntp-warn-about-losing-connection t
157   "*If non-nil, beep when a server closes connection.")
158
159 (defvoo nntp-coding-system-for-read 'binary
160   "*Coding system to read from NNTP.")
161
162 (defvoo nntp-coding-system-for-write 'binary
163   "*Coding system to write to NNTP.")
164
165 (defcustom nntp-authinfo-file "~/.authinfo"
166   ".netrc-like file that holds nntp authinfo passwords."
167   :type
168   '(choice file
169            (repeat :tag "Entries"
170                    :menu-tag "Inline"
171                    (list :format "%v"
172                          :value ("" ("login" . "") ("password" . ""))
173                          (string :tag "Host")
174                          (checklist :inline t
175                                     (cons :format "%v"
176                                           (const :format "" "login")
177                                           (string :format "Login: %v"))
178                                     (cons :format "%v"
179                                           (const :format "" "password")
180                                           (string :format "Password: %v")))))))
181
182 \f
183
184 ;;; Internal variables.
185
186 (defvar nntp-record-commands nil
187   "*If non-nil, nntp will record all commands in the \"*nntp-log*\" buffer.")
188
189 (defvar nntp-have-messaged nil)
190
191 (defvar nntp-process-wait-for nil)
192 (defvar nntp-process-to-buffer nil)
193 (defvar nntp-process-callback nil)
194 (defvar nntp-process-decode nil)
195 (defvar nntp-process-start-point nil)
196 (defvar nntp-inside-change-function nil)
197 (defvoo nntp-last-command-time nil)
198 (defvoo nntp-last-command nil)
199 (defvoo nntp-authinfo-password nil)
200
201 (defvar nntp-connection-list nil)
202
203 (defvoo nntp-server-type nil)
204 (defvoo nntp-connection-alist nil)
205 (defvoo nntp-status-string "")
206 (defconst nntp-version "nntp 5.0")
207 (defvoo nntp-inhibit-erase nil)
208 (defvoo nntp-inhibit-output nil)
209
210 (defvoo nntp-server-xover 'try)
211 (defvoo nntp-server-list-active-group 'try)
212
213 (eval-and-compile
214   (autoload 'nnmail-read-passwd "nnmail")
215   (autoload 'open-ssl-stream "ssl"))
216
217 \f
218
219 ;;; Internal functions.
220
221 (defsubst nntp-send-string (process string)
222   "Send STRING to PROCESS."
223   ;; We need to store the time to provide timeouts, and
224   ;; to store the command so the we can replay the command
225   ;; if the server gives us an AUTHINFO challenge.
226   (setq nntp-last-command-time (current-time)
227         nntp-last-command string)
228   (when nntp-record-commands
229     (nntp-record-command string))
230   (process-send-string process (concat string nntp-end-of-line)))
231
232 (defun nntp-record-command (string)
233   "Record the command STRING."
234   (save-excursion
235     (set-buffer (get-buffer-create "*nntp-log*"))
236     (goto-char (point-max))
237     (insert (format-time-string "%Y%m%dT%H%M%S" (current-time))
238             " " nntp-address " " string "\n")))
239
240 (defsubst nntp-wait-for (process wait-for buffer &optional decode discard)
241   "Wait for WAIT-FOR to arrive from PROCESS."
242   (save-excursion
243     (set-buffer (process-buffer process))
244     (goto-char (point-min))
245     (while (and (or (not (memq (char-after (point)) '(?2 ?3 ?4 ?5)))
246                     (looking-at "480"))
247                 (memq (process-status process) '(open run)))
248       (when (looking-at "480")
249         (nntp-handle-authinfo process))
250       (nntp-accept-process-output process)
251       (goto-char (point-min)))
252     (prog1
253         (cond
254          ((looking-at "[45]")
255           (progn
256             (nntp-snarf-error-message)
257             nil))
258          ((not (memq (process-status process) '(open run)))
259           (nnheader-report 'nntp "Server closed connection"))
260          (t
261           (goto-char (point-max))
262           (let ((limit (point-min)))
263             (while (not (re-search-backward wait-for limit t))
264               (nntp-accept-process-output process)
265               ;; We assume that whatever we wait for is less than 1000
266               ;; characters long.
267               (setq limit (max (- (point-max) 1000) (point-min)))
268               (goto-char (point-max))))
269           (nntp-decode-text (not decode))
270           (unless discard
271             (save-excursion
272               (set-buffer buffer)
273               (goto-char (point-max))
274               (insert-buffer-substring (process-buffer process))
275               ;; Nix out "nntp reading...." message.
276               (when nntp-have-messaged
277                 (setq nntp-have-messaged nil)
278                 (nnheader-message 5 ""))
279               t))))
280       (unless discard
281         (erase-buffer)))))
282
283 (defsubst nntp-find-connection (buffer)
284   "Find the connection delivering to BUFFER."
285   (let ((alist nntp-connection-alist)
286         (buffer (if (stringp buffer) (get-buffer buffer) buffer))
287         process entry)
288     (while (setq entry (pop alist))
289       (when (eq buffer (cadr entry))
290         (setq process (car entry)
291               alist nil)))
292     (when process
293       (if (memq (process-status process) '(open run))
294           process
295         (when (buffer-name (process-buffer process))
296           (kill-buffer (process-buffer process)))
297         (setq nntp-connection-alist (delq entry nntp-connection-alist))
298         nil))))
299
300 (defsubst nntp-find-connection-entry (buffer)
301   "Return the entry for the connection to BUFFER."
302   (assq (nntp-find-connection buffer) nntp-connection-alist))
303
304 (defun nntp-find-connection-buffer (buffer)
305   "Return the process connection buffer tied to BUFFER."
306   (let ((process (nntp-find-connection buffer)))
307     (when process
308       (process-buffer process))))
309
310 (defsubst nntp-retrieve-data (command address port buffer
311                                       &optional wait-for callback decode)
312   "Use COMMAND to retrieve data into BUFFER from PORT on ADDRESS."
313   (let ((process (or (nntp-find-connection buffer)
314                      (nntp-open-connection buffer))))
315     (if (not process)
316         (nnheader-report 'nntp "Couldn't open connection to %s" address)
317       (unless (or nntp-inhibit-erase nnheader-callback-function)
318         (save-excursion
319           (set-buffer (process-buffer process))
320           (erase-buffer)))
321       (when command
322         (nntp-send-string process command))
323       (cond
324        ((eq callback 'ignore)
325         t)
326        ((and callback wait-for)
327         (save-excursion
328           (set-buffer (process-buffer process))
329           (unless nntp-inside-change-function
330             (erase-buffer))
331           (setq nntp-process-decode decode
332                 nntp-process-to-buffer buffer
333                 nntp-process-wait-for wait-for
334                 nntp-process-callback callback
335                 nntp-process-start-point (point-max)
336                 after-change-functions
337                 (list 'nntp-after-change-function-callback)))
338         t)
339        (wait-for
340         (nntp-wait-for process wait-for buffer decode))
341        (t t)))))
342
343 (defsubst nntp-send-command (wait-for &rest strings)
344   "Send STRINGS to server and wait until WAIT-FOR returns."
345   (when (and (not nnheader-callback-function)
346              (not nntp-inhibit-output))
347     (save-excursion
348       (set-buffer nntp-server-buffer)
349       (erase-buffer)))
350   (nntp-retrieve-data
351    (mapconcat 'identity strings " ")
352    nntp-address nntp-port-number nntp-server-buffer
353    wait-for nnheader-callback-function))
354
355 (defun nntp-send-command-nodelete (wait-for &rest strings)
356   "Send STRINGS to server and wait until WAIT-FOR returns."
357   (nntp-retrieve-data
358    (mapconcat 'identity strings " ")
359    nntp-address nntp-port-number nntp-server-buffer
360    wait-for nnheader-callback-function))
361
362 (defun nntp-send-command-and-decode (wait-for &rest strings)
363   "Send STRINGS to server and wait until WAIT-FOR returns."
364   (when (and (not nnheader-callback-function)
365              (not nntp-inhibit-output))
366     (save-excursion
367       (set-buffer nntp-server-buffer)
368       (erase-buffer)))
369   (nntp-retrieve-data
370    (mapconcat 'identity strings " ")
371    nntp-address nntp-port-number nntp-server-buffer
372    wait-for nnheader-callback-function t))
373
374 (defun nntp-send-buffer (wait-for)
375   "Send the current buffer to server and wait until WAIT-FOR returns."
376   (when (and (not nnheader-callback-function)
377              (not nntp-inhibit-output))
378     (save-excursion
379       (set-buffer (nntp-find-connection-buffer nntp-server-buffer))
380       (erase-buffer)))
381   (nntp-encode-text)
382   (process-send-region (nntp-find-connection nntp-server-buffer)
383                        (point-min) (point-max))
384   (nntp-retrieve-data
385    nil nntp-address nntp-port-number nntp-server-buffer
386    wait-for nnheader-callback-function))
387
388 \f
389
390 ;;; Interface functions.
391
392 (nnoo-define-basics nntp)
393
394 (defsubst nntp-next-result-arrived-p ()
395   (let ((point (point)))
396     (cond
397      ((eq (following-char) ?2)
398       (if (re-search-forward "\n\\.\r?\n" nil t)
399           t
400         (goto-char point)
401         nil))
402      ((looking-at "[34]")
403       (forward-line 1)
404       t)
405      (t
406       nil))))
407
408 (deffoo nntp-retrieve-headers (articles &optional group server fetch-old)
409   "Retrieve the headers of ARTICLES."
410   (nntp-possibly-change-group group server)
411   (save-excursion
412     (set-buffer (nntp-find-connection-buffer nntp-server-buffer))
413     (erase-buffer)
414     (if (and (not gnus-nov-is-evil)
415              (not nntp-nov-is-evil)
416              (nntp-retrieve-headers-with-xover articles fetch-old))
417         ;; We successfully retrieved the headers via XOVER.
418         'nov
419       ;; XOVER didn't work, so we do it the hard, slow and inefficient
420       ;; way.
421       (let ((number (length articles))
422             (count 0)
423             (received 0)
424             (last-point (point-min))
425             (buf (nntp-find-connection-buffer nntp-server-buffer))
426             (nntp-inhibit-erase t)
427             article)
428         ;; Send HEAD commands.
429       (while (setq article (pop articles))
430         (nntp-send-command
431          nil
432          "HEAD" (if (numberp article)
433                     (int-to-string article)
434                   ;; `articles' is either a list of article numbers
435                   ;; or a list of article IDs.
436                   article))
437         (incf count)
438         ;; Every 400 requests we have to read the stream in
439         ;; order to avoid deadlocks.
440         (when (or (null articles)       ;All requests have been sent.
441                   (zerop (% count nntp-maximum-request)))
442           (nntp-accept-response)
443           (while (progn
444                    (set-buffer buf)
445                    (goto-char last-point)
446                    ;; Count replies.
447                    (while (nntp-next-result-arrived-p)
448                      (setq last-point (point))
449                      (incf received))
450                    (< received count))
451             ;; If number of headers is greater than 100, give
452             ;;  informative messages.
453             (and (numberp nntp-large-newsgroup)
454                  (> number nntp-large-newsgroup)
455                  (zerop (% received 20))
456                  (nnheader-message 6 "NNTP: Receiving headers... %d%%"
457                                    (/ (* received 100) number)))
458             (nntp-accept-response))))
459         (and (numberp nntp-large-newsgroup)
460              (> number nntp-large-newsgroup)
461              (nnheader-message 6 "NNTP: Receiving headers...done"))
462
463         ;; Now all of replies are received.  Fold continuation lines.
464         (nnheader-fold-continuation-lines)
465         ;; Remove all "\r"'s.
466         (nnheader-strip-cr)
467         (copy-to-buffer nntp-server-buffer (point-min) (point-max))
468         'headers))))
469
470 (deffoo nntp-retrieve-groups (groups &optional server)
471   "Retrieve group info on GROUPS."
472   (nntp-possibly-change-group nil server)
473   (save-excursion
474     (set-buffer (nntp-find-connection-buffer nntp-server-buffer))
475     ;; The first time this is run, this variable is `try'.  So we
476     ;; try.
477     (when (eq nntp-server-list-active-group 'try)
478       (nntp-try-list-active (car groups)))
479     (erase-buffer)
480     (let ((count 0)
481           (received 0)
482           (last-point (point-min))
483           (nntp-inhibit-erase t)
484           (command (if nntp-server-list-active-group "LIST ACTIVE" "GROUP")))
485       (while groups
486         ;; Send the command to the server.
487         (nntp-send-command nil command (pop groups))
488         (incf count)
489         ;; Every 400 requests we have to read the stream in
490         ;; order to avoid deadlocks.
491         (when (or (null groups)         ;All requests have been sent.
492                   (zerop (% count nntp-maximum-request)))
493           (nntp-accept-response)
494           (while (progn
495                    (goto-char last-point)
496                    ;; Count replies.
497                    (while (re-search-forward "^[0-9]" nil t)
498                      (incf received))
499                    (setq last-point (point))
500                    (< received count))
501             (nntp-accept-response))))
502
503       ;; Wait for the reply from the final command.
504       (goto-char (point-max))
505       (re-search-backward "^[0-9]" nil t)
506       (when (looking-at "^[23]")
507         (while (progn
508                  (goto-char (point-max))
509                  (if (not nntp-server-list-active-group)
510                      (not (re-search-backward "\r?\n" (- (point) 3) t))
511                    (not (re-search-backward "^\\.\r?\n" (- (point) 4) t))))
512           (nntp-accept-response)))
513
514       ;; Now all replies are received.  We remove CRs.
515       (goto-char (point-min))
516       (while (search-forward "\r" nil t)
517         (replace-match "" t t))
518
519       (if (not nntp-server-list-active-group)
520           (progn
521             (copy-to-buffer nntp-server-buffer (point-min) (point-max))
522             'group)
523         ;; We have read active entries, so we just delete the
524         ;; superfluous gunk.
525         (goto-char (point-min))
526         (while (re-search-forward "^[.2-5]" nil t)
527           (delete-region (match-beginning 0)
528                          (progn (forward-line 1) (point))))
529         (copy-to-buffer nntp-server-buffer (point-min) (point-max))
530         'active))))
531
532 (deffoo nntp-retrieve-articles (articles &optional group server)
533   (nntp-possibly-change-group group server)
534   (save-excursion
535     (let ((number (length articles))
536           (count 0)
537           (received 0)
538           (last-point (point-min))
539           (buf (nntp-find-connection-buffer nntp-server-buffer))
540           (nntp-inhibit-erase t)
541           (map (apply 'vector articles))
542           (point 1)
543           article alist)
544       (set-buffer buf)
545       (erase-buffer)
546       ;; Send ARTICLE command.
547       (while (setq article (pop articles))
548         (nntp-send-command
549          nil
550          "ARTICLE" (if (numberp article)
551                        (int-to-string article)
552                      ;; `articles' is either a list of article numbers
553                      ;; or a list of article IDs.
554                      article))
555         (incf count)
556         ;; Every 400 requests we have to read the stream in
557         ;; order to avoid deadlocks.
558         (when (or (null articles)       ;All requests have been sent.
559                   (zerop (% count nntp-maximum-request)))
560           (nntp-accept-response)
561           (while (progn
562                    (set-buffer buf)
563                    (goto-char last-point)
564                    ;; Count replies.
565                    (while (nntp-next-result-arrived-p)
566                      (aset map received (cons (aref map received) (point)))
567                      (setq last-point (point))
568                      (incf received))
569                    (< received count))
570             ;; If number of headers is greater than 100, give
571             ;;  informative messages.
572             (and (numberp nntp-large-newsgroup)
573                  (> number nntp-large-newsgroup)
574                  (zerop (% received 20))
575                  (nnheader-message 6 "NNTP: Receiving articles... %d%%"
576                                    (/ (* received 100) number)))
577             (nntp-accept-response))))
578       (and (numberp nntp-large-newsgroup)
579            (> number nntp-large-newsgroup)
580            (nnheader-message 6 "NNTP: Receiving articles...done"))
581       
582       ;; Now we have all the responses.  We go through the results,
583       ;; washes it and copies it over to the server buffer.
584       (set-buffer nntp-server-buffer)
585       (erase-buffer)
586       (setq last-point (point-min))
587       (mapcar
588        (lambda (entry)
589          (narrow-to-region
590           (setq point (goto-char (point-max)))
591           (progn
592             (insert-buffer-substring buf last-point (cdr entry))
593             (point-max)))
594          (setq last-point (cdr entry))
595          (nntp-decode-text)
596          (widen)
597          (cons (car entry) point))
598        map))))
599
600 (defun nntp-try-list-active (group)
601   (nntp-list-active-group group)
602   (save-excursion
603     (set-buffer nntp-server-buffer)
604     (goto-char (point-min))
605     (cond ((or (eobp)
606                (looking-at "5[0-9]+"))
607            (setq nntp-server-list-active-group nil))
608           (t
609            (setq nntp-server-list-active-group t)))))
610
611 (deffoo nntp-list-active-group (group &optional server)
612   "Return the active info on GROUP (which can be a regexp."
613   (nntp-possibly-change-group nil server)
614   (nntp-send-command "^.*\r?\n" "LIST ACTIVE" group))
615
616 (deffoo nntp-request-article (article &optional group server buffer command)
617   (nntp-possibly-change-group group server)
618   (when (nntp-send-command-and-decode
619          "\r?\n\\.\r?\n" "ARTICLE"
620          (if (numberp article) (int-to-string article) article))
621     (if (and buffer
622              (not (equal buffer nntp-server-buffer)))
623         (save-excursion
624           (set-buffer nntp-server-buffer)
625           (copy-to-buffer buffer (point-min) (point-max))
626           (nntp-find-group-and-number))
627       (nntp-find-group-and-number))))
628
629 (deffoo nntp-request-head (article &optional group server)
630   (nntp-possibly-change-group group server)
631   (when (nntp-send-command
632          "\r?\n\\.\r?\n" "HEAD"
633          (if (numberp article) (int-to-string article) article))
634     (prog1
635         (nntp-find-group-and-number)
636       (nntp-decode-text))))
637
638 (deffoo nntp-request-body (article &optional group server)
639   (nntp-possibly-change-group group server)
640   (nntp-send-command-and-decode
641    "\r?\n\\.\r?\n" "BODY"
642    (if (numberp article) (int-to-string article) article)))
643
644 (deffoo nntp-request-group (group &optional server dont-check)
645   (nntp-possibly-change-group nil server)
646   (when (nntp-send-command "^21.*\n" "GROUP" group)
647     (let ((entry (nntp-find-connection-entry nntp-server-buffer)))
648       (setcar (cddr entry) group))))
649
650 (deffoo nntp-close-group (group &optional server)
651   t)
652
653 (deffoo nntp-server-opened (&optional server)
654   "Say whether a connection to SERVER has been opened."
655   (and (nnoo-current-server-p 'nntp server)
656        nntp-server-buffer
657        (gnus-buffer-live-p nntp-server-buffer)
658        (nntp-find-connection nntp-server-buffer)))
659
660 (deffoo nntp-open-server (server &optional defs connectionless)
661   (nnheader-init-server-buffer)
662   (if (nntp-server-opened server)
663       t
664     (when (or (stringp (car defs))
665               (numberp (car defs)))
666       (setq defs (cons (list 'nntp-port-number (car defs)) (cdr defs))))
667     (unless (assq 'nntp-address defs)
668       (setq defs (append defs (list (list 'nntp-address server)))))
669     (nnoo-change-server 'nntp server defs)
670     (unless connectionless
671       (or (nntp-find-connection nntp-server-buffer)
672           (nntp-open-connection nntp-server-buffer)))))
673
674 (deffoo nntp-close-server (&optional server)
675   (nntp-possibly-change-group nil server t)
676   (let ((process (nntp-find-connection nntp-server-buffer)))
677     (while process
678       (when (memq (process-status process) '(open run))
679         (ignore-errors
680           (nntp-send-string process "QUIT")
681           (unless (eq nntp-open-connection-function 'nntp-open-network-stream)
682             (sleep-for 1))))
683       (when (buffer-name (process-buffer process))
684         (kill-buffer (process-buffer process)))
685       (setq process (car (pop nntp-connection-alist))))
686     (nnoo-close-server 'nntp)))
687
688 (deffoo nntp-request-close ()
689   (let (process)
690     (while (setq process (pop nntp-connection-list))
691       (when (memq (process-status process) '(open run))
692         (ignore-errors
693           (nntp-send-string process "QUIT")
694           (unless (eq nntp-open-connection-function 'nntp-open-network-stream)
695             ;; Ok, this is evil, but when using telnet and stuff
696             ;; as the connection method, it's important that the
697             ;; QUIT command actually is sent out before we kill
698             ;; the process.  
699             (sleep-for 1))))
700       (when (buffer-name (process-buffer process))
701         (kill-buffer (process-buffer process))))))
702
703 (deffoo nntp-request-list (&optional server)
704   (nntp-possibly-change-group nil server)
705   (nntp-send-command-and-decode "\r?\n\\.\r?\n" "LIST"))
706
707 (deffoo nntp-request-list-newsgroups (&optional server)
708   (nntp-possibly-change-group nil server)
709   (nntp-send-command "\r?\n\\.\r?\n" "LIST NEWSGROUPS"))
710
711 (deffoo nntp-request-newgroups (date &optional server)
712   (nntp-possibly-change-group nil server)
713   (save-excursion
714     (set-buffer nntp-server-buffer)
715     (prog1
716         (nntp-send-command
717          "^\\.\r?\n" "NEWGROUPS"
718          (format-time-string "%y%m%d %H%M%S" (nnmail-date-to-time date)))
719       (nntp-decode-text))))
720
721 (deffoo nntp-request-post (&optional server)
722   (nntp-possibly-change-group nil server)
723   (when (nntp-send-command "^[23].*\r?\n" "POST")
724     (nntp-send-buffer "^[23].*\n")))
725
726 (deffoo nntp-request-type (group article)
727   'news)
728
729 (deffoo nntp-asynchronous-p ()
730   t)
731
732 ;;; Hooky functions.
733
734 (defun nntp-send-mode-reader ()
735   "Send the MODE READER command to the nntp server.
736 This function is supposed to be called from `nntp-server-opened-hook'.
737 It will make innd servers spawn an nnrpd process to allow actual article
738 reading."
739   (nntp-send-command "^.*\r?\n" "MODE READER"))
740
741 (defun nntp-send-authinfo (&optional send-if-force)
742   "Send the AUTHINFO to the nntp server.
743 It will look in the \"~/.authinfo\" file for matching entries.  If
744 nothing suitable is found there, it will prompt for a user name
745 and a password."
746   (let* ((list (gnus-parse-netrc nntp-authinfo-file))
747          (alist (gnus-netrc-machine list nntp-address))
748          (force (gnus-netrc-get alist "force"))
749          (user (gnus-netrc-get alist "login"))
750          (passwd (gnus-netrc-get alist "password")))
751     (when (or (not send-if-force)
752               force)
753       (nntp-send-command
754        "^3.*\r?\n" "AUTHINFO USER"
755        (or user (read-string (format "NNTP (%s) user name: " nntp-address))))
756       (nntp-send-command
757        "^2.*\r?\n" "AUTHINFO PASS"
758        (or passwd
759            nntp-authinfo-password
760            (setq nntp-authinfo-password
761                  (nnmail-read-passwd (format "NNTP (%s) password: "
762                                              nntp-address))))))))
763
764 (defun nntp-send-nosy-authinfo ()
765   "Send the AUTHINFO to the nntp server."
766   (nntp-send-command
767    "^3.*\r?\n" "AUTHINFO USER"
768    (read-string (format "NNTP (%s) user name: " nntp-address)))
769   (nntp-send-command
770    "^2.*\r?\n" "AUTHINFO PASS"
771    (nnmail-read-passwd "NNTP (%s) password: " nntp-address)))
772
773 (defun nntp-send-authinfo-from-file ()
774   "Send the AUTHINFO to the nntp server.
775
776 The authinfo login name is taken from the user's login name and the
777 password contained in '~/.nntp-authinfo'."
778   (when (file-exists-p "~/.nntp-authinfo")
779     (nnheader-temp-write nil
780       (insert-file-contents "~/.nntp-authinfo")
781       (goto-char (point-min))
782       (nntp-send-command "^3.*\r?\n" "AUTHINFO USER" (user-login-name))
783       (nntp-send-command
784        "^2.*\r?\n" "AUTHINFO PASS"
785        (buffer-substring (point) (progn (end-of-line) (point)))))))
786
787 ;;; Internal functions.
788
789 (defun nntp-handle-authinfo (process)
790   "Take care of an authinfo response from the server."
791   (let ((last nntp-last-command))
792     (funcall nntp-authinfo-function)
793     ;; We have to re-send the function that was interrupted by
794     ;; the authinfo request.
795     (save-excursion
796       (set-buffer nntp-server-buffer)
797       (erase-buffer))
798     (nntp-send-string process last)))
799
800 (defun nntp-make-process-buffer (buffer)
801   "Create a new, fresh buffer usable for nntp process connections."
802   (save-excursion
803     (set-buffer
804      (generate-new-buffer
805       (format " *server %s %s %s*"
806               nntp-address nntp-port-number
807               (gnus-buffer-exists-p buffer))))
808     (buffer-disable-undo (current-buffer))
809     (set (make-local-variable 'after-change-functions) nil)
810     (set (make-local-variable 'nntp-process-wait-for) nil)
811     (set (make-local-variable 'nntp-process-callback) nil)
812     (set (make-local-variable 'nntp-process-to-buffer) nil)
813     (set (make-local-variable 'nntp-process-start-point) nil)
814     (set (make-local-variable 'nntp-process-decode) nil)
815     (current-buffer)))
816
817 (defun nntp-open-connection (buffer)
818   "Open a connection to PORT on ADDRESS delivering output to BUFFER."
819   (run-hooks 'nntp-prepare-server-hook)
820   (let* ((pbuffer (nntp-make-process-buffer buffer))
821          (process
822           (condition-case ()
823               (let ((coding-system-for-read nntp-coding-system-for-read))
824                 (funcall nntp-open-connection-function pbuffer))
825             (error nil)
826             (quit nil))))
827     (when process
828       (process-kill-without-query process)
829       (nntp-wait-for process "^.*\n" buffer nil t)
830       (if (memq (process-status process) '(open run))
831           (prog1
832               (caar (push (list process buffer nil) nntp-connection-alist))
833             (push process nntp-connection-list)
834             (save-excursion
835               (set-buffer pbuffer)
836               (nntp-read-server-type)
837               (erase-buffer)
838               (set-buffer nntp-server-buffer)
839               (let ((nnheader-callback-function nil))
840                 (run-hooks 'nntp-server-opened-hook)
841                 (nntp-send-authinfo t))))
842         (when (buffer-name (process-buffer process))
843           (kill-buffer (process-buffer process)))
844         nil))))
845
846 (defun nntp-open-network-stream (buffer)
847   (open-network-stream "nntpd" buffer nntp-address nntp-port-number))
848
849 (defun nntp-open-ssl-stream (buffer)
850   (let* ((ssl-program-arguments '("-connect" (concat host ":" service)))
851          (proc (open-ssl-stream "nntpd" buffer nntp-address nntp-port-number)))
852     (save-excursion
853       (set-buffer buffer)
854       (nntp-wait-for-string "^\r*20[01]")
855       (beginning-of-line)
856       (delete-region (point-min) (point))
857       proc)))
858
859 (defun nntp-read-server-type ()
860   "Find out what the name of the server we have connected to is."
861   ;; Wait for the status string to arrive.
862   (setq nntp-server-type (buffer-string))
863   (let ((alist nntp-server-action-alist)
864         (case-fold-search t)
865         entry)
866     ;; Run server-specific commands.
867     (while alist
868       (setq entry (pop alist))
869       (when (string-match (car entry) nntp-server-type)
870         (if (and (listp (cadr entry))
871                  (not (eq 'lambda (caadr entry))))
872             (eval (cadr entry))
873           (funcall (cadr entry)))))))
874
875 (defun nntp-after-change-function-callback (beg end len)
876   (when nntp-process-callback
877     (save-match-data
878       (if (and (= beg (point-min))
879                (memq (char-after beg) '(?4 ?5)))
880           ;; Report back error messages.
881           (save-excursion
882             (goto-char beg)
883             (if (looking-at "480")
884                 (nntp-handle-authinfo nntp-process-to-buffer)
885               (nntp-snarf-error-message)
886               (funcall nntp-process-callback nil)))
887         (goto-char end)
888         (when (and (> (point) nntp-process-start-point)
889                    (re-search-backward nntp-process-wait-for
890                                        nntp-process-start-point t))
891           (when (gnus-buffer-exists-p nntp-process-to-buffer)
892             (let ((cur (current-buffer))
893                   (start nntp-process-start-point))
894               (save-excursion
895                 (set-buffer nntp-process-to-buffer)
896                 (goto-char (point-max))
897                 (let ((b (point)))
898                   (insert-buffer-substring cur start)
899                   (narrow-to-region b (point-max))
900                   (nntp-decode-text)
901                   (widen)))))
902           (goto-char end)
903           (let ((callback nntp-process-callback)
904                 (nntp-inside-change-function t))
905             (setq nntp-process-callback nil)
906             (save-excursion
907               (funcall callback (buffer-name
908                                  (get-buffer nntp-process-to-buffer))))))))))
909
910 (defun nntp-snarf-error-message ()
911   "Save the error message in the current buffer."
912   (let ((message (buffer-string)))
913     (while (string-match "[\r\n]+" message)
914       (setq message (replace-match " " t t message)))
915     (nnheader-report 'nntp message)
916     message))
917
918 (defun nntp-accept-process-output (process)
919   "Wait for output from PROCESS and message some dots."
920   (save-excursion
921     (set-buffer (or (nntp-find-connection-buffer nntp-server-buffer)
922                     nntp-server-buffer))
923     (let ((len (/ (point-max) 1024))
924           message-log-max)
925       (unless (< len 10)
926         (setq nntp-have-messaged t)
927         (nnheader-message 7 "nntp read: %dk" len)))
928     (accept-process-output process 1)))
929
930 (defun nntp-accept-response ()
931   "Wait for output from the process that outputs to BUFFER."
932   (nntp-accept-process-output (nntp-find-connection nntp-server-buffer)))
933
934 (defun nntp-possibly-change-group (group server &optional connectionless)
935   (let ((nnheader-callback-function nil))
936     (when server
937       (or (nntp-server-opened server)
938           (nntp-open-server server nil connectionless)))
939
940     (unless connectionless
941       (or (nntp-find-connection nntp-server-buffer)
942           (nntp-open-connection nntp-server-buffer))))
943
944   (when group
945     (let ((entry (nntp-find-connection-entry nntp-server-buffer)))
946       (when (not (equal group (caddr entry)))
947         (save-excursion
948           (set-buffer (process-buffer (car entry)))
949           (erase-buffer)
950           (nntp-send-string (car entry) (concat "GROUP " group))
951           (nntp-wait-for-string "^2.*\n")
952           (setcar (cddr entry) group)
953           (erase-buffer))))))
954
955 (defun nntp-decode-text (&optional cr-only)
956   "Decode the text in the current buffer."
957   (goto-char (point-min))
958   (while (search-forward "\r" nil t)
959     (delete-char -1))
960   (unless cr-only
961     ;; Remove trailing ".\n" end-of-transfer marker.
962     (goto-char (point-max))
963     (forward-line -1)
964     (when (looking-at ".\n")
965       (delete-char 2))
966     ;; Delete status line.
967     (goto-char (point-min))
968     (delete-region (point) (progn (forward-line 1) (point)))
969     ;; Remove "." -> ".." encoding.
970     (while (search-forward "\n.." nil t)
971       (delete-char -1))))
972
973 (defun nntp-encode-text ()
974   "Encode the text in the current buffer."
975   (save-excursion
976     ;; Replace "." at beginning of line with "..".
977     (goto-char (point-min))
978     (while (re-search-forward "^\\." nil t)
979       (insert "."))
980     (goto-char (point-max))
981     ;; Insert newline at the end of the buffer.
982     (unless (bolp)
983       (insert "\n"))
984     ;; Insert `.' at end of buffer (end of text mark).
985     (goto-char (point-max))
986     (insert ".\n")
987     (goto-char (point-min))
988     (while (not (eobp))
989       (end-of-line)
990       (delete-char 1)
991       (insert nntp-end-of-line))
992     (forward-char -1)
993     (unless (eq (char-after (1- (point))) ?\r)
994       (insert "\r"))))
995
996 (defun nntp-retrieve-headers-with-xover (articles &optional fetch-old)
997   (set-buffer nntp-server-buffer)
998   (erase-buffer)
999   (cond
1000
1001    ;; This server does not talk NOV.
1002    ((not nntp-server-xover)
1003     nil)
1004
1005    ;; We don't care about gaps.
1006    ((or (not nntp-nov-gap)
1007         fetch-old)
1008     (nntp-send-xover-command
1009      (if fetch-old
1010          (if (numberp fetch-old)
1011              (max 1 (- (car articles) fetch-old))
1012            1)
1013        (car articles))
1014      (car (last articles)) 'wait)
1015
1016     (goto-char (point-min))
1017     (when (looking-at "[1-5][0-9][0-9] ")
1018       (delete-region (point) (progn (forward-line 1) (point))))
1019     (while (search-forward "\r" nil t)
1020       (replace-match "" t t))
1021     (goto-char (point-max))
1022     (forward-line -1)
1023     (when (looking-at "\\.")
1024       (delete-region (point) (progn (forward-line 1) (point)))))
1025
1026    ;; We do it the hard way.  For each gap, an XOVER command is sent
1027    ;; to the server.  We do not wait for a reply from the server, we
1028    ;; just send them off as fast as we can.  That means that we have
1029    ;; to count the number of responses we get back to find out when we
1030    ;; have gotten all we asked for.
1031    ((numberp nntp-nov-gap)
1032     (let ((count 0)
1033           (received 0)
1034           (last-point (point-min))
1035           (buf nntp-server-buffer)
1036           ;;(process-buffer (nntp-find-connection (current-buffer))))
1037           first)
1038       ;; We have to check `nntp-server-xover'.  If it gets set to nil,
1039       ;; that means that the server does not understand XOVER, but we
1040       ;; won't know that until we try.
1041       (while (and nntp-server-xover articles)
1042         (setq first (car articles))
1043         ;; Search forward until we find a gap, or until we run out of
1044         ;; articles.
1045         (while (and (cdr articles)
1046                     (< (- (nth 1 articles) (car articles)) nntp-nov-gap))
1047           (setq articles (cdr articles)))
1048
1049         (when (nntp-send-xover-command first (car articles))
1050           (setq articles (cdr articles)
1051                 count (1+ count))
1052
1053           ;; Every 400 requests we have to read the stream in
1054           ;; order to avoid deadlocks.
1055           (when (or (null articles)     ;All requests have been sent.
1056                     (zerop (% count nntp-maximum-request)))
1057             (accept-process-output)
1058             ;; On some Emacs versions the preceding function has
1059             ;; a tendency to change the buffer.  Perhaps.  It's
1060             ;; quite difficult to reproduce, because it only
1061             ;; seems to happen once in a blue moon.
1062             (set-buffer buf)
1063             (while (progn
1064                      (goto-char last-point)
1065                      ;; Count replies.
1066                      (while (re-search-forward "^[0-9][0-9][0-9] " nil t)
1067                        (setq received (1+ received)))
1068                      (setq last-point (point))
1069                      (< received count))
1070               (accept-process-output)
1071               (set-buffer buf)))))
1072
1073       (when nntp-server-xover
1074         ;; Wait for the reply from the final command.
1075         (goto-char (point-max))
1076         (re-search-backward "^[0-9][0-9][0-9] " nil t)
1077         (when (looking-at "^[23]")
1078           (while (progn
1079                    (goto-char (point-max))
1080                    (forward-line -1)
1081                    (not (looking-at "^\\.\r?\n")))
1082             (nntp-accept-response)))
1083
1084         ;; We remove any "." lines and status lines.
1085         (goto-char (point-min))
1086         (while (search-forward "\r" nil t)
1087           (delete-char -1))
1088         (goto-char (point-min))
1089         (delete-matching-lines "^\\.$\\|^[1-5][0-9][0-9] ")
1090         ;;(copy-to-buffer nntp-server-buffer (point-min) (point-max))
1091         t))))
1092
1093   nntp-server-xover)
1094
1095 (defun nntp-send-xover-command (beg end &optional wait-for-reply)
1096   "Send the XOVER command to the server."
1097   (let ((range (format "%d-%d" beg end))
1098         (nntp-inhibit-erase t))
1099     (if (stringp nntp-server-xover)
1100         ;; If `nntp-server-xover' is a string, then we just send this
1101         ;; command.
1102         (if wait-for-reply
1103             (nntp-send-command-nodelete
1104              "\r?\n\\.\r?\n" nntp-server-xover range)
1105           ;; We do not wait for the reply.
1106           (nntp-send-command-nodelete "\r?\n\\.\r?\n" nntp-server-xover range))
1107       (let ((commands nntp-xover-commands))
1108         ;; `nntp-xover-commands' is a list of possible XOVER commands.
1109         ;; We try them all until we get at positive response.
1110         (while (and commands (eq nntp-server-xover 'try))
1111           (nntp-send-command-nodelete "\r?\n\\.\r?\n" (car commands) range)
1112           (save-excursion
1113             (set-buffer nntp-server-buffer)
1114             (goto-char (point-min))
1115             (and (looking-at "[23]")    ; No error message.
1116                  ;; We also have to look at the lines.  Some buggy
1117                  ;; servers give back simple lines with just the
1118                  ;; article number.  How... helpful.
1119                  (progn
1120                    (forward-line 1)
1121                    (looking-at "[0-9]+\t...")) ; More text after number.
1122                  (setq nntp-server-xover (car commands))))
1123           (setq commands (cdr commands)))
1124         ;; If none of the commands worked, we disable XOVER.
1125         (when (eq nntp-server-xover 'try)
1126           (save-excursion
1127             (set-buffer nntp-server-buffer)
1128             (erase-buffer)
1129             (setq nntp-server-xover nil)))
1130         nntp-server-xover))))
1131
1132 ;;; Alternative connection methods.
1133
1134 (defun nntp-wait-for-string (regexp)
1135   "Wait until string arrives in the buffer."
1136   (let ((buf (current-buffer)))
1137     (goto-char (point-min))
1138     (while (not (re-search-forward regexp nil t))
1139       (accept-process-output (nntp-find-connection nntp-server-buffer))
1140       (set-buffer buf)
1141       (goto-char (point-min)))))
1142
1143 (defun nntp-open-telnet (buffer)
1144   (save-excursion
1145     (set-buffer buffer)
1146     (erase-buffer)
1147     (let ((proc (apply
1148                  'start-process
1149                  "nntpd" buffer nntp-telnet-command nntp-telnet-switches))
1150           (case-fold-search t))
1151       (when (memq (process-status proc) '(open run))
1152         (process-send-string proc "set escape \^X\n")
1153         (cond
1154          ((and nntp-open-telnet-envuser nntp-telnet-user-name)
1155           (process-send-string proc (concat "open " "-l" nntp-telnet-user-name
1156                                             nntp-address "\n")))
1157          (t
1158           (process-send-string proc (concat "open " nntp-address "\n"))))
1159         (cond
1160          ((not nntp-open-telnet-envuser)
1161           (nntp-wait-for-string "^\r*.?login:")
1162           (process-send-string
1163            proc (concat
1164                  (or nntp-telnet-user-name
1165                      (setq nntp-telnet-user-name (read-string "login: ")))
1166                  "\n"))))
1167         (nntp-wait-for-string "^\r*.?password:")
1168         (process-send-string
1169          proc (concat
1170                (or nntp-telnet-passwd
1171                    (setq nntp-telnet-passwd
1172                          (nnmail-read-passwd "Password: ")))
1173                "\n"))
1174         (erase-buffer)
1175         (nntp-wait-for-string nntp-telnet-shell-prompt)
1176         (process-send-string
1177          proc (concat (mapconcat 'identity nntp-telnet-parameters " ") "\n"))
1178         (nntp-wait-for-string "^\r*20[01]")
1179         (beginning-of-line)
1180         (delete-region (point-min) (point))
1181         (process-send-string proc "\^]")
1182         (nntp-wait-for-string "^telnet")
1183         (process-send-string proc "mode character\n")
1184         (accept-process-output proc 1)
1185         (sit-for 1)
1186         (goto-char (point-min))
1187         (forward-line 1)
1188         (delete-region (point) (point-max)))
1189       proc)))
1190
1191 (defun nntp-open-rlogin (buffer)
1192   "Open a connection to SERVER using rsh."
1193   (let ((proc (if nntp-rlogin-user-name
1194                   (apply 'start-process
1195                          "nntpd" buffer nntp-rlogin-program
1196                          nntp-address "-l" nntp-rlogin-user-name
1197                          nntp-rlogin-parameters)
1198                 (apply 'start-process
1199                        "nntpd" buffer nntp-rlogin-program nntp-address
1200                        nntp-rlogin-parameters))))
1201     (save-excursion
1202       (set-buffer buffer)
1203       (nntp-wait-for-string "^\r*20[01]")
1204       (beginning-of-line)
1205       (delete-region (point-min) (point))
1206       proc)))
1207
1208 (defun nntp-find-group-and-number ()
1209   (save-excursion
1210     (save-restriction
1211       (set-buffer nntp-server-buffer)
1212       (narrow-to-region (goto-char (point-min))
1213                         (or (search-forward "\n\n" nil t) (point-max)))
1214       (goto-char (point-min))
1215       ;; We first find the number by looking at the status line.
1216       (let ((number (and (looking-at "2[0-9][0-9] +\\([0-9]+\\) ")
1217                          (string-to-int
1218                           (buffer-substring (match-beginning 1)
1219                                             (match-end 1)))))
1220             group newsgroups xref)
1221         (and number (zerop number) (setq number nil))
1222         ;; Then we find the group name.
1223         (setq group
1224               (cond
1225                ;; If there is only one group in the Newsgroups header,
1226                ;; then it seems quite likely that this article comes
1227                ;; from that group, I'd say.
1228                ((and (setq newsgroups (mail-fetch-field "newsgroups"))
1229                      (not (string-match "," newsgroups)))
1230                 newsgroups)
1231                ;; If there is more than one group in the Newsgroups
1232                ;; header, then the Xref header should be filled out.
1233                ;; We hazard a guess that the group that has this
1234                ;; article number in the Xref header is the one we are
1235                ;; looking for.  This might very well be wrong if this
1236                ;; article happens to have the same number in several
1237                ;; groups, but that's life.
1238                ((and (setq xref (mail-fetch-field "xref"))
1239                      number
1240                      (string-match (format "\\([^ :]+\\):%d" number) xref))
1241                 (substring xref (match-beginning 1) (match-end 1)))
1242                (t "")))
1243         (when (string-match "\r" group)
1244           (setq group (substring group 0 (match-beginning 0))))
1245         (cons group number)))))
1246
1247 (provide 'nntp)
1248
1249 ;;; nntp.el ends here