# -*-perl-*-
# Keitairc::Config
-# $Id: Config.pm,v 1.3 2008-01-13 12:12:55 morimoto Exp $
+# $Id: Config.pm,v 1.4 2008-01-14 05:21:09 morimoto Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/Keitairc/Config.pm,v $
#
# Copyright (c) 2008 Jun Morimoto <morimoto@mrmt.net>
$me->args(\@argv);
+
+ if(defined $me->show_newmsgonly()){
+ ::log("show_newmsgonly has obsoleted from keitairc 2.0");
+ }
+
if(defined $me->web_username()){
::log("web_username has obsoleted from keitairc 2.0");
}
# -*-perl-*-
# Keitairc::IrcBuffer
-# $Id: IrcBuffer.pm,v 1.6 2008-01-13 15:31:09 morimoto Exp $
+# $Id: IrcBuffer.pm,v 1.7 2008-01-14 05:21:09 morimoto Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/Keitairc/IrcBuffer.pm,v $
#
# Copyright (c) 2008 Jun Morimoto <morimoto@mrmt.net>
do{
if($colored){
s|\x03(\d{1,2})|sprintf('</font><font color="%s">', $ct{0+$1})|e;
+ if(s|\x03|</font>|){
+ $colored = 0;
+ }
}else{
- s|\x03(\d{1,2})|sprintf('<font color="%s">', $ct{0+$1})|e;
- $colored = 1;
+ if(s|\x03(\d{1,2})|sprintf('<font color="%s">', $ct{0+$1})|e){
+ $colored = 1;
+ }
}
}while(m|\x03\d{1,2}|);
- # s|\x03|</font>|g if $colored;
- $_ .= '</font>' if $colored;
+ if($colored){
+ $_ .= '</font>';
+ }
$_;
}
# -*-perl-*-
# Keitairc::View
-# $Id: View.pm,v 1.5 2008-01-13 15:31:09 morimoto Exp $
+# $Id: View.pm,v 1.6 2008-01-14 05:21:09 morimoto Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/Keitairc/View.pm,v $
#
# Copyright (c) 2008 Jun Morimoto <morimoto@mrmt.net>
}
################################################################
-sub render{
+sub template{
my $me = shift;
my $template = shift;
my $vars = shift;
my $p = {};
$p->{title} = $me->{Config}->web_title();
$p->{version} = $me->{Config}->version();
+ $p->{timestamp} = timestamp();
+
$p->{viewport} = $me->{ClientInfo}->is_ipod();
$p->{is_ipod} = $me->{ClientInfo}->is_ipod();
$p->{is_docomo} = $me->{ClientInfo}->is_docomo();
$p->{is_ezweb} = $me->{ClientInfo}->is_ezweb();
$p->{is_softbank} = $me->{ClientInfo}->is_softbank();
- $p->{timestamp} = timestamp();
+
+ map {
+ $p->{"plugin_$_"} = 1;
+ } $::pl->list_plugins();
my $t = new HTML::Template(
filename => $me->template_path($template),
if(defined $vars){
$t->param($vars);
}
+
+ $t->output();
+}
+
+################################################################
+sub render{
+ my $me = shift;
+ my $template = shift;
+ my $vars = shift;
my $response = HTTP::Response->new(200);
$response->push_header('Content-type', 'text/html; charset=Shift_JIS');
- $response->content($t->output());
+ $response->content($me->template($template, $vars));
$response;
}
# -*-perl-*-
# keitairc/lib/plugins/00all
# \83`\83\83\83l\83\8b\82Ì\91S\83\81\83b\83Z\81[\83W\89{\97\97
-# $Id: 00all,v 1.2 2008-01-13 15:31:09 morimoto Exp $
+# $Id: 00all,v 1.3 2008-01-14 05:21:09 morimoto Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/00all,v $
$plugin = {
::send_message($request, $channel);
my $buf;
- my $no_message_here_yet;
if(defined($::ib->name($cid))){
if(length($::ib->buffer($cid))){
- if($::cf->show_newmsgonly() && $::ib->message_added()){
- $buf = ::render_line($::ib->unread($cid), $session_id) ||
- '(\96¢\93Ç\94\8c¾\82Í\82 \82è\82Ü\82¹\82ñ)';
- $buf .= sprintf('<br /><a accesskey="5" href="../all/%s">[5] \91S\94\8c¾\82Ö</a>', $cid);
- }else{
- $buf = ::render_line($::ib->buffer($cid), $session_id);
- }
- }else{
- $no_message_here_yet = 1;
+ $buf = ::render_line($::ib->buffer($cid), $session_id);
}
- }else{
- $buf = '\8ew\92è\82ÌÁ¬ÈÙ\82Í\91¶\8dÝ\82µ\82Ü\82¹\82ñ';
}
$::ib->message_added(0); # clear check flags
$p->{buf} = $buf;
$p->{channel_compact} = $::ib->compact_channel_name($cid);
$p->{cid} = $cid;
- $p->{no_message_here_yet} = $no_message_here_yet;
return $view->render('all.html', $p);
}
};
# -*-perl-*-
# keitairc/lib/plugins/00location
+# °ÌÃÖ¾ðÊóÁ÷¿®
+# ¸½ºß¤Þ¤À au ÀìÍÑ
#
-# $Id: 00location,v 1.1 2008-01-13 15:31:09 morimoto Exp $
+# $Id: 00location,v 1.2 2008-01-14 05:21:09 morimoto Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/00location,v $
$plugin = {
# -*-perl-*-
# keitairc/lib/plugins/00location_receiver
+# °ÌÃÖ¾ðÊóÁ÷¿®¡¢¤Î¥³¡¼¥ë¥Ð¥Ã¥¯
+# ¸½ºß¤Þ¤À au ÀìÍÑ
+#
# see KDDI au: µ»½Ñ¾ðÊó > ´Ê°×°ÌÃÖ¾ðÊó
# http://www.au.kddi.com/ezfactory/tec/spec/eznavi.html
#
-# $Id: 00location_receiver,v 1.1 2008-01-13 15:31:09 morimoto Exp $
+# $Id: 00location_receiver,v 1.2 2008-01-14 05:21:09 morimoto Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/00location_receiver,v $
-
-use Data::Dumper;
+#
+# $param_string comes in form like
+# 3/?datum=tokyo&unit=dms&lat=35.44.51.75&lon=139.35.15.0
$plugin = {
name => 'location_receiver',
action_imprementation => sub {
my ($request, $name, $session_id, $param_string) = @_;
- my $cid = $param_string;
+ my ($cid) = ($param_string =~ /^(\d+)/);
my $uri = $request->uri();;
$uri =~ s/.*\?//;
my %h;
# -*-perl-*-
# keitairc/lib/plugins/00postme
-# $Id: 00postme,v 1.1 2008-01-13 12:12:55 morimoto Exp $
+# $Id: 00postme,v 1.2 2008-01-14 05:21:09 morimoto Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/00postme,v $
use Net::SMTP;
my $ci = new Keitairc::ClientInfo($request);
my $view = new Keitairc::View($::cf, $ci);
- my $error = {};
- $error->{no_smtp_server} = 1 unless $::cf->smtp_server();
- $error->{no_smtp_from} = 1 unless $::cf->smtp_from();
- $error->{no_smtp_to} = 1 unless $::cf->smtp_to();
- if(keys(%{$error})){
- $error->{has_error} = 1;
- $error->{session_id} = $session_id;
- return $view->render('postme.html', $error);
+ {
+ my $error = {};
+ $error->{no_smtp_server} = 1 unless $::cf->smtp_server();
+ $error->{no_smtp_from} = 1 unless $::cf->smtp_from();
+ $error->{no_smtp_to} = 1 unless $::cf->smtp_to();
+ if(keys(%{$error})){
+ $error->{has_error} = 1;
+ $error->{session_id} = $session_id;
+ return $view->render('postme.html', $error);
+ }
}
my $message = $request->content();
$smtp->mail($::cf->smtp_from());
$smtp->to($::cf->smtp_to());
$smtp->data();
- $smtp->datasend('To: ' . $::cf->smtp_to() . "\n");
- $smtp->datasend("Subject: memo from keitairc\n");
- $smtp->datasend("Content-Type: text/plain; charset=iso-2022-jp\n");
- $smtp->datasend("MIME-Version: 1.0\n");
- $smtp->datasend("\n");
- $smtp->datasend($message);
- $smtp->datasend("\n");
+ $smtp->datasend(
+ $view->template('postme.eml', {
+ from => $::cf->smtp_from(),
+ to => $::cf->smtp_to(),
+ message => $message,
+ })
+ );
$smtp->dataend();
$smtp->quit();
# -*-perl-*-
# keitairc/lib/plugins/00unread
# \83`\83\83\83l\83\8b\82Ì\96¢\93Ç\83\81\83b\83Z\81[\83W\89{\97\97
-# $Id: 00unread,v 1.2 2008-01-13 15:31:09 morimoto Exp $
+# $Id: 00unread,v 1.3 2008-01-14 05:21:09 morimoto Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/00unread,v $
$plugin = {
::send_message($request, $channel);
my $buf;
- my $no_message_here_yet;
if(defined($::ib->name($cid))){
if(length($::ib->buffer($cid))){
- $buf = ::render_line($::ib->unread($cid), $session_id) ||
- '(\96¢\93Ç\94\8c¾\82Í\82 \82è\82Ü\82¹\82ñ)';
- $buf .= sprintf('<hr /><a accesskey="5" href="../all/%d">[5] \91S\94\8c¾\82Ö</a><br />', $cid);
- }else{
- $no_message_here_yet = 1;
+ $buf = ::render_line($::ib->unread($cid), $session_id);
}
- }else{
- $buf = '\8ew\92è\82ÌÁ¬ÈÙ\82Í\91¶\8dÝ\82µ\82Ü\82¹\82ñ';
}
$::ib->message_added(0); # clear check flags
buf => $buf,
channel_compact => $::ib->compact_channel_name($cid),
cid => $cid,
- no_message_here_yet => $no_message_here_yet,
});
}
};
</head>
<body>
<!-- tmpl_var channel_compact -->\82Ì\94\8c¾<br />
- <a name="1"></a>
- <a accesskey="7" href="#1"></a>
-
<form action="<!-- tmpl_var cid -->" method="post">
<tmpl_if is_ipod>
<input type="text" name="m">
<input type="submit" accesskey="1" value="[1] \94\8c¾/\8dX\90V"><br />
</form>
- <tmpl_if no_message_here_yet>
+ <tmpl_if buf>
+ <!-- tmpl_var buf -->
+ <tmpl_else>
(\82Ü\82¾\94\8c¾\82ª\82 \82è\82Ü\82¹\82ñ)
</tmpl_if>
- <!-- tmpl_var buf -->
- <a accesskey="9" href="#2"></a>
- <a name="2"></a>
<hr />
+
<a accesskey="2" href="../nick/<!-- tmpl_var cid -->">[2] nickؽÄ</a><br />
<a accesskey="8" href="../index">[8] Á¬ÈÙؽÄ</a><br />
- <a accesskey="8" href="../location/<!-- tmpl_var cid -->">[9] \88Ê\92u\8fî\95ñ\91\97\90M</a><br />
+ <tmpl_if plugin_location>
+ <tmpl_if is_ezweb>
+ <a accesskey="9" href="../location/<!-- tmpl_var cid -->">[9] \88Ê\92u\8fî\95ñ\91\97\90M</a><br />
+ </tmpl_if>
+ </tmpl_if>
<hr />
<!-- tmpl_var timestamp --><br />
keitairc <!-- tmpl_var version -->
</head>
<body>
<!-- tmpl_var channel_compact -->\82Ö\88Ê\92u\8fî\95ñ\82ð\94\8c¾<br />
- datum<!-- tmpl_var datum --><br />
- unit<!-- tmpl_var unit --><br />
- lat<!-- tmpl_var lat --><br />
- lon<!-- tmpl_var lon --><br />
+ datum <!-- tmpl_var datum --><br />
+ unit <!-- tmpl_var unit --><br />
+ lat <!-- tmpl_var lat --><br />
+ lon <!-- tmpl_var lon --><br />
<hr />
<a accesskey="8" href="/<!-- tmpl_var session_id -->/index">[8] Á¬ÈÙؽÄ</a><br />
</head>
<body>
<!-- tmpl_var channel_compact -->\82Ì\96¢\93Ç\94\8c¾<br />
- <a name="1"></a>
- <a accesskey="7" href="#1"></a>
<form action="<!-- tmpl_var cid -->" method="post">
<tmpl_if is_ipod>
<input type="submit" accesskey="1" value="[1] \94\8c¾/\8dX\90V"><br />
</form>
- <tmpl_if no_message_here_yet>
+ <tmpl_if buf>
+ <!-- tmpl_var buf -->
+ <hr />
+ <a accesskey="5" href="../all/<!-- tmpl_var cid -->">[5] \91S\94\8c¾\82Ö</a><br />
+ <tmpl_else>
(\82Ü\82¾\94\8c¾\82ª\82 \82è\82Ü\82¹\82ñ)
+ <hr />
</tmpl_if>
- <!-- tmpl_var buf -->
- <a accesskey="9" href="#2"></a>
- <a name="2"></a>
- <hr />
+
<a accesskey="2" href="../nick/<!-- tmpl_var cid -->">[2] nickؽÄ</a><br />
<a accesskey="8" href="../index">[8] Á¬ÈÙؽÄ</a><br />
+ <tmpl_if plugin_location>
+ <tmpl_if is_ezweb>
+ <a accesskey="9" href="../location/<!-- tmpl_var cid -->">[9] \88Ê\92u\8fî\95ñ\91\97\90M</a><br />
+ </tmpl_if>
+ </tmpl_if>
<hr />
<!-- tmpl_var timestamp --><br />
keitairc <!-- tmpl_var version -->