Logger: Update names list for channel
This commit is contained in:
parent
060f27cb1d
commit
3b3c82f417
19
logger.pm
19
logger.pm
@ -242,7 +242,9 @@ sub handleJoin {
|
|||||||
if(!prepareLogFile($aLogFiles, $aServerName, $aCommand->[1])) {
|
if(!prepareLogFile($aLogFiles, $aServerName, $aCommand->[1])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$aLogFiles->{$aCommand->[1]}{"file"}->print(sprintf("(%s) %s has joined %s\n", localtime->strftime("%H:%M:%S"), getUsernameFromHost($aCommand->[2]), $aCommand->[1]));
|
my $username = getUsernameFromHost($aCommand->[2]);
|
||||||
|
push(@{$aLogFiles->{$aCommand->[1]}{"names"}}, $username);
|
||||||
|
$aLogFiles->{$aCommand->[1]}{"file"}->print(sprintf("(%s) %s has joined %s\n", localtime->strftime("%H:%M:%S"), $username, $aCommand->[1]));
|
||||||
$aLogFiles->{$aCommand->[1]}{"file"}->flush();
|
$aLogFiles->{$aCommand->[1]}{"file"}->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,9 +265,12 @@ sub handleQuit {
|
|||||||
my $username = getUsernameFromHost($aCommand->[$aCommandLength-1]);
|
my $username = getUsernameFromHost($aCommand->[$aCommandLength-1]);
|
||||||
foreach my $channel (keys(%$aLogFiles)) {
|
foreach my $channel (keys(%$aLogFiles)) {
|
||||||
my $found = 0;
|
my $found = 0;
|
||||||
foreach my $name (@{$aLogFiles->{$channel}{"names"}}) {
|
my $i = 0;
|
||||||
|
foreach $i (0..scalar(@{$aLogFiles->{$channel}{"names"}})-1) {
|
||||||
|
my $name = $aLogFiles->{$channel}{"names"}[$i];
|
||||||
if($name eq $username) {
|
if($name eq $username) {
|
||||||
$found = 1;
|
$found = 1;
|
||||||
|
splice(@{$aLogFiles->{$channel}{"names"}}, $i, 1);
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -290,7 +295,15 @@ sub handlePart {
|
|||||||
if(!prepareLogFile($aLogFiles, $aServerName, $aCommand->[1])) {
|
if(!prepareLogFile($aLogFiles, $aServerName, $aCommand->[1])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$aLogFiles->{$aCommand->[1]}{"file"}->print(sprintf("(%s) %s has left %s\n", localtime->strftime("%H:%M:%S"), getUsernameFromHost($aCommand->[2]), $aCommand->[1]));
|
my $username = getUsernameFromHost($aCommand->[2]);
|
||||||
|
foreach my $i (0..scalar(@{$aLogFiles->{$aCommand->[1]}{"names"}})-1) {
|
||||||
|
my $name = $aLogFiles->{$aCommand->[1]}{"names"}[$i];
|
||||||
|
if($name eq $username) {
|
||||||
|
splice(@{$aLogFiles->{$aCommand->[1]}{"names"}}, $i, 1);
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$aLogFiles->{$aCommand->[1]}{"file"}->print(sprintf("(%s) %s has left %s\n", localtime->strftime("%H:%M:%S"), $username, $aCommand->[1]));
|
||||||
$aLogFiles->{$aCommand->[1]}{"file"}->flush();
|
$aLogFiles->{$aCommand->[1]}{"file"}->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user