[Mew-dist 2481] Re: multiple nntpservers

Motonori Nakamura motonori at example.com
1997年 10月 15日 (水) 11:19:45 JST


>>>>> On Tue, 14 Oct 1997 23:41:25 +0900, Motonori Nakamura <motonori at example.com> said:

|> 以下のパッチで、次のサーバに進むようになると思います。このパッチには、
|> X-Dispatcher: ヘッダが BCC 等の時に付かなくなってしまっていることの
|> 修正も含んでいます。

さらに添付のパッチで、
o Config に AllowCRLF=yes と定義すると、改行が CRLF なメッセージの解釈も
  正しくなる(遅くなるけど)。
o imget で --rpath=ignore とすると、UNIX From を単に捨てる。
o Newsgroups: ヘッダはメールに出すときは、X-Newsgroups: に変換する
o BNewsgroups: のサポート
o ドキュメントへの反映
ができます。

- motonori


-------------- next part --------------
diff -ur ../im-74/IM.in/Config.pm.in ./IM.in/Config.pm.in
--- ../im-74/IM.in/Config.pm.in	Tue Oct 14 08:33:00 1997
+++ ./IM.in/Config.pm.in	Wed Oct 15 08:54:13 1997
@@ -40,7 +40,7 @@
     mail_dir mail_path news_dir news_path
     inbox_folder draft_folder trash_folder
     preserve_dot
-    folder_mode msg_mode
+    folder_mode msg_mode allowcrlf
     aliases_file context_file
     address addresses_regex
     msgdbfile msgdbtype getsbrfile scansbrfile petnamefile
@@ -153,6 +153,7 @@
     'trashfolder;f;;TrashFolder'	=> 'Trash folder',
     'foldermode;i;;FolderMode'		=> 'Folder directory mode when created',
     'msgmode;i;;MsgMode'		=> 'Message file mode when created',
+    'allowcrlf;b;;AllowCRLF'		=> 'CRLF may be in saved message',
     'preservedot;b;;PreserveDot'	=> 'Not substitute "." with "/"',
     'contextfile;s;Context;ContextFile'	=> 'Context file',
     'address;s;;Address'		=> 'Email addresses',
@@ -742,6 +743,10 @@
     my $umask = 0777 ^ $MsgMode;
     umask($umask) if ($setumask);
     return $MsgMode;
