--- trunk/irc-logger.pl 2006/05/20 10:30:45 26
+++ trunk/irc-logger.pl 2007/02/02 21:37:52 42
@@ -10,6 +10,14 @@
./irc-logger.pl
+=head2 Options
+
+=over 4
+
+=item --import-dircproxy=filename
+
+Import log from C to C database
+
=head1 DESCRIPTION
log all conversation on irc channel
@@ -18,13 +26,17 @@
## CONFIG
+my $HOSTNAME = `hostname`;
+
my $NICK = 'irc-logger';
+$NICK .= '-dev' if ($HOSTNAME =~ m/llin/);
my $CONNECT =
{Server => 'irc.freenode.net',
Nick => $NICK,
Ircname => "try /msg $NICK help",
};
my $CHANNEL = '#razmjenavjestina';
+$CHANNEL = '#irc-logger' if ($HOSTNAME =~ m/llin/);
my $IRC_ALIAS = "log";
my %FOLLOWS =
@@ -36,6 +48,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
@@ -44,10 +59,19 @@
use POE qw(Component::IRC Wheel::FollowTail Component::Server::HTTP);
use HTTP::Status;
use DBI;
-use Encode qw/from_to/;
+use Encode qw/from_to is_utf8/;
use Regexp::Common qw /URI/;
use CGI::Simple;
-
+use HTML::TagCloud;
+use POSIX qw/strftime/;
+use HTML::CalendarMonthSimple;
+use Getopt::Long;
+use DateTime;
+
+my $import_dircproxy;
+GetOptions(
+ 'import-dircproxy:s' => \$import_dircproxy,
+);
my $dbh = DBI->connect($DSN,"","", { RaiseError => 1, AutoCommit => 1 }) || die $DBI::errstr;
@@ -78,10 +102,13 @@
my $sth = $dbh->prepare(qq{
insert into log
- (channel, me, nick, message)
-values (?,?,?,?)
+ (channel, me, nick, message, time)
+values (?,?,?,?,?)
});
+my $tags;
+my $tag_regex = '\b([\w-_]+)//';
+
=head2 get_from_log
my @messages = get_from_log(
@@ -101,6 +128,7 @@
}
},
context => 5,
+ full_rows => 1,
);
Order is important. Fields are first passed through C (if available) and
@@ -108,13 +136,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.
+ };
+
+ $response->content( $html );
return RC_OK;
}