/[irc-logger]/trunk/bin/irc-logger.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/bin/irc-logger.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 35 by dpavlin, Sun Jun 25 00:10:13 2006 UTC revision 36 by dpavlin, Sun Jun 25 16:37:39 2006 UTC
# Line 287  my $SEND_QUEUE;                 # cache Line 287  my $SEND_QUEUE;                 # cache
287    
288  POE::Component::IRC->new($IRC_ALIAS);  POE::Component::IRC->new($IRC_ALIAS);
289    
290    =head2 save_message
291    
292      save_message($channel,$me,$nick,$msg);
293    
294    =cut
295    
296    sub save_message {
297            my ($channel,$me,$nick,$msg) = @_;
298            $me ||= 0;
299            $sth->execute($channel, $me, $nick, $msg);
300            add_tag( id => $dbh->last_insert_id(undef,undef,"log",undef),
301                    message => $msg);
302    }
303    
304  POE::Session->create( inline_states =>  POE::Session->create( inline_states =>
305     {_start => sub {           {_start => sub {      
306                  $_[KERNEL]->post($IRC_ALIAS => register => 'all');                  $_[KERNEL]->post($IRC_ALIAS => register => 'all');
# Line 308  POE::Session->create( inline_states => Line 322  POE::Session->create( inline_states =>
322                  from_to($msg, 'UTF-8', $ENCODING);                  from_to($msg, 'UTF-8', $ENCODING);
323    
324                  print "$channel: <$nick> $msg\n";                  print "$channel: <$nick> $msg\n";
325                  $sth->execute($channel, 0, $nick, $msg);                  save_message($channel, 0, $nick, $msg);
                 add_tag( id => $dbh->last_insert_id(undef,undef,"log",undef),  
                         message => $msg);  
326      },      },
327      irc_ctcp_action => sub {      irc_ctcp_action => sub {
328                  my $kernel = $_[KERNEL];                  my $kernel = $_[KERNEL];
# Line 321  POE::Session->create( inline_states => Line 333  POE::Session->create( inline_states =>
333                  from_to($msg, 'UTF-8', $ENCODING);                  from_to($msg, 'UTF-8', $ENCODING);
334    
335                  print "$channel ***$nick $msg\n";                  print "$channel ***$nick $msg\n";
336                  $sth->execute($channel, 1, $nick, $msg);                  save_message($channel, 1, $nick, $msg);
                 add_tag( id => $dbh->last_insert_id(undef,undef,"log",undef),  
                         message => $msg);  
337      },      },
338          irc_msg => sub {          irc_msg => sub {
339                  my $kernel = $_[KERNEL];                  my $kernel = $_[KERNEL];

Legend:
Removed from v.35  
changed lines
  Added in v.36

  ViewVC Help
Powered by ViewVC 1.1.26