OSDN Git Service

*** empty log message ***
authormorimoto <morimoto@180c8125-5b33-4295-ad04-72a68a15b4cc>
Wed, 9 Jan 2008 19:30:34 +0000 (19:30 +0000)
committermorimoto <morimoto@180c8125-5b33-4295-ad04-72a68a15b4cc>
Wed, 9 Jan 2008 19:30:34 +0000 (19:30 +0000)
lib/plugins/00all [new file with mode: 0644]
lib/plugins/00index [new file with mode: 0644]
lib/plugins/00recent [new file with mode: 0644]
lib/plugins/00topic [new file with mode: 0644]
lib/plugins/00unread [new file with mode: 0644]
lib/plugins/10url [new file with mode: 0644]
lib/plugins/20mail [new file with mode: 0644]
lib/plugins/20phone [new file with mode: 0644]

diff --git a/lib/plugins/00all b/lib/plugins/00all
new file mode 100644 (file)
index 0000000..28ca444
--- /dev/null
@@ -0,0 +1,49 @@
+# -*-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.1 2008-01-09 19:30:34 morimoto Exp $
+# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/00all,v $
+
+$plugin = {
+       name => 'all',
+       action_imprementation => sub {
+               my ($request, $name, $session_id, $param_string) = @_;
+               my $channel = ::uri_unescape($param_string);
+
+               ::send_message($request, $channel);
+
+               my $buf;
+               my $no_message_here_yet;
+               if(defined($::ib->name($channel))){
+                       if(length($::ib->buffer($channel))){
+                               if($::cf->show_newmsgonly() && $::ib->message_added()){
+                                       $buf = ::render_line($::ib->unread($channel), $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>',
+                                                       ::uri_escape($channel));
+                               }else{
+                                       $buf = ::render_line($::ib->buffer($channel), $session_id);
+                               }
+                       }else{
+                               $no_message_here_yet = 1;
+                       }
+               }else{
+                       $buf = '\8ew\92è\82ÌÁ¬ÈÙ\82Í\91\8dÝ\82µ\82Ü\82¹\82ñ';
+               }
+
+               $::ib->message_added(0); # clear check flags
+               $::ib->clear_unread($channel);
+
+               my $ci = new Keitairc::ClientInfo($request);
+               my $view = new Keitairc::View($::cf, $ci);
+               return $view->render('all.html', {
+                       buf => $buf,
+                       channel_compact => $::ib->compact_channel_name($::ib->name($channel)),
+                       channel => ::uri_escape($channel),
+                       no_message_here_yet => $no_message_here_yet,
+                       ipod => $ci->is_ipod(),
+                            });
+       }
+};
+
+1;
diff --git a/lib/plugins/00index b/lib/plugins/00index
new file mode 100644 (file)
index 0000000..d2b7593
--- /dev/null
@@ -0,0 +1,49 @@
+# -*-perl-*-
+# keitairc/lib/plugins/00index
+# \83`\83\83\83l\83\8b\88ê\97\97
+# $Id: 00index,v 1.1 2008-01-09 19:30:34 morimoto Exp $
+# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/00index,v $
+
+$plugin = {
+       name => 'index',
+       action_imprementation => sub {
+               my ($request, $name, $session_id, $param_string) = @_;
+               my $unread_channels = 0;
+               my $accesskey = 1;
+               my $buf;
+
+               for my $channel ($::ib->channels()){
+                       if($accesskey < 10){
+                               $buf .= sprintf('<a accesskey="%1d" href="all/%s">[%1d] %s</a>',
+                                               $accesskey,
+                                               ::uri_escape($channel),
+                                               $accesskey,
+                                               $::ib->compact_channel_name($::ib->name($channel)));
+                       }else{
+                               $buf .= sprintf('<a href="all/%s">    %s</a>',
+                                               ::uri_escape($channel),
+                                               $::ib->compact_channel_name($::ib->name($channel)));
+                       }
+                       $accesskey++;
+
+                       # \96¢\93Ç\8ds\90\94
+                       if($::ib->unread_lines($channel)){
+                               $buf .= sprintf(' <a href="unread/%s">%s</a>',
+                                               ::uri_escape($channel),
+                                               $::ib->unread_lines($channel));
+                               $unread_channels++;
+                       }
+                       $buf .= "<br />\n";
+               }
+
+               my $ci = new Keitairc::ClientInfo($request);
+               my $view = new Keitairc::View($::cf, $ci);
+               return $view->render('index.html',
+                                    {
+                                            buf => $buf,
+                                            unread => $unread_channels,
+                                    });
+       }
+};
+
+1;
diff --git a/lib/plugins/00recent b/lib/plugins/00recent
new file mode 100644 (file)
index 0000000..72e788c
--- /dev/null
@@ -0,0 +1,31 @@
+# -*-perl-*-
+# keitairc/lib/plugins/00recent
+# \96¢\93Ç\94­\8c¾\88ê\97\97
+# $Id: 00recent,v 1.1 2008-01-09 19:30:34 morimoto Exp $
+# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/00recent,v $
+
+$plugin = {
+       name => 'recent',
+       action_imprementation => sub {
+               my ($request, $name, $session_id, $param_string) = @_;
+               my $buf;
+
+               for my $channel ($::ib->channels()){
+                       if($::ib->unread_lines($channel)){
+                               my $name = $::ib->name($channel);
+                               Encode::from_to($name, 'jis', 'shiftjis');
+                               $buf .= $name;
+                               $buf .= sprintf(' <a href="all/%s">\91S\94­\8c¾\82Ö</a><br />', uri_escape($channel));
+                               $buf .= ::render_line($::ib->unread($channel), $session_id);
+                               $buf .= "<hr />\n";
+                               $::ib->clear_unread($channel);
+                       }
+               }
+
+               my $ci = new Keitairc::ClientInfo($request);
+               my $view = new Keitairc::View($::cf, $ci);
+               return $view->render('recent.html', { buf => $buf });
+       }
+};
+
+1;
diff --git a/lib/plugins/00topic b/lib/plugins/00topic
new file mode 100644 (file)
index 0000000..b9ba40e
--- /dev/null
@@ -0,0 +1,33 @@
+# -*-perl-*-
+# keitairc/lib/plugins/00topic
+# \83g\83s\83b\83N\88ê\97\97
+# $Id: 00topic,v 1.1 2008-01-09 19:30:34 morimoto Exp $
+# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/00topic,v $
+
+$plugin = {
+       name => 'topic',
+       action_imprementation => sub {
+               my ($request, $name, $session_id, $param_string) = @_;
+               my $buf;
+
+               for my $channel ($::ib->channels()){
+                       my $topic;
+                       $buf .= sprintf(' <a href="all/%s">%s</a><br />',
+                                       ::uri_escape($channel),
+                                       $::ib->compact_channel_name($::ib->name($channel)));
+                       if($topic = $::ib->topic($channel)){
+                               Encode::from_to($topic, 'jis', 'shiftjis');
+                       }else{
+                               $topic = '(ÄË߯¸\96¢\90Ý\92è)';
+                       }
+                       $buf .= $topic;
+                       $buf .= "<br />\n";
+               }
+
+               my $ci = new Keitairc::ClientInfo($request);
+               my $view = new Keitairc::View($::cf, $ci);
+               return $view->render('topic.html', { buf => $buf });
+       }
+};
+
+1;
diff --git a/lib/plugins/00unread b/lib/plugins/00unread
new file mode 100644 (file)
index 0000000..0bf383f
--- /dev/null
@@ -0,0 +1,45 @@
+# -*-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.1 2008-01-09 19:30:34 morimoto Exp $
+# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/00unread,v $
+
+$plugin = {
+       name => 'unread',
+       action_imprementation => sub {
+               my ($request, $name, $session_id, $param_string) = @_;
+               my $channel = ::uri_unescape($param_string);
+
+               ::send_message($request, $channel);
+
+               my $buf;
+               my $no_message_here_yet;
+               if(defined($::ib->name($channel))){
+                       if(length($::ib->buffer($channel))){
+                               $buf = ::render_line($::ib->unread($channel), $session_id) ||
+                                       '(\96¢\93Ç\94­\8c¾\82Í\82 \82è\82Ü\82¹\82ñ)';
+                               $buf .= sprintf('<hr /><a accesskey="5" href="../all/%s">[5] \91S\94­\8c¾\82Ö</a><br />',
+                                               ::uri_escape($channel));
+                       }else{
+                               $no_message_here_yet = 1;
+                       }
+               }else{
+                       $buf = '\8ew\92è\82ÌÁ¬ÈÙ\82Í\91\8dÝ\82µ\82Ü\82¹\82ñ';
+               }
+
+               $::ib->message_added(0); # clear check flags
+               $::ib->clear_unread($channel);
+
+               my $ci = new Keitairc::ClientInfo($request);
+               my $view = new Keitairc::View($::cf, $ci);
+               return $view->render('unread.html', {
+                       buf => $buf,
+                       channel_compact => $::ib->compact_channel_name($::ib->name($channel)),
+                       channel => ::uri_escape($channel),
+                       no_message_here_yet => $no_message_here_yet,
+                       ipod => $ci->is_ipod(),
+                            });
+       }
+};
+
+1;
diff --git a/lib/plugins/10url b/lib/plugins/10url
new file mode 100644 (file)
index 0000000..0a87d2e
--- /dev/null
@@ -0,0 +1,32 @@
+# -*-perl-*-
+# keitairc/lib/plugins/10url
+# URL\8f\88\97\9d
+# $Id: 10url,v 1.1 2008-01-09 19:30:34 morimoto Exp $
+# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/10url,v $
+
+$plugin = {
+       name => 'url',
+
+       message_replace_regexp => '\b(https?://[/!-;=-\177]+|www\.[/!-\177]+)',
+       message_replace_imprementation => sub {
+               my ($session_id, $param) = @_;
+               if($param =~ m/^http/){
+                       return sprintf('<a href="/%s/url/%s">%s</a>', $session_id, $param, $param);
+               }
+               return sprintf('<a href="/%s/url/http://%s">%s</a>', $session_id, $param, $param);
+       },
+
+       action_imprementation => sub {
+               my ($request, $name, $session_id, $param_string) = @_;
+               my $ci = new Keitairc::ClientInfo($request);
+               my $view = new Keitairc::View($::cf, $ci);
+               return $view->render('url.html', {
+                       url => $param_string,
+                       escaped_url => ::uri_escape($param_string),
+                       ezweb => $ci->is_ezweb(),
+                       sid => $session_id,
+                            });
+       }
+};
+
+1;
diff --git a/lib/plugins/20mail b/lib/plugins/20mail
new file mode 100644 (file)
index 0000000..608487b
--- /dev/null
@@ -0,0 +1,26 @@
+# -*-perl-*-
+# keitairc/lib/plugins/20mail
+# \83\81\81[\83\8b\83A\83h\83\8c\83X
+# $Id: 20mail,v 1.1 2008-01-09 19:30:34 morimoto Exp $
+# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/20mail,v $
+
+$plugin = {
+       name => 'mail',
+
+       message_replace_regexp => '\b(\w[\w.+=-]*\@[\w.-]+[\w]\.[\w]{2,4})\b',
+       message_replace_imprementation => sub {
+               my ($session_id, $param) = @_;
+               sprintf('<a href="/%s/mail/%s">%s</a>', $session_id, $param, $param);
+       },
+
+       action_imprementation => sub {
+               my ($request, $name, $session_id, $param_string) = @_;
+               my $ci = new Keitairc::ClientInfo($request);
+               my $view = new Keitairc::View($::cf, $ci);
+               return $view->render('mail.html', {
+                       mail => $param_string,
+                            });
+       }
+};
+
+1;
diff --git a/lib/plugins/20phone b/lib/plugins/20phone
new file mode 100644 (file)
index 0000000..38ff9ac
--- /dev/null
@@ -0,0 +1,30 @@
+# -*-perl-*-
+# keitairc/lib/plugins/20phone
+# \93d\98b\94Ô\8d\86
+# $Id: 20phone,v 1.1 2008-01-09 19:30:34 morimoto Exp $
+# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/20phone,v $
+
+$plugin = {
+       name => 'phone',
+
+       message_replace_regexp => '\b(0\d{1,3})([-(]?)(\d{2,4})([-)]?)(\d{4})\b',
+       message_replace_imprementation => sub {
+               my ($session_id, $p1, $p2, $p3, $p4, $p5) = @_;
+               sprintf('<a href="/%s/phone/%s%s%s">%s%s%s%s%s</a>',
+                       $session_id,
+                       $p1, $p3, $p5,
+                       $p1, $p2, $p3, $p4, $p5);
+       },
+
+       action_imprementation => sub {
+               my ($request, $name, $session_id, $param_string) = @_;
+               my $ci = new Keitairc::ClientInfo($request);
+               my $view = new Keitairc::View($::cf, $ci);
+               return $view->render('phone.html', {
+                       phone => $param_string,
+                       docomo => $ci->is_docomo(),
+                            });
+       }
+};
+
+1;