Lots of cleanup.
This commit is contained in:
1 parent
a66d6993cd
commit
0e708c5ee3
1 file changed
+29
-29
+29
-29
@@ -69,11 +69,11 @@ sub ircparse
|
|||||||
# If it's a ping...
|
# If it's a ping...
|
||||||
if ($ex[0] eq 'PING') {
|
if ($ex[0] eq 'PING') {
|
||||||
# send a PONG.
|
# send a PONG.
|
||||||
Auto::socksnd($svr, "PONG ".$ex[1]);
|
Auto::socksnd($svr, "PONG $ex[1]");
|
||||||
}
|
}
|
||||||
# If it's AUTHENTICATE
|
# If it's AUTHENTICATE
|
||||||
elsif ($ex[0] eq 'AUTHENTICATE') {
|
elsif ($ex[0] eq 'AUTHENTICATE') {
|
||||||
if (API::Std::mod_exists("SASLAuth")) {
|
if (API::Std::mod_exists('SASLAuth')) {
|
||||||
M::SASLAuth::handle_authenticate($svr, @ex);
|
M::SASLAuth::handle_authenticate($svr, @ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -156,38 +156,38 @@ sub num353 {
|
|||||||
my ($svr, @ex) = @_;
|
my ($svr, @ex) = @_;
|
||||||
|
|
||||||
# Get rid of the colon.
|
# Get rid of the colon.
|
||||||
$ex[5] = substr($ex[5], 1);
|
$ex[5] = substr $ex[5], 1;
|
||||||
# Delete the old chanusers hash if it exists.
|
# Delete the old chanusers hash if it exists.
|
||||||
delete $chanusers{$svr}{$ex[4]} if (defined $chanusers{$svr}{$ex[4]});
|
if (defined $chanusers{$svr}{$ex[4]}) { delete $chanusers{$svr}{$ex[4]} }
|
||||||
# Iterate through each user.
|
# Iterate through each user.
|
||||||
for (my $i = 5; $i < scalar(@ex); $i++) {
|
for (5..$#ex) {
|
||||||
my $fi = 0;
|
my $fi = 0;
|
||||||
PFITER: foreach (keys %{ $csprefix{$svr} }) {
|
PFITER: foreach my $spfx (keys %{ $csprefix{$svr} }) {
|
||||||
# Check if the user has status in the channel.
|
# Check if the user has status in the channel.
|
||||||
if (substr($ex[$i], 0, 1) eq $csprefix{$svr}{$_}) {
|
if (substr($ex[$_], 0, 1) eq $csprefix{$svr}{$spfx}) {
|
||||||
# He/she does. Lets set that.
|
# He/she does. Lets set that.
|
||||||
if (defined $chanusers{$svr}{$ex[4]}{lc $ex[$i]}) {
|
if (defined $chanusers{$svr}{$ex[4]}{lc $ex[$_]}) {
|
||||||
# If the user has multiple statuses.
|
# If the user has multiple statuses.
|
||||||
$chanusers{$svr}{$ex[4]}{lc(substr($ex[$i], 1))} = $chanusers{$svr}{$ex[4]}{lc $ex[$i]}.$_;
|
$chanusers{$svr}{$ex[4]}{lc substr $ex[$_], 1} = $chanusers{$svr}{$ex[4]}{lc $ex[$_]}.$spfx;
|
||||||
delete $chanusers{$svr}{$ex[4]}{lc $ex[$i]};
|
delete $chanusers{$svr}{$ex[4]}{lc $ex[$_]};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# Or not.
|
# Or not.
|
||||||
$chanusers{$svr}{$ex[4]}{lc(substr($ex[$i], 1))} = $_;
|
$chanusers{$svr}{$ex[4]}{lc substr $ex[$_], 1} = $spfx;
|
||||||
}
|
}
|
||||||
$fi = 1;
|
$fi = 1;
|
||||||
$ex[$i] = substr $ex[$i], 1;
|
$ex[$_] = substr $ex[$_], 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Check if there's still a prefix.
|
# Check if there's still a prefix.
|
||||||
foreach (keys %{$csprefix{$svr}}) {
|
foreach my $spfx (keys %{$csprefix{$svr}}) {
|
||||||
if (substr($ex[$i], 0, 1) eq $csprefix{$svr}{$_}) { goto 'PFITER' }
|
if (substr($ex[$_], 0, 1) eq $csprefix{$svr}{$spfx}) { goto 'PFITER' }
|
||||||
}
|
}
|
||||||
# They had status, so go to the next user.
|
# They had status, so go to the next user.
|
||||||
next if $fi;
|
next if $fi;
|
||||||
# They didn't, set them as a normal user.
|
# They didn't, set them as a normal user.
|
||||||
if (!defined $chanusers{$svr}{$ex[4]}{lc($ex[$i])}) {
|
if (!defined $chanusers{$svr}{$ex[4]}{lc $ex[$_]}) {
|
||||||
$chanusers{$svr}{$ex[4]}{lc($ex[$i])} = 1;
|
$chanusers{$svr}{$ex[4]}{lc $ex[$_]} = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,14 +211,14 @@ sub num432 {
|
|||||||
my ($svr, undef) = @_;
|
my ($svr, undef) = @_;
|
||||||
|
|
||||||
if ($got_001{$svr}) {
|
if ($got_001{$svr}) {
|
||||||
err(3, "Got error from server[".$svr."]: Erroneous nickname.", 0);
|
err(3, "Got error from server[$svr]: Erroneous nickname.", 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
err(2, "Got error from server[".$svr."] before 001: Erroneous nickname. Closing connection.", 0);
|
err(2, "Got error from server[$svr] before connection complete: Erroneous nickname. Closing connection.", 0);
|
||||||
API::IRC::quit($svr, "An error occurred.");
|
API::IRC::quit($svr, 'An error occurred.');
|
||||||
}
|
}
|
||||||
|
|
||||||
delete $botinfo{$svr}{newnick} if (defined $botinfo{$svr}{newnick});
|
if (defined $botinfo{$svr}{newnick}) { delete $botinfo{$svr}{newnick} }
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -229,7 +229,7 @@ sub num433 {
|
|||||||
my ($svr, undef) = @_;
|
my ($svr, undef) = @_;
|
||||||
|
|
||||||
if (defined $botinfo{$svr}{newnick}) {
|
if (defined $botinfo{$svr}{newnick}) {
|
||||||
API::IRC::nick($svr, $botinfo{$svr}{newnick}."_");
|
API::IRC::nick($svr, $botinfo{$svr}{newnick}.'_');
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -241,9 +241,9 @@ sub num438 {
|
|||||||
my ($svr, @ex) = @_;
|
my ($svr, @ex) = @_;
|
||||||
|
|
||||||
if (defined $botinfo{$svr}{newnick}) {
|
if (defined $botinfo{$svr}{newnick}) {
|
||||||
API::Std::timer_add("num438_".$botinfo{$svr}{newnick}, 1, $ex[11], sub {
|
API::Std::timer_add('num438_'.$botinfo{$svr}{newnick}, 1, $ex[11], sub {
|
||||||
API::IRC::nick($Proto::IRC::botinfo{$svr}{newnick});
|
API::IRC::nick($Proto::IRC::botinfo{$svr}{newnick});
|
||||||
delete $botinfo{$svr}{newnick} if (defined $botinfo{$svr}{newnick});
|
if (defined $botinfo{$svr}{newnick}) { delete $botinfo{$svr}{newnick} }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ sub num438 {
|
|||||||
sub num465 {
|
sub num465 {
|
||||||
my ($svr, undef) = @_;
|
my ($svr, undef) = @_;
|
||||||
|
|
||||||
err(3, "Banned from ".$svr."! Closing link...", 0);
|
err(3, "Banned from $svr.! Closing link...", 0);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -265,7 +265,7 @@ sub num465 {
|
|||||||
sub num471 {
|
sub num471 {
|
||||||
my ($svr, (undef, undef, undef, $chan)) = @_;
|
my ($svr, (undef, undef, undef, $chan)) = @_;
|
||||||
|
|
||||||
err(3, "Cannot join channel ".$chan." on ".$svr.": Channel is full.", 0);
|
err(3, "Cannot join channel $chan on $svr: Channel is full.", 0);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -275,7 +275,7 @@ sub num471 {
|
|||||||
sub num473 {
|
sub num473 {
|
||||||
my ($svr, (undef, undef, undef, $chan)) = @_;
|
my ($svr, (undef, undef, undef, $chan)) = @_;
|
||||||
|
|
||||||
err(3, "Cannot join channel ".$chan." on ".$svr.": Channel is invite-only.", 0);
|
err(3, "Cannot join channel $chan on $svr: Channel is invite-only.", 0);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -285,7 +285,7 @@ sub num473 {
|
|||||||
sub num474 {
|
sub num474 {
|
||||||
my ($svr, (undef, undef, undef, $chan)) = @_;
|
my ($svr, (undef, undef, undef, $chan)) = @_;
|
||||||
|
|
||||||
err(3, "Cannot join channel ".$chan." on ".$svr.": Banned from channel.", 0);
|
err(3, "Cannot join channel $chan on $svr: Banned from channel.", 0);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -295,7 +295,7 @@ sub num474 {
|
|||||||
sub num475 {
|
sub num475 {
|
||||||
my ($svr, (undef, undef, undef, $chan)) = @_;
|
my ($svr, (undef, undef, undef, $chan)) = @_;
|
||||||
|
|
||||||
err(3, "Cannot join channel ".$chan." on ".$svr.": Bad key.", 0);
|
err(3, "Cannot join channel $chan on $svr: Bad key.", 0);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -305,7 +305,7 @@ sub num475 {
|
|||||||
sub num477 {
|
sub num477 {
|
||||||
my ($svr, (undef, undef, undef, $chan)) = @_;
|
my ($svr, (undef, undef, undef, $chan)) = @_;
|
||||||
|
|
||||||
err(3, "Cannot join channel ".$chan." on ".$svr.": Need registered nickname.", 0);
|
err(3, "Cannot join channel $chan on $svr: Need registered nickname.", 0);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user