diff options
author | lookshe <mail@lookshe.org> | 2011-09-20 23:07:57 +0200 |
---|---|---|
committer | lookshe <mail@lookshe.org> | 2011-09-20 23:07:57 +0200 |
commit | c4b1a82f6b3ece544da0b6f42825b549aa6ac6f2 (patch) | |
tree | 48c0f168da713564b53b27cd08f30a07c5d79f69 | |
parent | a85ae62735024dbb05a80bfd41c81c97bdcea72f (diff) |
changed to get also nickchange
-rw-r--r-- | lastseen.pl | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lastseen.pl b/lastseen.pl index 196e5d7..4f0f05f 100644 --- a/lastseen.pl +++ b/lastseen.pl @@ -29,7 +29,7 @@ my $log = File::ReadBackwards->new($file) || die $!; while ($line=$log->readline()){ # $line=$log->readline(); if ($date eq 0){ - if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\] $nick /i && $line !~ m/joined #/ ) { + if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\] (Nick change:)? $nick /i && $line !~ m/joined #/ ) { $date=1; $lastaction=$line; } @@ -38,7 +38,8 @@ while ($line=$log->readline()){ ($date=$line)=~s/^\[00:00(:00)?\] --- (.*)\n/$2/; ($time=$lastaction)=~s/(.*)\[([0-9]{2}:[0-9]{2}(:[0-9]{2})?)\](.*)\n/$2/; $l=9+length($nick); - if ($lastaction=~m/^.{$l}kicked/){ + $k=12+length($nick); + if ($lastaction=~m/^.{$l}kicked/ || $lastaction=~m/.{$k}kicked/){ ($by=$lastaction)=~s/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\] $nick kicked from #.* by //i; ($reason=$by)=~s/.*: (.*)\n/$1/; $by=~s/:.*\n//i; @@ -47,6 +48,9 @@ while ($line=$log->readline()){ } elsif ($lastaction=~m/$nick \(.*\) left irc: /i){ ($message=$lastaction)=~s/^.* $nick \(.*\) left irc: (.*)\n/$1/i; print "$nick has quit on $date at $time saying: $message\n"; + } elsif ($lastaction=~m/Nick change: $nick /i) { + ($newnick=$lastaction)=~s/^.*Nick change: $nick -> (.*)\n/$1/i; + print "$nick changed his name to $newnick on $date at $time\n"; } else { if ($lastaction=~m/\)\.$/) { ($message=$lastaction)=~s/^.* $nick \(.*\) left #[a-zA-Z0-9]* \((.*)\)\.\n/$1/i; |