--- nntp.el.old 2002-12-09 13:22:57.000000000 +0100 +++ nntp.el 2002-12-10 18:48:10.000000000 +0100 @@ -251,6 +251,9 @@ (autoload 'mail-source-read-passwd "mail-source") (autoload 'open-ssl-stream "ssl")) +(defvar nntp-delete-echo nil) + + ;;; Internal functions. @@ -408,9 +411,9 @@ ;; If nothing to wait for, still remove possibly echo'ed commands. ;; We don't have echos if nntp-open-connection-function ;; is `nntp-open-network-stream', so we skip this in that case. - (unless (or wait-for - (equal nntp-open-connection-function - 'nntp-open-network-stream)) + + (when (and (not wait-for) + nntp-delete-echo) (nntp-accept-response) (save-excursion (set-buffer buffer) @@ -435,7 +438,8 @@ nntp-server-buffer wait-for nnheader-callback-function) ;; If nothing to wait for, still remove possibly echo'ed commands - (unless wait-for + (when (and (not wait-for) + nntp-delete-echo) (nntp-accept-response) (save-excursion (set-buffer buffer) @@ -465,14 +469,15 @@ nntp-server-buffer wait-for nnheader-callback-function t) ;; If nothing to wait for, still remove possibly echo'ed commands - (unless wait-for + (unless (and (not wait-for) + nntp-delete-echo) (nntp-accept-response) (save-excursion - (set-buffer buffer) - (goto-char pos) - (if (looking-at (regexp-quote command)) - (delete-region pos (progn (forward-line 1) (gnus-point-at-bol)))) - ))) + (set-buffer buffer) + (goto-char pos) + (if (looking-at (regexp-quote command)) + (delete-region pos (progn (forward-line 1) (gnus-point-at-bol)))) + ))) (nnheader-report 'nntp "Couldn't open connection to %s." nntp-address)))) @@ -1031,7 +1036,22 @@ (set-buffer pbuffer) (nntp-read-server-type) (erase-buffer) + + ;; Send a No-Op command to recognize if we need to delete local echo + ;; in future. This only makes sense, if we are using a non-direct connection... + (unless (equal nntp-open-connection-function + 'nntp-open-network-stream) + (let ((command "MyNOOP") + (pos (point))) + (nntp-send-string process command) + (accept-process-output process) + (goto-char pos) + (when (looking-at (regexp-quote command)) + (setq nntp-delete-echo t)))) + + (erase-buffer) (set-buffer nntp-server-buffer) + (let ((nnheader-callback-function nil)) (run-hooks 'nntp-server-opened-hook) (nntp-send-authinfo t))))