--- trunk/irc-logger.pl 2006/06/24 22:15:47 33
+++ trunk/bin/irc-logger.pl 2007/02/03 12:28:17 46
@@ -10,6 +10,20 @@
./irc-logger.pl
+=head2 Options
+
+=over 4
+
+=item --import-dircproxy=filename
+
+Import log from C to C database
+
+=item --log=irc-logger.log
+
+Name of log file
+
+=back
+
=head1 DESCRIPTION
log all conversation on irc channel
@@ -40,6 +54,9 @@
my $DSN = 'DBI:Pg:dbname=' . $NICK;
my $ENCODING = 'ISO-8859-2';
+my $TIMESTAMP = '%Y-%m-%d %H:%M:%S';
+
+my $sleep_on_error = 5;
## END CONFIG
@@ -52,6 +69,24 @@
use Regexp::Common qw /URI/;
use CGI::Simple;
use HTML::TagCloud;
+use POSIX qw/strftime/;
+use HTML::CalendarMonthSimple;
+use Getopt::Long;
+use DateTime;
+use Data::Dump qw/dump/;
+
+my $import_dircproxy;
+my $log_path;
+GetOptions(
+ 'import-dircproxy:s' => \$import_dircproxy,
+ 'log:s' => \$log_path,
+);
+
+open(STDOUT, '>', $log_path) || warn "can't redirect log to $log_path: $!";
+
+sub _log {
+ print strftime($TIMESTAMP,localtime()), ' ', join(" ",@_), $/;
+}
my $dbh = DBI->connect($DSN,"","", { RaiseError => 1, AutoCommit => 1 }) || die $DBI::errstr;
@@ -82,8 +117,8 @@
my $sth = $dbh->prepare(qq{
insert into log
- (channel, me, nick, message)
-values (?,?,?,?)
+ (channel, me, nick, message, time)
+values (?,?,?,?,?)
});
my $tags;
@@ -108,6 +143,7 @@
}
},
context => 5,
+ full_rows => 1,
);
Order is important. Fields are first passed through C (if available) and
@@ -115,13 +151,14 @@
C defines number of messages around each search hit for display.
+C will return database rows for each result with C, C
}
- );
+ );
+ }
+
+ $html .= qq{
+
+ See history of all messages.
+