+}
+
+sub allowcrlf () {
+    return $AllowCRLF;
 }
 
 sub context_file () {
diff -ur ../im-74/IM.in/Imap.pm.in ./IM.in/Imap.pm.in
--- ../im-74/IM.in/Imap.pm.in	Tue Oct 14 08:33:17 1997
+++ ./IM.in/Imap.pm.in	Wed Oct 15 08:29:22 1997
@@ -608,7 +608,7 @@
 
     if ($spec eq '') {
 	my $s = imapaccount();
-	if ($s !~ /^[\@:]/) {
+	if ($s !~ /^[\/\@:]/) {
 	    if ($s =~ /\@/) {
 		$s = ":$s";
 	    } else {
diff -ur ../im-74/IM.in/LocalMbox.pm.in ./IM.in/LocalMbox.pm.in
--- ../im-74/IM.in/LocalMbox.pm.in	Tue Oct 14 08:33:22 1997
+++ ./IM.in/LocalMbox.pm.in	Wed Oct 15 10:05:17 1997
@@ -275,11 +275,11 @@
 	    print "$first_line\n";
 	}
 
-	if ($format eq 'UNIX') {
+	if ($format eq 'UNIX' && $main::opt_rpath ne 'ignore') {
 	    # convert UNIX From_ into Return-Path
 	    my $rp = $first_line;
 	    $rp =~ s/^From +//;
-	    $rp =~ s/ +[A-Z][a-z][a-z] [A-Z][a-z][a-z] [\d ]\d \d\d:\d\d:\d\d \d\d\d\d$//;
+	    $rp =~ s/ +[A-Z][a-z][a-z] [A-Z][a-z][a-z] [\d ]\d \d\d:\d\d.*//;
 	    $rp = "<$rp>" if ($rp !~ /^<.*>$/);
 	    @Message = ("Return-Path: $rp\n");
 	} else {
@@ -300,7 +300,9 @@
 		if ($format eq 'MMDF' && $how eq 'from') {
 		    print "$_" if (/^From:/i);
 		}
-		push (@Message, $_);
+		# XXX continuous line processing needed
+		push (@Message, $_)
+		    unless (/^Return-Path:/i && $main::opt_rpath eq 'replace');
 		# for Solaris 2.x or ...
 		# XXX option
 		if ($main::Obey_CL && /^Content-Length:(.*)/i) {
diff -ur ../im-74/IM.in/Message.pm.in ./IM.in/Message.pm.in
--- ../im-74/IM.in/Message.pm.in	Tue Oct 14 08:34:21 1997
+++ ./IM.in/Message.pm.in	Wed Oct 15 09:36:22 1997
@@ -144,10 +144,11 @@
 	    $val = &rewrite_addr_list($Header, 1, $3, !$main::Obey_MTA_domain);
 	    return -1 if ($val eq '');
 	    $$Header[$i] = "$1$2: $val";
-	} elsif (/^Newsgroups:(.*)/is) {
+	} elsif (/^(B?Newsgroups):(.*)/is) {
 	    # strip spaces off
-	    ($val = $1) =~ s/[ \t]//g;
-	    $$Header[$i] = "Newsgroups: $val";
+	    my $fieldname = $1;
+	    ($val = $2) =~ s/[ \t]//g;
+	    $$Header[$i] = "$fieldname: $val";
 	} elsif (/^([\w-]+):\s*(\S.*)/s) {
 	    $$Header[$i] = "$1: $2";
 	}
@@ -276,6 +277,8 @@
 	    foreach $del (@main::Del_headers_on_mail) {
 		next hdr if ($line =~ /^$del:/i);
 	    }
+	    next if ($line =~ /^BNewsgroups:/i);
+	    $line =~ s/^Newsgroups:/X-Newsgroups:/i;
 	}
 	if ($proto =~ /nntp/i) {
 	    foreach $del (@main::Del_headers_on_news) {
@@ -289,6 +292,7 @@
 		$line = "$1: $val";
 	    }
 	    $line =~ s/^Sender:/Originator:/i;
+	    $line =~ s/^BNewsgroups:/Newsgroups:/i;
 	}
 	$line .= "\n" if ($line !~ /\n$/);
 	$line =~ s/\r?\n/\r\n/g if ($crlf eq "\r\n");
diff -ur ../im-74/IM.in/Pop.pm.in ./IM.in/Pop.pm.in
--- ../im-74/IM.in/Pop.pm.in	Tue Oct 14 08:33:36 1997
+++ ./IM.in/Pop.pm.in	Wed Oct 15 08:28:52 1997
@@ -559,7 +559,7 @@
 
     if ($spec eq '') {
 	my $s = popaccount();
-	if ($s !~ /^[\@:]/) {
+	if ($s !~ /^[\/\@:]/) {
 	    if ($s =~ /\@/) {
 		$s = ":$s";
 	    } else {
diff -ur ../im-74/IM.in/Scan.pm.in ./IM.in/Scan.pm.in
--- ../im-74/IM.in/Scan.pm.in	Tue Oct 14 08:33:40 1997
+++ ./IM.in/Scan.pm.in	Wed Oct 15 09:06:27 1997
@@ -128,7 +128,8 @@
 	    @HANDLE
 	    %REF_SYMBOL %message_id %message_id_and_subject
 	    %petnames %ADDRESS_HASH
-	    $SI $SO $SS2 $SS3);
+	    $SI $SO $SS2 $SS3
+	    $ALLOW_CRLF);
 
 ############################################
 ##
@@ -206,6 +207,8 @@
 sub set_scan_form ($$$) {
     my ($scan_form, $width, $jis_safe) = @_;
 
+    $ALLOW_CRLF = allowcrlf();
+
     $WIDTH = $width;
     $JIS_SAFE= $jis_safe;
 
@@ -253,9 +256,20 @@
     ##
     ## Header parse
     ##
-    $/ = "\n\n";
-    my $header = <MSG>;
-    $header =~ s/\r//g;
+    my $header;
+    if ($ALLOW_CRLF) {
+	$header = <MSG>;
+	if ($header =~ /\r/) {
+	    $/ = "\r\n\r\n";
+	} else {
+	    $/ = "\n\n";
+	}
+	$header .= <MSG>;
+	$header =~ s/\r//g;
+    } else {
+	$/ = "\n\n";
+	$header = <MSG>;
+    }
     store_header(\%Head, $header);
 
     ##
diff -ur ../im-74/cnf.im/SiteConfig ./cnf.im/SiteConfig
--- ../im-74/cnf.im/SiteConfig	Mon Sep 29 20:00:01 1997
+++ ./cnf.im/SiteConfig	Wed Oct 15 10:19:07 1997
@@ -83,8 +83,8 @@
 #MBoxStyle=qmail		# if folder style mbox of qmail is used
 #Imget.Src=local:${HOME}/MailDir# in case of qmail
 
-#PopAccount=@localhost/APOP	# Account info for POP access
-#ImapAccount=@localhost/AUTH	# Account info for IMAP access
+#PopAccount=/APOP at example.com/110	# Account info for POP access
+#ImapAccount=/AUTH at example.com/143# Account info for IMAP access
 #HttpProxy=proxy-server:8080	# Proxy server for HTTP access
 #NoProxy=http://.*my.domain/	# URL regex not to use Proxy server
 #UsePwAgent=no			# Use password agent
diff -ur ../im-74/dot.im/Config ./dot.im/Config
--- ../im-74/dot.im/Config	Mon Sep 29 20:00:01 1997
+++ ./dot.im/Config	Wed Oct 15 10:21:22 1997
@@ -81,6 +81,7 @@
 ## imget/imls specific
 #ScanSbr=scan.sbr		# hook for special processing (rel. to ~/.im/)
 #Form=%5n %m%d %-14A %-18S %b	# default format for scanning
+#AllowCRLF=no			# saved messages may contain CRLF (DOS style)
 #Width=80			# default width for scanning
 #JisSafe=on			# escape seq. of JIS char. should be managed
 #Indent=2			# indent step for threading
@@ -94,13 +95,15 @@
 #GetSbr=get.sbr			# hook for special processing (rel. to ~/.im/)
 #Imget.Src=local		# default source of imget (local mailbox)
 #lock=flock			# locking style of local mailbox
+#rpath=append			# conversion of UNIX From into Return-Path:
 #PopHistory=pophist		# to save last state (relative to ~/.im/)
 #NntpHistory=newshist		# to save last state (relative to ~/.im/)
 #MBoxStyle=qmail		# if folder style mbox of qmail is used
 #Imget.Src=local:${HOME}/MailDir# in case of qmail
 
-#PopAccount=@localhost/APOP	# account info for POP access
-#PopAccount=user at example.com/APOP	# account info with user name
+#PopAccount=/APOP at example.com	# account info for POP access
+#PopAccount=user/APOP at example.com	# account info with user name
+#PopAccount=user/APOP at example.com/110	# account info with user name and port number
 #Keep=7		 		# preserve read messages on server
 #ProtoKeep=UIDL			# how to know which message is unread
 				# (UIDL, LAST, STATUS, MSGID)
diff -ur ../im-74/imget.in ./imget.in
--- ../im-74/imget.in	Fri Oct 10 10:36:34 1997
+++ ./imget.in	Wed Oct 15 10:11:01 1997
@@ -61,6 +61,8 @@
 #   'thread;b;;'       => 'Make threads',
 #   'indent;i;;'       => "Width of thread indent",
     'lock;s;flock;'    => 'Local mailbox locking style. (none,flock,file)',
+    'rpath;s;append;'  => "conversion of UNIX From line into Return-Path:\n" .
+	"\t\t(append, ignore, replace)",
     'keep;i;0;'        => "Preserve messages.\n" .
 	"\t\t(POP: in days; 0=delete immediately, -1=preserve forever)\n" .
 	"\t\t(otherwise: 0=delete immediately, non0=preserve forever)",
diff -ur ../im-74/imput.in ./imput.in
--- ../im-74/imput.in	Tue Oct 14 08:32:41 1997
+++ ./imput.in	Wed Oct 15 09:22:45 1997
@@ -410,7 +410,9 @@
 	&kill_header(\@Header, 'Resent-Cc', 0);
 	&kill_header(\@Header, 'Resent-From', 0);
 	$News_flag = 1;
-    } elsif ($News_flag && &header_value(\@Header, 'Newsgroups')
+    } elsif ($News_flag
+     && (&header_value(\@Header, 'Newsgroups')
+      || &header_value(\@Header, 'BNewsgroups'))
      && !&header_value(\@Header, 'Path')
      && !&header_value(\@Header, 'Received')
      && !&header_value(\@Header, 'Return-Path')
@@ -605,7 +607,8 @@
 
 ##### VERIFY FORMAT OF THE MESSAGE #####
     if ($News_flag) {
-	unless (&header_value(\@Header, 'Newsgroups')) {
+	if (&header_value(\@Header, 'Newsgroups') eq ''
+	 && &header_value(\@Header, 'BNewsgroups') eq '') {
 	    im_err("Bad message format (no Newsgroups:).\n");
 	    &error_exit;
 	}
@@ -1748,8 +1751,10 @@
 		print "    Subject: $t\n";
 	    }
 	    if ($News_flag) {
-		print "    Will be posted in %s\n",
-		  &header_value(\@Header, 'Newsgroups');
+	        my $ng = &header_value(\@Header, 'Newsgroups');
+	        $ng = &header_value(\@Header, 'BNewsgroups')
+		    if ($ng eq '');
+		print "    Will be posted in $ng\n";
 	    }
 	    print "    Recipients:\n";
 	    foreach $r (@Recipients) {
diff -ur ../im-74/man/imget2.jis ./man/imget2.jis
--- ../im-74/man/imget2.jis	Mon Sep 15 14:14:01 1997
+++ ./man/imget2.jis	Wed Oct 15 10:16:53 1997
@@ -21,6 +21,10 @@
 			       いうロックファイルを作成する。
 			flock と file を併用する場合は、flock+file などの
 			ように指定する。
+	--rpath=<string>UNIX From 行を Return-Path: に変化する方法を指定する。
+			ignore:  UNIX From 行の情報は捨てる
+			append:  UNIX From 行の情報を Return-Path: として残す
+			replace: 既存の Return-Path: を削除して append
 	--keep=<num>	get した後のメールの扱いについて指定する。
 			-1: get した後も削除しない。
 			 0: get の後ただちに削除する。
@@ -73,7 +77,7 @@
 				これらは自動判別される。
 			pop	POP を用いて get する。
 				<string> への指定の形式は、
-					pop[/auth][:user][@host]
+					pop[/auth][:user][@host/[port]]
 				[] は、その中の記述が省略できることを示す。
 				auth には、POP, APOP, RPOP のうちのいずれかを
 				指定する。デフォルトは APOP。
@@ -82,7 +86,7 @@
 				configure で --enable-rpop を指定すること。
 			imap	IMAP を用いて get する。
 				<string> への指定の形式は、
-					imap[/auth][:user][@host]
+					imap[/auth][:user][@host[/port]]
 				[] は、その中の記述が省略できることを示す。
 				auth には、AUTH, LOGIN のうちのいずれかを
 				指定する。デフォルトは AUTH。
@@ -93,10 +97,13 @@
 			いずれの場合も、user を省略した場合は、クライアント
 			で使用中の login 名、host を省略した場合は localhost
 			が仮定される。また、Config ファイルにて
-				PopAccount=user at example.com/POP
-				ImapAccount=user at example.com/LOGIN
-				NntpServers=server
+				PopAccount=/POP:user at example.com
+				ImapAccount=/LOGIN:user at example.com
+				NntpServers=server1
 			のようにデフォルトを指定しておくこともできる。
+			これらの POP, IMAP に関するデフォルトは、--src に
+			pop あるいは imap とのみ記述した場合に参照され、
+			オプションを一つでも続けて指定した場合は無視される。
 	--dst=<string>	get 先のフォルダを指定する。
 	--mode=<string>	imget の動作を指定する。
 			get:   新着メッセージをフォルダに取り込む。
diff -ur ../im-74/man/imput ./man/imput
--- ../im-74/man/imput	Fri Oct 10 10:39:52 1997
+++ ./man/imput	Wed Oct 15 11:16:51 1997
@@ -452,6 +452,11 @@
 if the following header fields are exist:
 	To: ,Cc: ,Apparently-To:
 
+  Newsgroups: header in a message will be converted into X-Newsgroups:
+header when sending the message as mail at the same time. Moreover,
+to avoid sending X-Newsgroups: header information to recipients of the
+message as mail, use BNewsgroups: header to specify news group name instead.
+
 5.9 Config: 
 
   value of Config: header field will be taken and specified configuration
diff -ur ../im-74/man/imput.jis ./man/imput.jis
--- ../im-74/man/imput.jis	Fri Oct 10 10:38:07 1997
+++ ./man/imput.jis	Wed Oct 15 11:10:03 1997
@@ -470,6 +470,12 @@
   されている場合、To:, Cc:, Apparently-To: ヘッダが存在した場合は、
   Newsgroups: ヘッダが存在してもニュースへの投稿は行なわれません。
 
+  ニュースの投稿と同時にメールとしても送出する場合は、メールとして送出
+  されるメッセージの Newsgroups: ヘッダは X-Newsgroups: ヘッダに置き換え
+  られます。また、X-Newsgroups: が付かないようにして、メールの受信者に
+  ニュースにも投稿されていることを伝えたくない場合には、BNewsgroups:
+  ヘッダに、ニュースグループ名を指定します。
+
 5.9 Config:
 
   ヘッダからアドレス等を抽出する場合、Config: ヘッダによって指定された


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