- $uri =~ s|^/||;
- my $channel = uri_unescape($uri);
- $poe_kernel->post('keitairc',
- 'privmsg',
- Jcode->new($channel)->jis,
- Jcode->new($message)->jis);
- &add_message($channel, $config->irc_nick,
- Jcode->new($message)->euc);
- $message_added = true;
- }
- }
-
- # store and remove attached options from uri
- my %option;
- {
- my @opts = split(',', $uri);
- shift @opts;
- grep($option{$_} = $_, @opts);
- $uri =~ s/,.*//;
- }
-
- if($uri eq '/'){
- $content .= '<title>' . $config->web_title . '</title>';
- $content .= '</head>';
- $content .= '<body>';
-
- if($option{recent}){
- # recent messages on every channel
- for my $canon_channel (sort keys %channel_name){
- my $channel = $channel_name{$canon_channel};
- if(length($channel) &&
- length($channel_recent{$canon_channel})){
- $content .= '<b>' . Jcode->new($channel_name{$canon_channel})->euc . '</b>';
- $content .= sprintf(' <a href="%s%s">more..</a><br>',
- $docroot, uri_escape($channel));
- $content .= &render($channel_recent{$canon_channel});
- $unread_lines{$canon_channel} = 0;
- $channel_recent{$canon_channel} = '';
- $content .= '<hr>';
- }
- }
- $content .= qq(<a accesskey="8" href="$docroot">ch list[8]</a>);
- }else{
- # channel list
- $content .= &index_page;
- }
- }else{
- # channel conversation
- $uri =~ s|^/||;
-
- # RFC 2811:
- # Apart from the the requirement that the first character
- # being either '&', '#', '+' or '!' (hereafter called "channel
- # prefix"). The only restriction on a channel name is that it
- # SHALL NOT contain any spaces (' '), a control G (^G or ASCII
- # 7), a comma (',' which is used as a list item separator by
- # the protocol). Also, a colon (':') is used as a delimiter
- # for the channel mask. The exact syntax of a channel name is
- # defined in "IRC Server Protocol" [IRC-SERVER].
- #
- # so we use white space as separator character of channel name
- # and command argument.
-
- my $channel = uri_unescape($uri);
-
- $content .= '<title>' . $config->web_title . ": $channel</title>";
- $content .= '</head>';
- $content .= '<body>';
-
- $content .= '<a name="1"></a>';
- $content .= '<a accesskey="7" href="#1"></a>';
-
- $content .= sprintf('<form action="%s%s" method="post">',
- $docroot, uri_escape($channel));
- $content .= '<input type="text" name="m" size="10">';
- $content .= '<input type="submit" accesskey="1" value="OK[1]">';
- $content .= qq(<a accesskey="8" href="$docroot">ch list[8]</a><br>);
- $content .= '</form>';
-
- my $canon_channel = &canon_name($channel);
- if(defined($channel_name{$canon_channel})){
- if(defined($channel_buffer{$canon_channel}) &&
- length($channel_buffer{$canon_channel})){
- $content .= '<a accesskey="9" href="#2"></a>';
- if($option{recent} ||
- (defined($config->show_newmsgonly) && $message_added)){
- $content .= &render($channel_recent{$canon_channel});
- $content .= sprintf('<a accesskey="5" href="%s%s">more[5]</a>',
- $docroot, uri_escape($channel));
- } else {
- $content .= &render($channel_buffer{$canon_channel});
+ if($message =~ s|^/||) {
+ my ($params, $trailing) = split(/ :/, $message, 2);
+ my @postcmd = split(/ /, $params);
+ push @postcmd, $trailing if defined $trailing;
+ # This parser may be incomplete.
+ if($postcmd[0] =~ /join/i) {
+ if($postcmd[1] =~ /^\w/) {
+ $ib->join($postcmd[1]);
+ return;
+ }
+ } elsif($postcmd[0] =~ /part/i) {
+ if($postcmd[1] =~ /^\w/) {
+ $ib->part($ib->name2cid($postcmd[1]));
+ return;
+ }
+ }
+ $irc->yield(map { Encode::encode($cf->irc_charset(), $_) } @postcmd);