Changeset 12141
- Timestamp:
- 05/21/08 22:28:32 (5 years ago)
- Files:
-
- 1 modified
-
lang/perl/tiarra/trunk/module/System/WebClient.pm (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/tiarra/trunk/module/System/WebClient.pm
r11017 r12141 19 19 use BulletinBoard; 20 20 use Module::Use qw(Tools::HTTPServer Tools::HTTPParser Log::Logger Auto::Utils); 21 use Unicode::Japanese; 21 22 22 23 use IO::Socket::INET; … … 535 536 536 537 $ch_short =~ s/%([0-9a-f]{2})/pack("H*",$1)/gie; 537 $ch_short =~ s/^=// or $ch_short = '#'.$ch_short; 538 if( !$this->{cache}{$netname}{$ch_short} ) 539 { 540 use Unicode::Japanese; 541 my $ch2 = Unicode::Japanese->new($ch_short,'sjis')->utf8; 542 if( $this->{cache}{$netname}{$ch2} ) 543 { 544 $ch_short = $ch2; 545 }else 546 { 547 RunLoop->shared_loop->notify_msg(__PACKAGE__."#_dispatch($path), not in cache ($netname/$ch_short)"); 548 $this->_response($req, 404); 549 return; 550 } 551 } 538 my $ch_short_orig = $ch_short; 539 $ch_short = $this->_detect_channel($ch_short, $netname); 540 if( !$ch_short ) 541 { 542 RunLoop->shared_loop->notify_msg(__PACKAGE__."#_dispatch($path), not in cache ($netname/$ch_short_orig)"); 543 $this->_response($req, 404); 544 return; 545 } 546 552 547 if( !$this->_can_show($req, $ch_short, $netname) ) 553 548 { … … 584 579 $this->_response($req, 404); 585 580 } 581 } 582 583 # $this->_detect_channel($ch_short, $netname). 584 sub _detect_channel 585 { 586 my $this = shift; 587 my $ch_short = shift; 588 my $netname = shift; 589 590 if( $ch_short =~ s/^=// ) 591 { 592 # priv or special channels. 593 return $ch_short; 594 } 595 596 if( $ch_short =~ s/^!// ) 597 { 598 foreach my $key (keys %{$this->{cache}{$netname}}) 599 { 600 $key =~ /^![0-9A-Z]{5}/ or next; 601 substr($key, 6) eq $ch_short or next; 602 return $key; 603 } 604 # try decode from sjis. 605 my $ch2 = Unicode::Japanese->new($ch_short,'sjis')->utf8; 606 foreach my $key (keys %{$this->{cache}{$netname}}) 607 { 608 $key =~ /^![0-9A-Z]{5}/ or next; 609 substr($key, 6) eq $ch2 or next; 610 return $key; 611 } 612 # not found. 613 return undef; 614 } 615 616 # normal channels. 617 $ch_short = '#'.$ch_short; 618 if( $this->{cache}{$netname}{$ch_short} ) 619 { 620 # found. 621 return $ch_short; 622 } 623 624 # try decode from sjis. 625 my $ch2 = Unicode::Japanese->new($ch_short,'sjis')->utf8; 626 if( $this->{cache}{$netname}{$ch2} ) 627 { 628 return $ch2; 629 } 630 631 # not found. 632 return undef; 586 633 } 587 634 … … 771 818 { 772 819 my $link_ch = $channame; 773 $link_ch =~ s/^#// or $link_ch = "=$link_ch"; 820 if( $link_ch =~ s/^#// ) 821 { 822 # normal channels. 823 }elsif( $link_ch =~ s/^![0-9A-Z]{5}/!/ ) 824 { 825 # channel = ( "#" / "+" / ( "!" channelid ) / "&" ) chanstring [ ":" chanstring ] 826 # channelid = 5( %x41-5A / digit ) ; 5( A-Z / 0-9 ) 827 # (RFC2812) 828 }else 829 { 830 $link_ch = "=$link_ch"; 831 } 774 832 my $link = "log\0$netname\0$link_ch\0"; 775 833 $link =~ s{/}{%2F}g; 776 834 $link =~ tr{\0}{/}; 777 835 $link = $this->_escapeHTML($link); 778 $content .= qq{<li><a href="$link">$channame</a></li>\n}; 836 837 my $channame_label = $this->_escapeHTML($channame); 838 $channame_label =~ s/^![0-9A-Z]{5}/!/; 839 $content .= qq{<li><a href="$link">$channame_label</a></li>\n}; 779 840 } 780 841 $content .= " </ul>\n"; … … 1042 1103 1043 1104 my $ch_long = Multicast::attach($ch_short, $netname); 1105 $ch_long =~ s/^![0-9A-Z]{5}/!/; 1044 1106 my $ch_long_esc = $this->_escapeHTML($ch_long); 1045 1107 my $name_esc = $this->_escapeHTML($cgi->{n} || ''); … … 1297 1359 1298 1360 my $ch_long = Multicast::attach($ch_short, $netname); 1361 $ch_long =~ s/^![0-9A-Z]{5}/!/; 1299 1362 my $ch_long_esc = $this->_escapeHTML($ch_long); 1300 1363 … … 1347 1410 1348 1411 <form action="./info" method="post"> 1349 JOIN <input type=" text" name="join" value="<&CH_LONG>" />1412 JOIN <input type="hidden" name="join" value="<&CH_LONG>" /> 1350 1413 <input type="submit" value="入室" /><br /> 1351 1414 </form> 1352 1415 1353 1416 <form action="./info" method="post"> 1354 DELETE <input type=" text" name="delete" value="<&CH_LONG>" />1417 DELETE <input type="hidden" name="delete" value="<&CH_LONG>" /> 1355 1418 <input type="submit" value="削除" /><br /> 1356 1419 </form>
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)