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, $channel, '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 |
}); |
}); |
682 |
if ( ! defined( $1 ) ) { |
if ( ! defined( $1 ) ) { |
683 |
my $sth = $dbh->prepare(qq{ select name,value,changed from meta where nick = ? and channel = ? }); |
my $sth = $dbh->prepare(qq{ select name,value,changed from meta where nick = ? and channel = ? }); |
684 |
$sth->execute( $nick, $channel ); |
$sth->execute( $nick, $channel ); |
685 |
$res = "config for $nick "; |
$res = "config for $nick on $channel"; |
686 |
while ( my ($n,$v) = $sth->fetchrow_array ) { |
while ( my ($n,$v) = $sth->fetchrow_array ) { |
687 |
$res .= "| $n = $v"; |
$res .= " | $n = $v"; |
688 |
} |
} |
689 |
} elsif ( ! $2 ) { |
} elsif ( ! $2 ) { |
690 |
my $val = meta( $nick, $channel, $1 ); |
my $val = meta( $nick, $channel, $1 ); |