1 ;;; nntp.el --- NNTP (RFC977) Interface for GNU Emacs
2 ;; Copyright (C) 1987,88,89,90,92,93,94,95 Free Software Foundation, Inc.
4 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
5 ;; Lars Ingebrigtsen <larsi@ifi.uio.no>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
32 (autoload 'news-setup "rnewspost")
33 (autoload 'news-reply-mode "rnewspost"))
35 (defvar nntp-server-hook nil
36 "Hooks for the NNTP server.
37 If the kanji code of the NNTP server is different from the local kanji
38 code, the correct kanji code of the buffer associated with the NNTP
39 server must be specified as follows:
41 \(setq nntp-server-hook
44 ;; Server's Kanji code is EUC (NEmacs hack).
45 (make-local-variable 'kanji-fileio-code)
46 (setq kanji-fileio-code 0))))
48 If you'd like to change something depending on the server in this
49 hook, use the variable `nntp-server-name'.")
51 (defvar nntp-server-opened-hook
54 (nntp-send-command "MODE" "READER")))
55 "Hook used for sending commands to the server at startup.
56 It is used by default to send the \"MODE READER\" command to the
57 server. This makes innd servers spawn an nnrpd server.
58 Other useful commands might be \"AUTHINFO\".")
60 (defvar nntp-large-newsgroup 50
61 "The number of the articles which indicates a large newsgroup.
62 If the number of the articles is greater than the value, verbose
63 messages will be shown to indicate the current status.")
65 (defvar nntp-buggy-select (memq system-type '(usg-unix-v fujitsu-uts))
66 "t if your select routine is buggy.
67 If the select routine signals error or fall into infinite loop while
68 waiting for the server response, the variable must be set to t. In
69 case of Fujitsu UTS, it is set to T since `accept-process-output'
70 doesn't work properly.")
72 (defvar nntp-maximum-request 400
73 "The maximum number of the requests sent to the NNTP server at one time.
74 If Emacs hangs up while retrieving headers, set the variable to a
77 (defvar nntp-debug-read 10000
78 "Display '...' every 10Kbytes of a message being received if it is non-nil.
79 If it is a number, dots are displayed per the number.")
81 (defvar nntp-nov-is-evil nil
82 "If non-nil, nntp will never attempt to use XOVER when talking to the server.")
84 (defvar nntp-xover-commands '("XOVER" "XOVERVIEW")
85 "List of strings that are used as commands to fetch NOV lines from a server.
86 The strings are tried in turn until a positive response is gotten. If
87 none of the commands are successful, nntp will just grab headers one
91 (defconst nntp-version "nntp 4.0"
92 "Version numbers of this version of NNTP.")
94 (defvar nntp-server-name nil
95 "The name of the host running NNTP server.")
97 (defvar nntp-server-buffer nil
98 "Buffer associated with NNTP server process.")
100 (defvar nntp-server-process nil
101 "The NNTP server process.
102 You'd better not use this variable in NNTP front-end program but
103 instead use `nntp-server-buffer'.")
105 (defvar nntp-status-string nil
106 "Save the server response message.
107 You'd better not use this variable in NNTP front-end program but
108 instead call function `nntp-status-message' to get status message.")
110 (defvar nntp-current-server "")
112 (defvar nntp-server-alist nil)
114 (defvar nntp-server-xover t)
116 (defvar nntp-current-group "")
118 ;;; Interface funtions.
120 (defun nntp-retrieve-headers (sequence &optional newsgroup server)
121 "Retrieve the headers to the articles in SEQUENCE."
122 (nntp-possibly-change-server newsgroup server)
124 (set-buffer nntp-server-buffer)
126 (if (and (not gnus-nov-is-evil)
127 (not nntp-nov-is-evil)
128 (nntp-retrieve-headers-with-xover sequence))
130 (let ((number (length sequence))
133 (last-point (point-min)))
134 ;; Send HEAD command.
136 (nntp-send-strings-to-server "HEAD" (car sequence))
137 (setq sequence (cdr sequence))
138 (setq count (1+ count))
139 ;; Every 400 header requests we have to read stream in order
140 ;; to avoid deadlock.
141 (if (or (null sequence) ;All requests have been sent.
142 (zerop (% count nntp-maximum-request)))
144 (accept-process-output)
146 (goto-char last-point)
148 (while (re-search-forward "^[0-9]" nil t)
149 (setq received (1+ received)))
150 (setq last-point (point))
152 ;; If number of headers is greater than 100, give
153 ;; informative messages.
154 (and (numberp nntp-large-newsgroup)
155 (> number nntp-large-newsgroup)
156 (zerop (% received 20))
157 (message "NNTP: Receiving headers... %d%%"
158 (/ (* received 100) number)))
159 (nntp-accept-response))
162 ;; Wait for text of last command.
163 (goto-char (point-max))
164 (re-search-backward "^[0-9]" nil t)
165 (if (looking-at "^[23]")
167 (goto-char (- (point-max) 3))
168 (not (looking-at "^\\.\r$")))
169 (nntp-accept-response)))
170 (and (numberp nntp-large-newsgroup)
171 (> number nntp-large-newsgroup)
172 (message "NNTP: Receiving headers... done"))
174 ;; Now all of replies are received.
175 (setq received number)
176 ;; First, fold continuation lines.
177 (goto-char (point-min))
178 (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
179 (replace-match " " t t))
181 (goto-char (point-min))
182 (while (re-search-forward "\r" nil t)
183 (replace-match "" t t))
186 (defun nntp-open-server (server &optional service)
187 "Open news server on SERVER.
188 If SERVER is nil, use value of environment variable `NNTPSERVER'.
189 If optional argument SERVICE is non-nil, open by the service name."
190 (let ((server (or server (getenv "NNTPSERVER")))
192 (setq nntp-status-string "")
193 (message "nntp: Connecting to server on %s..." server)
194 (cond ((and server (nntp-open-server-internal server service))
195 (setq nntp-current-server server)
196 (setq status (nntp-wait-for-response "^[23].*\r$"))
197 ;; Do check unexpected close of connection.
198 ;; Suggested by feldmark@hanako.stars.flab.fujitsu.junet.
201 (set-process-sentinel nntp-server-process
202 'nntp-default-sentinel)
203 ;; You can send commands at startup like AUTHINFO here.
204 ;; Added by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>
205 (run-hooks 'nntp-server-opened-hook))
206 ;; We have to close connection here, since function
207 ;; `nntp-server-opened' may return incorrect status.
208 (nntp-close-server-internal server)
211 (setq nntp-status-string "NNTP server is not specified."))
217 (defun nntp-close-server (&optional server)
219 (nntp-possibly-change-server nil server)
222 ;; Un-set default sentinel function before closing connection.
223 (and nntp-server-process
224 (eq 'nntp-default-sentinel
225 (process-sentinel nntp-server-process))
226 (set-process-sentinel nntp-server-process nil))
227 ;; We cannot send QUIT command unless the process is running.
228 (if (nntp-server-opened)
229 (nntp-send-command nil "QUIT"))
231 (nntp-close-server-internal server)
234 (fset 'nntp-request-quit (symbol-function 'nntp-close-server))
236 (defun nntp-server-opened (&optional server)
237 "Return server process status.
238 If the stream is opened, return non-nil, otherwise return nil."
239 (if (or server nntp-current-server)
240 (let ((process (nth 1 (assoc (or server nntp-current-server)
241 nntp-server-alist))))
243 (memq (process-status process) '(open run))))))
245 (defun nntp-status-message (&optional server)
246 "Return server status response as string."
247 (if (and nntp-status-string
249 (string-match "[0-9][0-9][0-9][ \t]+\\([^\r]*\\).*$"
251 (substring nntp-status-string (match-beginning 1) (match-end 1))
252 ;; Empty message if nothing.
256 (defun nntp-request-article (id &optional newsgroup server buffer)
257 "Select article by message ID (or number)."
258 (nntp-possibly-change-server newsgroup server)
261 (if buffer (set-process-buffer nntp-server-process buffer))
262 (let ((nntp-server-buffer (or buffer nntp-server-buffer)))
263 ;; If NEmacs, end of message may look like: "\256\215" (".^M")
265 (nntp-send-command "^\\.\r$" "ARTICLE" id)
266 (nntp-decode-text))))
267 (if buffer (set-process-buffer nntp-server-process nntp-server-buffer))))
269 (defun nntp-request-body (id &optional newsgroup server)
270 "Select article body by message ID (or number)."
271 (nntp-possibly-change-server newsgroup server)
273 ;; If NEmacs, end of message may look like: "\256\215" (".^M")
274 (nntp-send-command "^\\.\r$" "BODY" id)
278 (defun nntp-request-head (id &optional newsgroup server)
279 "Select article head by message ID (or number)."
280 (nntp-possibly-change-server newsgroup server)
282 (nntp-send-command "^\\.\r$" "HEAD" id)
286 (defun nntp-request-stat (id &optional newsgroup server)
287 "Select article by message ID (or number)."
288 (nntp-possibly-change-server newsgroup server)
289 (nntp-send-command "^[23].*\r$" "STAT" id))
291 (defun nntp-request-group (group &optional server dont-check)
293 (if (nntp-possibly-change-server nil server)
295 (nntp-send-command "^.*\r$" "GROUP" group)
298 (defun nntp-close-group (group &optional server)
301 (defun nntp-request-list (&optional server)
302 "List active newsgroups."
303 (nntp-possibly-change-server nil server)
305 (nntp-send-command "^\\.\r$" "LIST")
309 (defun nntp-request-list-newsgroups (&optional server)
310 "List newsgroups (defined in NNTP2)."
311 (nntp-possibly-change-server nil server)
313 (nntp-send-command "^\\.\r$" "LIST NEWSGROUPS")
317 (defun nntp-request-newgroups (date &optional server)
318 "List new groups (defined in NNTP2)."
319 (nntp-possibly-change-server nil server)
321 (nntp-send-command "^\\.\r$" "NEWGROUPS" date)
324 (defun nntp-request-list-distributions (&optional server)
325 "List distributions (defined in NNTP2)."
326 (nntp-possibly-change-server nil server)
328 (nntp-send-command "^\\.\r$" "LIST DISTRIBUTIONS")
332 (defun nntp-request-last (&optional newsgroup server)
333 "Set current article pointer to the previous article
334 in the current news group."
335 (nntp-possibly-change-server newsgroup server)
336 (nntp-send-command "^[23].*\r$" "LAST"))
338 (defun nntp-request-next (&optional newsgroup server)
339 "Advance current article pointer."
340 (nntp-possibly-change-server newsgroup server)
341 (nntp-send-command "^[23].*\r$" "NEXT"))
343 (defun nntp-request-post (&optional server)
344 "Post a new news in current buffer."
345 (nntp-possibly-change-server nil server)
346 (if (nntp-send-command "^[23].*\r$" "POST")
349 (nntp-send-region-to-server (point-min) (point-max))
350 ;; 1.2a NNTP's post command is buggy. "^M" (\r) is not
351 ;; appended to end of the status message.
352 (nntp-wait-for-response "^[23].*$")
355 (defun nntp-request-post-buffer (method header article-buffer group info)
356 (let (from subject date to followup-to newsgroups message-of
357 references distribution message-id follow-to)
359 (set-buffer (get-buffer-create "*post-news*"))
361 (if (and (buffer-modified-p)
363 (not (y-or-n-p "Unsent article being composed; erase it? ")))
366 (if (eq method 'post)
367 (news-setup nil nil nil header article-buffer)
369 (set-buffer article-buffer)
370 (goto-char (point-min))
371 (narrow-to-region (point-min)
372 (progn (search-forward "\n\n") (point)))
373 (if (and (boundp 'gnus-followup-to-function)
374 gnus-followup-to-function)
375 (setq follow-to (funcall gnus-followup-to-function group)))
376 (setq from (header-from header))
377 (setq date (header-date header))
380 (string-match " *at \\| *@ \\| *(\\| *<" from)))
382 (concat (if stop-pos (substring from 0 stop-pos) from)
383 "'s message of " date))))
384 (setq subject (header-subject header))
385 (or (string-match "^[Rr][Ee]:" subject)
386 (setq subject (concat "Re: " subject)))
387 (setq followup-to (mail-fetch-field "followup-to"))
388 (if (or (null gnus-use-followup-to) ;Ignore followup-to: field.
389 (string-equal "" followup-to) ;Bogus header.
390 (string-equal "poster" followup-to)) ;Poster
391 (setq followup-to nil))
392 (setq newsgroups (or followup-to (mail-fetch-field "newsgroups")))
393 (setq references (header-references header))
394 (setq distribution (mail-fetch-field "distribution"))
395 ;; Remove bogus distribution.
396 (and (string= distribution "world")
397 (setq distribution nil))
398 (setq message-id (header-id header))
400 (setq news-reply-yank-from from)
401 (setq news-reply-yank-message-id message-id)
402 ;; Prevent getting BCC or FCC fields inserted for both mail
404 (let ((mail-self-blind
405 (and (not gnus-mail-self-blind) mail-self-blind))
406 (mail-archive-file-name
407 (and (not gnus-author-copy) mail-archive-file-name)))
409 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
410 (if (eq gnus-auto-mail-to-author 'ask)
411 (and (y-or-n-p "Also send mail to author? ") from)
412 (and gnus-auto-mail-to-author from))
413 subject message-of newsgroups article-buffer))
414 ;; Fold long references line to follow RFC1036.
415 (mail-position-on-field "References")
416 (let ((begin (- (point) (length "References: ")))
419 (if references (insert references))
420 (if (and references message-id) (insert " "))
421 (if message-id (insert message-id))
422 ;; The region must end with a newline to fill the region
423 ;; without inserting extra newline.
424 (fill-region-as-paragraph begin (1+ (point))))
427 (mail-position-on-field "Distribution")
428 (insert distribution)))))
431 ;;; Internal functions.
433 (defun nntp-default-sentinel (proc status)
434 "Default sentinel function for NNTP server process."
435 (let ((servers nntp-server-alist))
437 (not (equal proc (nth 1 (car servers)))))
438 (setq servers (cdr servers)))
439 (message "nntp: Connection closed to server %s."
440 (or (car (car servers)) "(none)"))
443 ;; Encoding and decoding of NNTP text.
445 (defun nntp-decode-text ()
446 "Decode text transmitted by NNTP.
447 0. Delete status line.
448 1. Delete `^M' at end of line.
449 2. Delete `.' at end of buffer (end of text mark).
450 3. Delete `.' at beginning of line."
452 (set-buffer nntp-server-buffer)
453 ;; Insert newline at end of buffer.
454 (goto-char (point-max))
457 ;; Delete status line.
458 (goto-char (point-min))
459 (delete-region (point) (progn (forward-line 1) (point)))
460 ;; Delete `^M' at end of line.
461 ;; (replace-regexp "\r$" "")
464 (if (= (preceding-char) ?\r)
468 ;; Delete `.' at end of buffer (end of text mark).
469 (goto-char (point-max))
470 (forward-line -1) ;(beginning-of-line)
471 (if (looking-at "^\\.$")
472 (delete-region (point) (progn (forward-line 1) (point))))
473 ;; Replace `..' at beginning of line with `.'.
474 (goto-char (point-min))
475 ;; (replace-regexp "^\\.\\." ".")
476 (while (search-forward "\n.." nil t)
480 (defun nntp-encode-text ()
481 "Encode text in current buffer for NNTP transmission.
482 1. Insert `.' at beginning of line.
483 2. Insert `.' at end of buffer (end of text mark)."
485 ;; Insert newline at end of buffer.
486 (goto-char (point-max))
489 ;; Replace `.' at beginning of line with `..'.
490 (goto-char (point-min))
491 ;; (replace-regexp "^\\." "..")
492 (while (search-forward "\n." nil t)
494 ;; Insert `.' at end of buffer (end of text mark).
495 (goto-char (point-max))
501 ;;; Synchronous Communication with NNTP Server.
504 (defun nntp-send-command (response cmd &rest args)
505 "Wait for server RESPONSE after sending CMD and optional ARGS to server."
507 ;; Clear communication buffer.
508 (set-buffer nntp-server-buffer)
510 (apply 'nntp-send-strings-to-server cmd args)
512 (nntp-wait-for-response response)
516 (defun nntp-wait-for-response (regexp)
517 "Wait for server response which matches REGEXP."
521 (dotnum 0) ;Number of "." being displayed.
522 (dotsize ;How often "." displayed.
523 (if (numberp nntp-debug-read) nntp-debug-read 10000)))
524 (set-buffer nntp-server-buffer)
525 ;; Wait for status response (RFC977).
526 ;; 1xx - Informative message.
528 ;; 3xx - Command ok so far, send the rest of it.
529 ;; 4xx - Command was correct, but couldn't be performed for some
531 ;; 5xx - Command unimplemented, or incorrect, or a serious
532 ;; program error occurred.
533 (nntp-accept-response)
535 (goto-char (point-min))
536 (cond ((looking-at "[23]")
541 (t (nntp-accept-response))
543 ;; Save status message.
545 (setq nntp-status-string
546 (buffer-substring (point-min) (point)))
551 (goto-char (point-max))
552 (forward-line -1) ;(beginning-of-line)
553 ;;(message (buffer-substring
555 ;; (save-excursion (end-of-line) (point))))
556 (if (looking-at regexp)
559 (let ((newnum (/ (buffer-size) dotsize)))
560 (if (not (= dotnum newnum))
563 (message "NNTP: Reading %s"
564 (make-string dotnum ?.))))))
565 (nntp-accept-response)
566 ;;(if nntp-debug-read (message ""))
569 (if (and nntp-debug-read (> dotnum 0))
571 ;; Successfully received server response.
578 ;;; Low-Level Interface to NNTP Server.
581 (defun nntp-retrieve-headers-with-xover (sequence)
582 (if (not nntp-server-xover)
584 (let ((range (format "%d-%d" (car sequence)
585 (nntp-last-element sequence))))
587 (if (stringp nntp-server-xover)
588 (nntp-send-command "^\\.\r$" nntp-server-xover range)
589 (let ((commands nntp-xover-commands))
591 (eq t nntp-server-xover))
592 (nntp-send-command "^\\.\r$" (car commands) range)
594 (set-buffer nntp-server-buffer)
596 (if (looking-at "[23]")
597 (setq nntp-server-xover (car commands))))
598 (setq commands (cdr commands)))
599 (if (eq t nntp-server-xover)
600 (setq nntp-server-xover nil))
601 (setcar (nthcdr 2 (assoc nntp-current-server nntp-server-alist))
604 (if nntp-server-xover (nntp-decode-text) (erase-buffer))))))
606 (defun nntp-send-strings-to-server (&rest strings)
607 "Send list of STRINGS to news server as command and its arguments."
608 (let ((cmd (car strings))
609 (strings (cdr strings)))
610 ;; Command and each argument must be separated by one or more spaces.
612 (setq cmd (concat cmd " " (car strings)))
613 (setq strings (cdr strings)))
614 ;; Command line must be terminated by a CR-LF.
615 (if (not (nntp-server-opened nntp-current-server))
617 (nntp-close-server nntp-current-server)
618 (if (not (nntp-open-server nntp-current-server))
619 (error (nntp-status-message)))
621 (set-buffer nntp-server-buffer)
623 (process-send-string nntp-server-process (concat cmd "\r\n"))
626 (defun nntp-send-region-to-server (begin end)
627 "Send current buffer region (from BEGIN to END) to news server."
629 ;; We have to work in the buffer associated with NNTP server
630 ;; process because of NEmacs hack.
631 (copy-to-buffer nntp-server-buffer begin end)
632 (set-buffer nntp-server-buffer)
633 (setq begin (point-min))
634 (setq end (point-max))
635 ;; `process-send-region' does not work if text to be sent is very
636 ;; large. I don't know maximum size of text sent correctly.
638 (size 100)) ;Size of text sent at once.
640 (narrow-to-region begin end)
643 ;;(setq last (min end (+ (point) size)))
644 ;; NEmacs gets confused if character at `last' is Kanji.
645 (setq last (save-excursion
646 (goto-char (min end (+ (point) size)))
647 (or (eobp) (forward-char 1)) ;Adjust point
649 (process-send-region nntp-server-process (point) last)
650 ;; I don't know whether the next codes solve the known
651 ;; problem of communication error of GNU Emacs.
652 (accept-process-output)
656 ;; We cannot erase buffer, because reply may be received.
657 (delete-region begin end)
660 (defun nntp-open-server-internal (server &optional service)
661 "Open connection to news server on SERVER by SERVICE (default is nntp)."
664 ;; Use TCP/IP stream emulation package if needed.
665 (or (fboundp 'open-network-stream)
667 ;; Initialize communication buffer.
668 (nnheader-init-server-buffer)
669 (set-buffer nntp-server-buffer)
672 (open-network-stream "nntpd" (current-buffer)
673 server (or service "nntp"))
676 (setq nntp-server-process proc)
677 ;; Suggested by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
678 (process-kill-without-query proc)
679 (setq nntp-server-xover t)
680 (setq nntp-server-name server)
681 (setq nntp-server-alist (cons (list server nntp-server-process t)
683 ;; It is possible to change kanji-fileio-code in this hook.
684 (run-hooks 'nntp-server-hook)
685 nntp-server-process)))))
687 (defun nntp-close-server-internal (&optional server)
688 "Close connection to news server."
689 (nntp-possibly-change-server nil server)
690 (if nntp-server-process
691 (delete-process nntp-server-process))
692 (setq nntp-server-process nil)
693 (let* ((servers nntp-server-alist)
695 (if (and servers (string= (car (car servers)) server))
696 (setq nntp-server-alist (cdr nntp-server-alist))
697 (setq servers (cdr servers))
699 (if (string= (car (car servers)) server)
700 (setcdr prev (cdr servers)))
702 (setq servers (cdr servers))))))
704 (defun nntp-request-close ()
705 "Close all server connections."
706 (while nntp-server-alist
707 (delete-process (car (cdr (car nntp-server-alist))))
708 (setq nntp-server-alist (cdr nntp-server-alist)))
709 (setq nntp-current-server "")
710 (setq nntp-server-process nil))
712 (defun nntp-accept-response ()
713 "Read response of server.
714 It is well-known that the communication speed will be much improved by
715 defining this function as macro."
716 ;; To deal with server process exiting before
717 ;; accept-process-output is called.
718 ;; Suggested by Jason Venner <jason@violet.berkeley.edu>.
719 ;; This is a copy of `nntp-default-sentinel'.
720 (or (memq (process-status nntp-server-process) '(open run))
721 (error "NNTP: Connection closed."))
722 (if nntp-buggy-select
724 ;; We cannot use `accept-process-output'.
725 ;; Fujitsu UTS requires messages during sleep-for. I don't know why.
726 (message "NNTP: Reading...")
729 (condition-case errorcode
730 (accept-process-output nntp-server-process)
732 (cond ((string-equal "select error: Invalid argument" (nth 1 errorcode))
733 ;; Ignore select error.
737 (signal (car errorcode) (cdr errorcode))
741 (defun nntp-last-element (list)
742 "Return last element of LIST."
744 (setq list (cdr list)))
747 (defun nntp-possibly-change-server (newsgroup server)
748 (let (result changed-server)
749 ;; First see if we need to change the server - or even open a new
751 (if (and server (not (string= server nntp-current-server)))
753 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>.
754 (if (or (assoc server nntp-server-alist)
755 (nntp-open-server server))
756 ;; `nntp-open-server' may change `nntp-server-alist', so
758 (let ((info (assoc server nntp-server-alist)))
759 (setq nntp-current-server server)
760 ;; Variable for backwards compatability.
761 (setq nntp-server-name server)
762 (setq nntp-server-process (nth 1 info))
763 (setq nntp-server-xover (nth 2 info))
764 (setq changed-server t)
767 ;; The we see whether it is necessary to change newsgroup.
768 (if (and newsgroup result (or (not (string= newsgroup nntp-current-group))
771 (setq result (nntp-request-group newsgroup server))
772 (setq nntp-current-group newsgroup)))
777 ;;; nntp.el ends here