diff --git a/PBot/Quotegrabs.pm b/PBot/Quotegrabs.pm index f21dddb9..5f28d651 100644 --- a/PBot/Quotegrabs.pm +++ b/PBot/Quotegrabs.pm @@ -15,6 +15,8 @@ use HTML::Entities; use Time::Duration; use Time::HiRes qw(gettimeofday); +use POSIX qw(strftime); + sub new { if(ref($_[1]) eq 'HASH') { Carp::croak("Options to Quotegrabs should be key/value pairs, not hash reference"); @@ -111,18 +113,30 @@ sub export_quotegrabs() { my $self = shift; return "Not enabled" if not defined $self->{export_path}; my $text; + my $table_id = 1; my $last_channel = ""; my $had_table = 0; open FILE, "> $self->{export_path}" or return "Could not open export path."; my $time = localtime; - print FILE "Generated at $time

Candide's Quotegrabs

\n"; + print FILE "\n\n"; + print FILE '' . "\n"; + print FILE '' . "\n"; + print FILE "Generated at $time

Candide's Quotegrabs

\n"; my $i = 0; foreach my $quotegrab (sort { $$a{channel} cmp $$b{channel} or $$a{nick} cmp $$b{nick} } @{ $self->{quotegrabs} }) { if(not $quotegrab->{channel} =~ /^$last_channel$/i) { - print FILE "\n" if $had_table; + print FILE "\n\n" if $had_table; print FILE "

$quotegrab->{channel}


\n"; - print FILE "\n"; + print FILE "
\n"; + print FILE "\n\n"; + print FILE "\n"; + print FILE "\n"; + print FILE "\n"; + print FILE "\n"; + print FILE "\n"; + print FILE "\n\n\n"; $had_table = 1; + $table_id++; } $last_channel = $quotegrab->{channel}; @@ -133,17 +147,39 @@ sub export_quotegrabs() { } else { print FILE "\n"; } + print FILE ""; - $text = "\n"; + + my @nicks = split /\+/, $quotegrab->{nick}; + $text = join ', ', sort @nicks; + print FILE ""; + + my $nick; + $text = $quotegrab->{text}; + + if($text =~ s/^\/me\s+//) { + $nick = "* $nicks[0]"; + } else { + $nick = "<$nicks[0]>"; + } + + $text = "\n"; print FILE $text; - my ($seconds, $minutes, $hours, $day_of_month, $month, $year, $wday, $yday, $isdst) = localtime($quotegrab->{timestamp}); - my $t = sprintf("%02d:%02d:%02d-%04d/%02d/%02d\n", - $hours, $minutes, $seconds, $year+1900, $month+1, $day_of_month); - print FILE "\n"; + + + print FILE "\n"; + print FILE "\n"; + print FILE "\n"; } - print FILE "
id    author(s)quotedategrabbed by
" . ($quotegrab->{id}) . "<$quotegrab->{nick}> " . encode_entities($quotegrab->{text}) . "" . encode_entities($text) . "". encode_entities($nick) . " " . encode_entities($text) . "- grabbed by
$quotegrab->{grabbed_by}
$t\n"; - print FILE "
" . encode_entities(strftime "%Y/%m/%d %a %H:%M:%S", localtime $quotegrab->{timestamp}) . "" . encode_entities($quotegrab->{grabbed_by}) . "
\n"; + print FILE "\n\n" if $had_table; + print FILE "\n"; close(FILE); return "$i quotegrabs exported to http://blackshell.com/~msmud/candide/quotegrabs.html"; } diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 574386e9..b5cf2dfb 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,7 +13,7 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 438, + BUILD_REVISION => 439, BUILD_DATE => "2013-10-11", };