summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlookshe <mail@lookshe.org>2012-01-11 09:15:06 +0100
committerlookshe <mail@lookshe.org>2012-01-11 09:15:06 +0100
commitd45663caaad3fb3f266f064b9c70955bf7d985c9 (patch)
treeda89ba9fd571f346955c26b537bc0b10060cdc9e
parent38252cc5541729f4e3b03bcebf36ca8e6beafa7b (diff)
masked special characters only for searchstring and not for outputs
-rw-r--r--firstseen.pl13
-rw-r--r--lastseen.pl23
-rw-r--r--lastspoke.pl9
3 files changed, 24 insertions, 21 deletions
diff --git a/firstseen.pl b/firstseen.pl
index 1e3d305..7d8f3b6 100644
--- a/firstseen.pl
+++ b/firstseen.pl
@@ -9,9 +9,10 @@ if ($#ARGV ne 2){
my $chan=$ARGV[1];
my $folder=$ARGV[0];
my $nick=$ARGV[2];
-$nick=~s/\\/\\\\/g;
-$nick=~s/\|/\\\|/g;
-$nick=~s/\^/\\\^/g;
+my $snick=$nick;
+$snick=~s/\\/\\\\/g;
+$snick=~s/\|/\\\|/g;
+$snick=~s/\^/\\\^/g;
my @files;
@@ -24,7 +25,7 @@ my $line;
open(file, $file) or die("Could not open file $file");
foreach $line (<file>) {
- if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\] (Action: )?<?$nick>? /i) {
+ if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\] (Action: )?<?$snick>? /i) {
if ($date =~ /^irgendwas$/) {
print "$nick belongs to inventory\n";
exit 0;
@@ -37,8 +38,8 @@ foreach $line (<file>) {
if ($line =~ m/^\[00:00(:00)?\] --- /){
($date=$line)=~s/^\[00:00(:00)?\] --- (.*)\n/$2/;
}
- if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-]{2})?\] Nick change: .* -> $nick/i) {
- ($newnick=$line)=~s/.* Nick change: (.*) -> $nick\n/$1/i;
+ if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-]{2})?\] Nick change: .* -> $snick/i) {
+ ($newnick=$line)=~s/.* Nick change: (.*) -> $snick\n/$1/i;
print "$nick was $newnick\n";
exec($^X, $0, $folder, $chan, $newnick);
exit 0
diff --git a/lastseen.pl b/lastseen.pl
index 4d78cc5..7e7e3b1 100644
--- a/lastseen.pl
+++ b/lastseen.pl
@@ -10,9 +10,10 @@ if ($#ARGV ne 2){
my $chan=$ARGV[1];
my $folder=$ARGV[0];
my $nick=$ARGV[2];
-$nick=~s/\\/\\\\/g;
-$nick=~s/\|/\\\|/g;
-$nick=~s/\^/\\\^/g;
+my $snick=$nick;
+$snick=~s/\\/\\\\/g;
+$snick=~s/\|/\\\|/g;
+$snick=~s/\^/\\\^/g;
my @files;
@@ -31,7 +32,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 change:)? $nick /i && $line !~ m/joined #/ ) {
+ if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\]( Nick change:)? $snick /i && $line !~ m/joined #/ ) {
$date=1;
$lastaction=$line;
}
@@ -39,23 +40,23 @@ while ($line=$log->readline()){
if ($line =~ m/^\[00:00(:00)?\] --- /){
($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);
- $k=12+length($nick);
+ $l=9+length($snick);
+ $k=12+length($snick);
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;
+ ($by=$lastaction)=~s/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\] $snick kicked from #.* by //i;
($reason=$by)=~s/.*: (.*)\n/$1/;
$by=~s/:.*\n//i;
print "$nick was kicked by $by on $date at $time reason: $reason\n";
- } elsif ($lastaction=~m/$nick \(.*\) left irc: /i){
- ($message=$lastaction)=~s/^.* $nick \(.*\) left irc: (.*)\n/$1/i;
+ } elsif ($lastaction=~m/$snick \(.*\) left irc: /i){
+ ($message=$lastaction)=~s/^.* $snick \(.*\) 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;
+ ($newnick=$lastaction)=~s/^.*Nick change: $snick -> (.*)\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;
+ ($message=$lastaction)=~s/^.* $snick \(.*\) left #[a-zA-Z0-9]* \((.*)\)\.\n/$1/i;
print "$nick has left on $date at $time saying: $message\n";
} else {
print "$nick has left on $date at $time\n";
diff --git a/lastspoke.pl b/lastspoke.pl
index 09d9104..1c3ea27 100644
--- a/lastspoke.pl
+++ b/lastspoke.pl
@@ -10,9 +10,10 @@ if ($#ARGV ne 2){
my $folder=$ARGV[0];
my $chan=$ARGV[1];
my $nick=$ARGV[2];
-$nick=~s/\\/\\\\/g;
-$nick=~s/\|/\\\|/g;
-$nick=~s/\^/\\\^/g;
+my $snick=$nick;
+$snick=~s/\\/\\\\/g;
+$snick=~s/\|/\\\|/g;
+$snick=~s/\^/\\\^/g;
my @files;
@@ -32,7 +33,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})?\] <$snick> /i && $line !~ m/joined #/ ) {
$date=1;
($lastaction=$line)=~s/\n//;
} elsif ($line =~ m/^\[00:00(:00)?\] --- /) {