Two pre-made functions are `nntp-open-network-stream', which is the
default, and simply connects to some port or other on the remote
-system (see nntp-port-number). The other are `nntp-open-rlogin', which
-does an rlogin on the remote system, and then does a telnet to the
-NNTP server available there (see nntp-rlogin-parameters) and `nntp-open-telnet' which
-telnets to a remote system, logs in and does the same")
+system (see nntp-port-number). The other are `nntp-open-rlogin',
+which does an rlogin on the remote system, and then does a telnet to
+the NNTP server available there (see nntp-rlogin-parameters) and
+`nntp-open-telnet' which telnets to a remote system, logs in and does
+the same.")
(defvoo nntp-rlogin-parameters '("telnet" "-8" "${NNTPSERVER:=news}" "nntp")
"*Parameters to `nntp-open-login'.
(defvoo nntp-telnet-passwd nil
"Password to use to log in via telnet with.")
+(defvoo nntp-telnet-command "telnet"
+ "Command used to start telnet.")
+
+(defvoo nntp-telnet-switches '("-8")
+ "Switches given to the telnet command.")
+
(defvoo nntp-end-of-line "\r\n"
"String to use on the end of lines when talking to the NNTP server.
This is \"\\r\\n\" by default, but should be \"\\n\" when
none of the commands are successful, nntp will just grab headers one
by one.")
-(defvoo nntp-nov-gap 20
+(defvoo nntp-nov-gap 5
"*Maximum allowed gap between two articles.
If the gap between two consecutive articles is bigger than this
variable, split the XOVER request into two requests.")
(defvoo nntp-warn-about-losing-connection t
"*If non-nil, beep when a server closes connection.")
+;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
+(defvoo nntp-coding-system-for-read 'binary
+ "*Coding system to read from NNTP.")
+
+(defvoo nntp-coding-system-for-write 'binary
+ "*Coding system to write to NNTP.")
+
\f
;;; Internal variables.
(save-excursion
(set-buffer (process-buffer process))
(goto-char (point-min))
- (while (or (not (memq (following-char) '(?2 ?3 ?4 ?5)))
+ (while (or (not (memq (char-after (point)) '(?2 ?3 ?4 ?5)))
(looking-at "480"))
(when (looking-at "480")
(erase-buffer)
(when (nntp-send-command-and-decode
"\r?\n\\.\r?\n" "ARTICLE"
(if (numberp article) (int-to-string article) article))
- (when (and buffer
- (not (equal buffer nntp-server-buffer)))
- (save-excursion
- (set-buffer nntp-server-buffer)
- (copy-to-buffer buffer (point-min) (point-max))
- (nntp-find-group-and-number)))
- (nntp-find-group-and-number)))
+ (if (and buffer
+ (not (equal buffer nntp-server-buffer)))
+ (save-excursion
+ (set-buffer nntp-server-buffer)
+ (copy-to-buffer buffer (point-min) (point-max))
+ (nntp-find-group-and-number))
+ (nntp-find-group-and-number))))
(deffoo nntp-request-head (article &optional group server)
(nntp-possibly-change-group group server)
- (when (nntp-send-command-and-decode
+ (when (nntp-send-command
"\r?\n\\.\r?\n" "HEAD"
(if (numberp article) (int-to-string article) article))
- (nntp-find-group-and-number)))
+ (prog1
+ (nntp-find-group-and-number)
+ (nntp-decode-text))))
(deffoo nntp-request-body (article &optional group server)
(nntp-possibly-change-group group server)
(let* ((pbuffer (nntp-make-process-buffer buffer))
(process
(condition-case ()
- (funcall nntp-open-connection-function pbuffer)
+ ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
+ (let ((coding-system-for-read nntp-coding-system-for-read)
+ (coding-system-for-write nntp-coding-system-for-write))
+ (funcall nntp-open-connection-function pbuffer))
(error nil)
(quit nil))))
(when process
(insert "\n"))
;; Insert `.' at end of buffer (end of text mark).
(goto-char (point-max))
- (insert "." nntp-end-of-line)))
+ (insert ".\n")
+ (goto-char (point-min))
+ (while (not (eobp))
+ (end-of-line)
+ (delete-char 1)
+ (insert nntp-end-of-line))))
(defun nntp-retrieve-headers-with-xover (articles &optional fetch-old)
(set-buffer nntp-server-buffer)
(save-excursion
(set-buffer buffer)
(erase-buffer)
- (let ((proc (start-process
- "nntpd" buffer "telnet" "-8"))
+ (let ((proc (apply
+ 'start-process
+ "nntpd" buffer nntp-telnet-command nntp-telnet-switches))
(case-fold-search t))
(when (memq (process-status proc) '(open run))
(process-send-string proc "set escape \^X\n")