Gnus development mailing list
 help / color / mirror / Atom feed
From: Rod Whitby <list.ding@rwhitby.net>
Subject: Re: nntp telnet connection with remote command echoes
Date: 11 Jul 2000 09:52:34 +0930	[thread overview]
Message-ID: <m3wvitbjn9.fsf@a11375-rw.asc.corp.mot.com> (raw)
In-Reply-To: Kai.Grossjohann@CS.Uni-Dortmund.DE's message of "Mon, 10 Jul 2000 13:49:42 +0200"

Kai writes:
> What you're suggesting sounds good.  Just make it configurable, and
> you should be all set.  If it was configurable via a server parameter,
> that would be even greater.

That's what I've done - I've added a 'nntp-telnet-remote-echoes'
variable that can be set in the select method or server parameters).
It defaults to nil, which should leave the operation unchanged.

Here's the diff against the CVS snapshot of nntp.el - how do I get
this tested by others, and eventually included in the distribution ?

*** /cygdrive/c/TEMP/T0001040	Tue Jul 11 09:48:05 2000
--- nntp.el	Mon Jul 10 15:12:09 2000
***************
*** 112,117 ****
--- 112,120 ----
  (defvoo nntp-telnet-switches '("-8")
    "Switches given to the telnet command.")
  
+ (defvoo nntp-telnet-remote-echoes nil
+   "If non-nil, commands echoed by the remote server will be stripped.")
+ 
  (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
***************
*** 257,266 ****
      (set-buffer (process-buffer process))
      (goto-char (point-min))
      (while (and (or (not (memq (char-after (point)) '(?2 ?3 ?4 ?5)))
! 		    (looking-at "480"))
  		(memq (process-status process) '(open run)))
!       (when (looking-at "480")
  	(nntp-handle-authinfo process))
        (nntp-accept-process-output process)
        (goto-char (point-min)))
      (prog1
--- 260,276 ----
      (set-buffer (process-buffer process))
      (goto-char (point-min))
      (while (and (or (not (memq (char-after (point)) '(?2 ?3 ?4 ?5)))
! 		    (looking-at "480")
! 		    (and nntp-telnet-remote-echoes nntp-last-command
! 			 (looking-at nntp-last-command)))
  		(memq (process-status process) '(open run)))
!       (cond
!        ((looking-at "480")
  	(nntp-handle-authinfo process))
+        ((and nntp-telnet-remote-echoes nntp-last-command
+ 	     (looking-at nntp-last-command))
+ 	(delete-region (point) (progn (forward-line 1) (point))))
+        )
        (nntp-accept-process-output process)
        (goto-char (point-min)))
      (prog1
***************
*** 419,424 ****
--- 429,438 ----
      (if (search-forward "\n" nil t)
  	t
        nil))
+    ;; An echoed command.
+    ((and nntp-telnet-remote-echoes nntp-last-command
+ 	 (looking-at nntp-last-command))
+     (delete-region (point) (progn (forward-line 1) (point))))
     ;; No result here.
     (t
      nil)))
***************
*** 542,547 ****
--- 556,565 ----
  	;; Now all replies are received.  We remove CRs.
  	(set-buffer buf)
  	(goto-char (point-min))
+ 	;; Remove an echoed command.
+ 	(when (and nntp-telnet-remote-echoes nntp-last-command
+ 		   (looking-at nntp-last-command))
+ 	  (delete-region (point) (progn (forward-line 1) (point))))
  	(while (search-forward "\r" nil t)
  	  (replace-match "" t t))
  
***************
*** 979,992 ****
      (when nntp-process-callback
        ;; do we have an error message?
        (goto-char nntp-process-start-point)
!       (if (memq (following-char) '(?4 ?5))
! 	  ;; wants credentials?
! 	  (if (looking-at "480")
! 	      (nntp-handle-authinfo nntp-process-to-buffer)
! 	    ;; report error message.
! 	    (nntp-snarf-error-message)
! 	    (nntp-do-callback nil))
  
  	;; got what we expect?
  	(goto-char (point-max))
  	(when (re-search-backward
--- 997,1017 ----
      (when nntp-process-callback
        ;; do we have an error message?
        (goto-char nntp-process-start-point)
!       (cond
!        ((memq (following-char) '(?4 ?5))
! 	;; wants credentials?
! 	(if (looking-at "480")
! 	    (nntp-handle-authinfo nntp-process-to-buffer)
! 	  ;; report error message.
! 	  (nntp-snarf-error-message)
! 	  (nntp-do-callback nil)))
! 
!        ;; Remove echoed command.
!        ((and nntp-telnet-remote-echoes nntp-last-command
! 	     (looking-at nntp-last-command))
! 	(delete-region (point) (progn (forward-line 1) (point))))
  
+        (t
  	;; got what we expect?
  	(goto-char (point-max))
  	(when (re-search-backward
***************
*** 1008,1014 ****
  	  ;; report it.
  	  (goto-char (point-max))
  	  (nntp-do-callback
! 	   (buffer-name (get-buffer nntp-process-to-buffer))))))))
  
  (defun nntp-do-callback (arg)
    (let ((callback nntp-process-callback)
--- 1033,1039 ----
  	  ;; report it.
  	  (goto-char (point-max))
  	  (nntp-do-callback
! 	   (buffer-name (get-buffer nntp-process-to-buffer)))))))))
  
  (defun nntp-do-callback (arg)
    (let ((callback nntp-process-callback)

-- 
-- Rod Whitby, Snr Staff Engr, Electronic Design Automation --
-- Motorola Australia Software Centre - Adelaide, Australia --
-- Phone: +61 8 8203 3526, Fax: +61 8 8203 3501, <GMT+9:30> --




  reply	other threads:[~2000-07-11  0:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-05 23:32 Rod Whitby
2000-07-10  5:22 ` list.ding
2000-07-10 11:49   ` Kai Großjohann
2000-07-11  0:22     ` Rod Whitby [this message]
2000-08-14 19:05 ` Lars Magne Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3wvitbjn9.fsf@a11375-rw.asc.corp.mot.com \
    --to=list.ding@rwhitby.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).