Changeset 12068 for lang/perl/tiarra/trunk/module/Log
- Timestamp:
- 05/20/08 22:13:47 (5 years ago)
- Files:
-
- 1 modified
-
lang/perl/tiarra/trunk/module/Log/Channel.pm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/tiarra/trunk/module/Log/Channel.pm
r11365 r12068 17 17 use Multicast; 18 18 19 our $DEFAULT_FILENAME_ENCODING = $^O eq 'MSWin32' ? 'sjis' : 'utf8'; 20 19 21 sub new { 20 22 my $class = shift; … … 180 182 # マッチした。 181 183 my $fname_format = $this->config->filename || '%Y.%m.%d.txt'; 182 my $fpath_format = $ch->[0]."/$fname_format"; 184 # あまり好ましくなさそうな文字はあらかじめエスケープ. 185 my $chan_filename = $channel; 186 $chan_filename =~ s/![0-9A-Z]{5}/!/; 187 $chan_filename =~ s{([^-\w@#%!+&.\x80-\xff])}{ 188 sprintf('=%02x', unpack("C", $1)); 189 }ge; 190 my $chan_dir = Auto::AliasDB->shared->replace(undef, $ch->[0], channel => $chan_filename); 191 my $fpath_format = "$chan_dir/$fname_format"; 183 192 184 193 $this->{matching_cache}->{$channel} = $fpath_format; … … 211 220 } 212 221 }; 222 my $filename_encoding = $this->config->filename_encoding || $DEFAULT_FILENAME_ENCODING; 223 if( $filename_encoding ne 'ascii' ) 224 { 225 $concrete_fpath = Tiarra::Encoding->new($concrete_fpath)->conv($filename_encoding); 226 }else 227 { 228 $concrete_fpath =~ s/([^ -~])/sprintf('=%02x', unpack("C", $1))/ge; 229 } 213 230 my $header = Tools::DateConvert::replace( 214 231 $this->config->header || '%H:%M' … … 384 401 # この例では、#IRC談話室@ircnetのログはIRCDanwasitu/%Y.%m.%d.txtに、 385 402 # それ以外(privも含む)のログはothers/%Y.%m.%d.txtに保存される。 403 # #(channel) はチャンネル名に展開される。 404 # (古いバージョンだと展開されずにそのままディレクトリ名になってしまいます。) 386 405 channel: priv priv 387 channel: others * 406 channel: #(channel) * 407 -channel: others * 408 409 # ファイル名のエンコーディング. 410 # 指定可能な値は, utf8, sjis, euc, jis, ascii. 411 # ascii は実際には utf8 と同等で8bit部分が全てquoted-printableされる. 412 # デフォルトはWindowsではsjis, それ以外では utf8. 413 -filename-encoding: utf8 414 388 415 =cut
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)