1 # -*- mode: perl; coding: utf-8 -*-
2 # keitairc/lib/plugins/00unread
4 # $Id: 00unread,v 1.15 2009-01-04 13:49:15 nyan_ Exp $
5 # $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/00unread,v $
7 # The line number (1 incremented) and filename below must be
9 # line 10 "keitairc/lib/plugins/00unread"
13 action_imprementation => sub {
14 my ($request, $name, $session_id, $param_string) = @_;
15 my $cid = $param_string;
16 my $channel = $::ib->cid2name($cid);
18 ::send_message($request, $channel);
21 if(defined($::ib->cid2name($cid))){
22 my ($tp, $np, $mp, $rp) = $::ib->buffer_ptr($cid);
24 my @range = (0 .. @{$tp}-1);
25 @range = reverse @range if $::cf->reverse_unread();
26 my ($last_date, $current_date) = ('', undef);
30 $current_date = $::ib->format_date(@{$tp}[$lp]);
31 unless($last_date eq $current_date){
32 $last_date = $current_date;
34 $pp->{date} = $current_date;
38 $p->{time} = $::ib->format_time(@{$tp}[$lp]);
39 $p->{nick} = $::ib->simple_escape(@{$np}[$lp]);
40 my $message = $::ib->colorize($::ib->simple_escape(@{$mp}[$lp])) || '';
41 for my $name ($::pl->list_replace_plugins()){
42 last if $message =~ s/$::pl->{plugins}->{$name}->{message_replace_regexp}/$::pl->{plugins}->{$name}->{message_replace_imprementation}($session_id, $1, $2, $3, $4, $5, $6, $7, $8, $9)/eg;
45 $message =~ s/\s+/ /g;
46 $p->{message} = Encode::encode($::cf->web_charset(), $message);
53 my $ci = new Keitairc::ClientInfo($request);
54 my $view = new Keitairc::View($::cf, $ci);
55 my $cname = Encode::encode($::cf->web_charset(), $::ib->simple_escape($::ib->compact_channel_name($cid)));
56 return $view->render('unread.html', {
58 channel_compact => $cname,
59 follow_nick => $::cf->follow_nick(),