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 $timeid | \n"; + print FILE "author(s) | \n"; + print FILE "quote | \n"; + print FILE "date | \n"; + print FILE "grabbed by | \n"; + print FILE "
---|---|---|---|---|
" . ($quotegrab->{id}) . " | "; - $text = "<$quotegrab->{nick}> " . encode_entities($quotegrab->{text}) . " | \n"; + + my @nicks = split /\+/, $quotegrab->{nick}; + $text = join ', ', sort @nicks; + print FILE "" . encode_entities($text) . " | "; + + my $nick; + $text = $quotegrab->{text}; + + if($text =~ s/^\/me\s+//) { + $nick = "* $nicks[0]"; + } else { + $nick = "<$nicks[0]>"; + } + + $text = "". encode_entities($nick) . " " . encode_entities($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 "- grabbed by $quotegrab->{grabbed_by} $t\n"; - print FILE " | " . encode_entities(strftime "%Y/%m/%d %a %H:%M:%S", localtime $quotegrab->{timestamp}) . " | \n"; + print FILE "" . encode_entities($quotegrab->{grabbed_by}) . " | \n"; + print FILE "\n"; } - print FILE "