<p class="flushleft">
morimoto@xantia.citroen.org<br>
-$Id: index.html,v 1.17 2004-08-18 14:29:46 morimoto Exp $
+$Id: index.html,v 1.18 2004-08-29 11:21:02 morimoto Exp $
</p>
<h2>ÀâÌÀ</h2>
<p>
-i-mode, EZweb, vodafone live! ¤Ê¤É¤Î¥Ö¥é¥¦¥¶¥Õ¥©¥ó¤«¤é irc ¤ò¤¹¤ë¤â¤Î¡£
+i-mode, EZweb, vodafone live!, AirH" Phone ¤Ê¤É¤Î¥Ö¥é¥¦¥¶¥Õ¥©¥ó¤«¤é irc ¤ò¤¹¤ë¤â¤Î¡£
plum ¤Ê¤É¤Î pirc (irc ¥×¥í¥¥·) ¤ËÀܳ¤·¤Æ»È¤ï¤ì¤ë¤³¤È¤òÁÛÄꤷ¤Æ¤¤¤Þ¤¹¡£
</p>
¤òÁªÂò¤¹¤ë¤È´ûÆÉÉôʬ¤â¸«¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
<p>
+¤Þ¤¿¡¢Ì¤ÆÉÆâÍƤΤ¢¤ë¥Á¥ã¥Í¥ë¤¬¤Ò¤È¤Ä¤Ç¤â¤¢¤ë¾ì¹ç¤Ï¡¢
+¥Á¥ã¥Í¥ë¤Î¥ê¥¹¥È¤Ë recent ¥ê¥ó¥¯¤¬¤Ä¤¤Þ¤¹¡£
+recent ¥ê¥ó¥¯¤Ï¡¢Ã¼Ëö¤Ë¤è¤Ã¤Æ¤Ï * ¥¡¼¤ò²¡¤¹¤À¤±¤Ç¤â¹Ô¤¯¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
+recent ¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¡¢Á´¥Á¥ã¥Í¥ë¤Î̤Æɤò¤Þ¤È¤áÆɤߤǤ¤Þ¤¹¡£
+
+<p>
¥Á¥ã¥Í¥ë¤Îȯ¸ÀÆâÍƤòÆɤó¤Ç¤¤¤Æ¡¢
ȯ¸À¤·¤¿¤¤¾ì¹ç¤Ï¥Ú¡¼¥¸¤Î¤Æ¤Ã¤Ú¤ó¤Ë¤¢¤ë¥Æ¥¥¹¥È¥¨¥ê¥¢¤ËµÆþ¤·¡¢
OK ¥Ü¥¿¥ó¤ò²¡¤·¤Þ¤¹¡£
</p>
<p>
-ÅÅÏõ¡¤Î 7 ¤ò²¡¤¹¤È¥Ú¡¼¥¸ÀèƬ¤Ø¡¢
-ÅÅÏõ¡¤Î 8 ¤ò²¡¤¹¤È¥Á¥ã¥Í¥ë¤Î¥ê¥¹¥È¤Ø¡¢
-ÅÅÏõ¡¤Î 9 ¤ò²¡¤¹¤È¥Ú¡¼¥¸ËöÈø¤ËÈô¤Ó¤Þ¤¹¡£
+üËö¤Î 7 ¤ò²¡¤¹¤È¥Ú¡¼¥¸ÀèƬ¤Ø¡¢
+üËö¤Î 8 ¤ò²¡¤¹¤È¥Á¥ã¥Í¥ë¤Î¥ê¥¹¥È¤Ø¡¢
+üËö¤Î 9 ¤ò²¡¤¹¤È¥Ú¡¼¥¸ËöÈø¤ËÈô¤Ó¤Þ¤¹¡£
</p>
<h2>³«È¯</h2>
<h2>Changes</h2>
<dl>
+<dt>1.24
+<dd>Á´¥Á¥ã¥Í¥ë¤Î̤ÆɤޤȤáÆɤßÄɲÃ
+
<dt>1.23
<dd>¥Á¥ã¥Í¥ë̾¤ÎÆâÉô½èÍý¤Ï¾®Ê¸»ú¤ËÀµµ¬²½¤·¤Æ°·¤¦ (thanks to Akira Yamada)
#!/usr/bin/perl
# keitairc
-# $Id: keitairc,v 1.23 2004-08-18 14:24:53 morimoto Exp $
+# $Id: keitairc,v 1.24 2004-08-29 11:21:02 morimoto Exp $
#
# Copyright (c) 2003 Jun Morimoto <morimoto@xantia.citroen.org>
# This program is covered by the GNU General Public License 2
# Depends: libjcode-pm-perl, libpoe-component-irc-perl,
# liburi-perl, libwww-perl, libappconfig-perl
-my $rcsid = q$Id: keitairc,v 1.23 2004-08-18 14:24:53 morimoto Exp $;
+my $rcsid = q$Id: keitairc,v 1.24 2004-08-29 11:21:02 morimoto Exp $;
my ($version) = $rcsid =~ m#,v ([0-9.]+)#;
use strict;
use HTTP::Response;
use AppConfig qw(:argcount);
+use constant true => 1;
+use constant false => 0;
+
my $config = AppConfig->new(
{
CASE => 1,
my %mtime;
# unread lines
-my %unread;
+my %unread_lines;
# chk
-my ($send_chk, $update_chk);
+my ($message_added);
# irc component
POE::Component::IRC->new('keitairc');
$mtime{$canon_channel} = time;
# unread lines
- $unread{$canon_channel} = scalar(@tmp2);
+ $unread_lines{$canon_channel} = scalar(@tmp2);
- if ($unread{$canon_channel} > $config->web_lines) {
- $unread{$canon_channel} = $config->web_lines;
+ if($unread_lines{$canon_channel} > $config->web_lines){
+ $unread_lines{$canon_channel} = $config->web_lines;
}
}
$accesskey++;
# \e$BL$FI9T?t\e(B
- if($unread{$canon_channel} > 0){
- $buf .= sprintf(' <a href="%s%s.update">%d</a>',
+ if($unread_lines{$canon_channel}){
+ $buf .= sprintf(' <a href="%s%s,recent">%d</a>',
$docroot,
uri_escape($channel),
- $unread{$canon_channel});
+ $unread_lines{$canon_channel});
}
$buf .= '<br>';
}
$buf .= qq(0 <a href="$docroot" accesskey="0">refresh list</a><br>);
+
+ if(grep($unread_lines{$_}, keys %unread_lines)){
+ $buf .= qq(* <a href="$docroot,recent" accesskey="*">recent</a><br>);
+ }
+
$buf .= qq( - keitairc $version);
$buf;
}
return;
}
- unless(defined($config->au_subscriber_id) &&
+ # authorization
+ unless(defined($config->au_subscriber_id) &&
($request->header('x-up-subno') eq $config->au_subscriber_id)) {
if(defined($config->web_username)){
unless($request->headers->authorization_basic eq
$config->web_username . ':' . $config->web_password){
-
my $response = HTTP::Response->new(401);
$response->push_header(WWW_Authenticate =>
qq(Basic Realm="keitairc"));
}
}
}
+
my $uri = $request->uri;
my $content = '<html><head>';
$content .= '<meta http-equiv="Cache-Control" content="max-age=0" />';
Jcode->new($message)->jis);
&add_message($channel, $config->irc_nick,
Jcode->new($message)->euc);
-
- # set flag for "send message"
- $send_chk = 1;
+ $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>';
+ $content .= '<title>' . $config->web_title . '</title>';
+ $content .= '</head>';
+ $content .= '<body>';
+
+ if($option{recent}){
+ # recent messages on every channel
+ for my $channel (sort keys %channel_name){
+ my $canon_channel = &canon_name($channel);
+ if(defined($channel_name{$canon_channel}) &&
+ length($channel_recent{$canon_channel})){
+ $content .= "<b>$channel_name{$canon_channel}</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 .= qq(<a accesskey="8" href="$docroot">ch list[8]</a>);
+ }else{
+ # channel list
$content .= &index_page;
+ }
}else{
+ # channel conversation
$uri =~ s|^/||;
- $update_chk = ($uri =~ /.*.update/);
- if ($update_chk eq 1) {
- $uri =~ s/.update//;
- }
+ # 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);
$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">back[8]</a><br>);
+ $content .= qq(<a accesskey="8" href="$docroot">ch list[8]</a><br>);
# $content .= '<input type="submit" accesskey="1" value="聆">';
$content .= '</form>';
if(defined($channel_buffer{$canon_channel}) &&
length($channel_buffer{$canon_channel})){
$content .= '<a accesskey="9" href="#2"></a>';
- if ((($update_chk eq 1)||((defined $config->show_newmsgonly) && ($send_chk eq 1)))) {
+ 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));
+ $content .= sprintf('<a accesskey="5" href="%s%s">more[5]</a>',
+ $docroot, uri_escape($channel));
} else {
$content .= &render($channel_buffer{$canon_channel});
}
$content .= 'no message here yet';
}
}else{
- $content .= "no such channel";
+ $content .= 'no such channel';
}
# clear check flags
- $send_chk = 0;
+ $message_added = false;
# clear unread counter
- $unread{$canon_channel} = 0;
+ $unread_lines{$canon_channel} = 0;
# clear recent messages buffer
$channel_recent{$canon_channel} = '';