[mew-dist 19669] Re: request for nntp support

Kidzu Takashi ( 木津 隆史 ) kizu at example.com
2001年 11月 19日 (月) 00:28:47 JST


木津と申します。

>>>>> In X-Mail-Count: 19538, Kidzu Takashi (木津 隆史) <kizu at example.com> writes:

木津> POST(と AUTHINFO)さえ喋れれば幸せになる人はそれなりにいるのではな
木津> いかと。

今の mew-nntp.el は authinfo を喋ってくれないので、ムリヤリ喋らせてみま
した。

mew-config-alist で authinfo を喋って欲しい case に
	 ("nntp-authuser"     . "NAME")
         ("nntp-password"     . "PASSWORD")
を設定しておくと、
	authinfo simple NAME PASSWORD
を送ってから、post なり xover なりへいくはずです。

宜しければ使って下さい。

P.S.
パスワードをこういうところに書いてはいけないのはわかっています。しかし、
Gnus の実装が「~/.authinfo に書いとけ」なので、それよりたいして弱くない
から構わない…かな?

木津 隆史@情報数理系専攻.基礎工学研究科.阪大
kizu at example.com

-------------- next part --------------
--- mew-nntp.el.orig	Thu Nov  8 17:23:27 2001
+++ mew-nntp.el	Sun Nov 18 23:50:42 2001
@@ -15,7 +15,8 @@
 (defvar mew-nntp-info-list
   '("server" "port" "process" "ssh-process" "status" "msgs" "cnt"
     "size" "newsgroup" "fld" "ssh-server" "queue" "lock" "fcc" "case"
-    "error" "raw-header" "msgid" "logtime" "string"))
+    "error" "raw-header" "msgid" "logtime" "string"
+    "authuser" "password"))
 
 (mew-info-defun "mew-nntp-" mew-nntp-info-list)
 
@@ -47,14 +48,18 @@
 ;;;
 
 (defvar mew-nntp-fsm
-  '(("greeting" nil ("200" . "group"))
+  '(("authgreet" nil ("200" . "authinfo"))
+    ("authinfo"  nil ("281" . "group"))
+    ("greeting" nil ("200" . "group"))
     ("group"    nil ("211" . "xover"))
     ("xover"	t   ("224" . "pre-article"))
     ("article"  t   ("220" . "post-article") ("221" . "post-article"))
     ("quit"     nil ("205" . "noop")))) ;; xxx
 
 (defvar mew-nntp-fsm2
-  '(("greeting"  nil ("200" . "post"))
+  '(("authgreet" nil ("200" . "authinfo"))
+    ("authinfo"  nil ("281" . "post"))
+    ("greeting"  nil ("200" . "post"))
     ("post"      nil ("340" . "post-post"))
     ("post-post" nil ("240" . "quit")) ;; xxx
     ("quit"      nil ("205" . "done"))
@@ -80,6 +85,8 @@
 	 (sshsrv (mew-nntp-ssh-server case))
 	 (pnm (mew-nntp-info-name case))
 	 (buf (get-buffer-create (mew-nntp-buffer-name pnm)))
+	 (authuser (mew-nntp-authuser case))
+	 (password (mew-nntp-password case))
 	 process sshpro sshname lport)
     (if (mew-nntp-get-process pnm)
 	(message "Another NNTP process is running. Try later")
@@ -99,7 +106,12 @@
 	(mew-nntp-set-port pnm port)
 	(mew-nntp-set-ssh-process pnm sshpro)
 	(mew-nntp-set-cnt pnm 0)
-	(mew-nntp-set-status pnm "greeting")
+;	(mew-nntp-set-status pnm "greeting")
+	(if (not authuser)
+	    (mew-nntp-set-status pnm "greeting")
+	  (mew-nntp-set-authuser pnm authuser)
+	  (mew-nntp-set-password pnm password)
+	  (mew-nntp-set-status pnm "authgreet"))
 	(mew-nntp-set-size pnm mew-nntp-size)
 	(mew-nntp-set-fld pnm newsgroup)
 	(mew-nntp-set-newsgroup pnm (substring newsgroup 1)) ;; xxx
@@ -403,6 +415,8 @@
 	 (server (mew-nntp-get-server pnm))
 	 (port (mew-nntp-get-port pnm))
 	 (ssh-server (mew-nntp-get-ssh-server pnm))
+	 (authuser (mew-nntp-authuser case))
+	 (password (mew-nntp-password case))
 	 sshpro sshname errmsg opened lport)
     (cond
      ((and (processp process) (not unlock) (mew-nntp-get-lock pnm))
@@ -433,7 +447,12 @@
 	    (if lport (setq process (mew-nntp-open pnm "localhost" lport)))))
 	(cond
 	 (process
-	  (mew-nntp-set-status pnm "greeting")
+;	  (mew-nntp-set-status pnm "greeting")
+	  (if (not authuser)
+	      (mew-nntp-set-status pnm "greeting")
+	    (mew-nntp-set-authuser pnm authuser)
+	    (mew-nntp-set-password pnm password)
+	    (mew-nntp-set-status pnm "authgreet"))
 	  (set-process-buffer process (current-buffer))
 	  (set-process-sentinel process 'mew-nntp-sentinel2)
 	  (set-process-filter process 'mew-nntp-filter2)
@@ -508,6 +527,14 @@
   (let ((buf (process-buffer pro)))
     (set-process-buffer pro nil)
     (mew-remove-buffer buf)))
+
+; ("authinfo simple %s %s", authuser, password, を送る)
+(defun mew-nntp-command-authinfo (pro pnm)
+  (let* ((authuser (mew-nntp-get-authuser pnm))
+	 (password (mew-nntp-get-password pnm)))
+    (process-send-string
+     pro (format "AUTHINFO SIMPLE %s %s%s"
+		 authuser password mew-cs-eol))))
 
 (provide 'mew-nntp)
 
--- mew-config.el.orig	Thu Nov  8 17:23:22 2001
+++ mew-config.el	Sun Nov 18 23:44:46 2001
@@ -222,6 +222,12 @@
 (defun mew-nntp-ssh-server (&optional case)
   (mew-cfent-value case "nntp-ssh-server" mew-nntp-ssh-server))
 
+(defun mew-nntp-authuser (&optional case)
+  (mew-cfent-value case "nntp-authuser" mew-nntp-authuser))
+
+(defun mew-nntp-password (&optional case)
+  (mew-cfent-value case "nntp-password" mew-nntp-password))
+
 ;;
 
 (defun mew-inbox-folder (&optional case)
--- mew-vars.el.orig	Thu Nov  8 17:23:27 2001
+++ mew-vars.el	Sun Nov 18 23:45:48 2001
@@ -559,6 +559,10 @@
 
 (defvar mew-nntp-ssh-server nil)
 
+(defvar mew-nntp-authuser nil)
+
+(defvar mew-nntp-password nil)
+
 (defvar mew-nntp-size (* 54 1024))
 
 (defvar mew-nntp-timeout-time 4)


Mew-dist メーリングリストの案内