--- trunk/bin/irc-logger.pl 2007/03/18 16:45:18 52
+++ trunk/bin/irc-logger.pl 2007/04/14 12:45:03 60
@@ -75,6 +75,10 @@
use DateTime;
use Data::Dump qw/dump/;
+my $use_twitter = 1;
+eval { require Net::Twitter; };
+$use_twitter = 0 if ($@);
+
my $import_dircproxy;
my $log_path;
GetOptions(
@@ -545,8 +549,13 @@
save_message( channel => $channel, me => 1, nick => $nick, msg => $msg);
- if ( my $twitter = ( $nick, $channel, 'twitter' ) ) {
- _log("FIXME: send twitter for $nick on $channel [$twitter]");
+ if ( $use_twitter ) {
+ if ( my $twitter = meta( $nick, $NICK, 'twitter' ) ) {
+ my ($login,$passwd) = split(/\s+/,$twitter,2);
+ _log("sending twitter for $nick/$login on $channel ");
+ my $bot = Net::Twitter->new( username=>$login, password=>$passwd );
+ $bot->update("<${channel}> $msg");
+ }
}
},
@@ -593,11 +602,11 @@
my $sth = $dbh->prepare(qq{
select
- nick,
+ trim(both '_' from nick) as nick,
count(*) as count,
sum(length(message)) as len
from log
- group by nick
+ group by trim(both '_' from nick)
order by len desc,count desc
limit $nr
});
@@ -826,18 +835,35 @@
.nick { color: #000000; font-size: 80%; padding: 2px; font-family: courier, courier new, monospace ; }
.message { color: #000000; font-size: 100%; }
.search { float: right; }
+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; }
+/*
.col-0 { background: #ffff66 }
.col-1 { background: #a0ffff }
.col-2 { background: #99ff99 }
.col-3 { background: #ff9999 }
.col-4 { background: #ff66ff }
-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; }
+*/
_END_OF_STYLE_
my $max_color = 4;
+my @cols = qw(
+ #ffcccc #ccffe6 #ccccff #e6ccff #ffccff #ffcce6 #ff9999 #ffcc99 #ffff99
+ #ccff99 #99ff99 #99ffcc #99ccff #9999ff #cc99ff #ff6666 #ffb366 #ffff66
+ #66ff66 #66ffb3 #66b3ff #6666ff #ff3333 #33ff33 #3399ff #3333ff #ff3399
+ #a0a0a0 #ff0000 #ffff00 #80ff00 #0000ff #8000ff #ff00ff #ff0080 #994d00
+ #999900 #009900 #cc0066 #c0c0c0 #ccff99 #99ff33 #808080 #660033 #ffffff
+);
+
+$max_color = 0;
+foreach my $c (@cols) {
+ $style .= ".col-${max_color} { background: $c }\n";
+ $max_color++;
+}
+warn "defined $max_color colors for users...\n";
+
my %nick_enumerator;
sub root_handler {
@@ -918,6 +944,9 @@
$m =~ s/($escape_re)/$escape{$1}/gs;
$m =~ s#($RE{URI}{HTTP})#$1#gs;
$m =~ s#$tag_regex#$1#g;
+ $m =~ s#\*(\w+)\*#$1#gs;
+ $m =~ s#_(\w+)_#$1#gs;
+ $m =~ s#\/(\w+)\/#$1#gs;
return $m;
},
nick => sub {