75 |
use DateTime; |
use DateTime; |
76 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
77 |
|
|
78 |
|
my $use_twitter = 1; |
79 |
|
eval { require Net::Twitter; }; |
80 |
|
$use_twitter = 0 if ($@); |
81 |
|
|
82 |
my $import_dircproxy; |
my $import_dircproxy; |
83 |
my $log_path; |
my $log_path; |
84 |
GetOptions( |
GetOptions( |
549 |
|
|
550 |
save_message( channel => $channel, me => 1, nick => $nick, msg => $msg); |
save_message( channel => $channel, me => 1, nick => $nick, msg => $msg); |
551 |
|
|
552 |
if ( my $twitter = ( $nick, $channel, 'twitter' ) ) { |
if ( $use_twitter ) { |
553 |
_log("FIXME: send twitter for $nick on $channel [$twitter]"); |
if ( my $twitter = meta( $nick, $NICK, 'twitter' ) ) { |
554 |
|
my ($login,$passwd) = split(/\s+/,$twitter,2); |
555 |
|
_log("sending twitter for $nick/$login on $channel "); |
556 |
|
my $bot = Net::Twitter->new( username=>$login, password=>$passwd ); |
557 |
|
$bot->update("<${channel}> $msg"); |
558 |
|
} |
559 |
} |
} |
560 |
|
|
561 |
}, |
}, |
602 |
|
|
603 |
my $sth = $dbh->prepare(qq{ |
my $sth = $dbh->prepare(qq{ |
604 |
select |
select |
605 |
nick, |
trim(both '_' from nick) as nick, |
606 |
count(*) as count, |
count(*) as count, |
607 |
sum(length(message)) as len |
sum(length(message)) as len |
608 |
from log |
from log |
609 |
group by nick |
group by trim(both '_' from nick) |
610 |
order by len desc,count desc |
order by len desc,count desc |
611 |
limit $nr |
limit $nr |
612 |
}); |
}); |
835 |
.nick { color: #000000; font-size: 80%; padding: 2px; font-family: courier, courier new, monospace ; } |
.nick { color: #000000; font-size: 80%; padding: 2px; font-family: courier, courier new, monospace ; } |
836 |
.message { color: #000000; font-size: 100%; } |
.message { color: #000000; font-size: 100%; } |
837 |
.search { float: right; } |
.search { float: right; } |
838 |
|
a:link.tag, a:visited.tag { border: 1px dashed #ccc; backgound: #ccc; text-decoration: none } |
839 |
|
a:hover.tag { border: 1px solid #eee } |
840 |
|
hr { border: 1px dashed #ccc; height: 1px; clear: both; } |
841 |
|
/* |
842 |
.col-0 { background: #ffff66 } |
.col-0 { background: #ffff66 } |
843 |
.col-1 { background: #a0ffff } |
.col-1 { background: #a0ffff } |
844 |
.col-2 { background: #99ff99 } |
.col-2 { background: #99ff99 } |
845 |
.col-3 { background: #ff9999 } |
.col-3 { background: #ff9999 } |
846 |
.col-4 { background: #ff66ff } |
.col-4 { background: #ff66ff } |
847 |
a:link.tag, a:visited.tag { border: 1px dashed #ccc; backgound: #ccc; text-decoration: none } |
*/ |
|
a:hover.tag { border: 1px solid #eee } |
|
|
hr { border: 1px dashed #ccc; height: 1px; clear: both; } |
|
848 |
_END_OF_STYLE_ |
_END_OF_STYLE_ |
849 |
|
|
850 |
my $max_color = 4; |
my $max_color = 4; |
851 |
|
|
852 |
|
my @cols = qw( |
853 |
|
#ffcccc #ccffe6 #ccccff #e6ccff #ffccff #ffcce6 #ff9999 #ffcc99 #ffff99 |
854 |
|
#ccff99 #99ff99 #99ffcc #99ccff #9999ff #cc99ff #ff6666 #ffb366 #ffff66 |
855 |
|
#66ff66 #66ffb3 #66b3ff #6666ff #ff3333 #33ff33 #3399ff #3333ff #ff3399 |
856 |
|
#a0a0a0 #ff0000 #ffff00 #80ff00 #0000ff #8000ff #ff00ff #ff0080 #994d00 |
857 |
|
#999900 #009900 #cc0066 #c0c0c0 #ccff99 #99ff33 #808080 #660033 #ffffff |
858 |
|
); |
859 |
|
|
860 |
|
$max_color = 0; |
861 |
|
foreach my $c (@cols) { |
862 |
|
$style .= ".col-${max_color} { background: $c }\n"; |
863 |
|
$max_color++; |
864 |
|
} |
865 |
|
warn "defined $max_color colors for users...\n"; |
866 |
|
|
867 |
my %nick_enumerator; |
my %nick_enumerator; |
868 |
|
|
869 |
sub root_handler { |
sub root_handler { |
944 |
$m =~ s/($escape_re)/$escape{$1}/gs; |
$m =~ s/($escape_re)/$escape{$1}/gs; |
945 |
$m =~ s#($RE{URI}{HTTP})#<a href="$1">$1</a>#gs; |
$m =~ s#($RE{URI}{HTTP})#<a href="$1">$1</a>#gs; |
946 |
$m =~ s#$tag_regex#<a href="?tag=$1" class="tag">$1</a>#g; |
$m =~ s#$tag_regex#<a href="?tag=$1" class="tag">$1</a>#g; |
947 |
|
$m =~ s#\*(\w+)\*#<b>$1</b>#gs; |
948 |
|
$m =~ s#_(\w+)_#<u>$1</u>#gs; |
949 |
|
$m =~ s#\/(\w+)\/#<i>$1</i>#gs; |
950 |
return $m; |
return $m; |
951 |
}, |
}, |
952 |
nick => sub { |
nick => sub { |