diff --git a/NEWS b/NEWS index 29d13f3..ce4a4bd 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,7 @@ In this alpha6 release, we have added: Bug fixes: * Fixed a bug that occurs when our configured nickname is in use. +* Fixed a bug with multi-prefix support. Incompatibilities: diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 59243e5..ef68751 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log 3.0 Indev =============================================================================== + * Fixed a bug with multi-prefix support. * Added fpfmt() to API::Std. * Auto::GR renamed to $Auto::VERGITREV. * Bumped minimum version for API to 3.0.0a6. diff --git a/lib/Proto/IRC.pm b/lib/Proto/IRC.pm index fc4a476..1946039 100644 --- a/lib/Proto/IRC.pm +++ b/lib/Proto/IRC.pm @@ -158,21 +158,27 @@ sub num353 { # Iterate through each user. for (my $i = 5; $i < scalar(@ex); $i++) { my $fi = 0; - foreach (keys %{ $csprefix{$svr} }) { + PFITER: foreach (keys %{ $csprefix{$svr} }) { # Check if the user has status in the channel. if (substr($ex[$i], 0, 1) eq $csprefix{$svr}{$_}) { # He/she does. Lets set that. - if (defined $chanusers{$svr}{$ex[4]}{lc(substr($ex[$i], 1))}) { + if (defined $chanusers{$svr}{$ex[4]}{lc $ex[$i]}) { # If the user has multiple statuses. - $chanusers{$svr}{$ex[4]}{lc(substr($ex[$i], 1))} .= $_; + $chanusers{$svr}{$ex[4]}{lc(substr($ex[$i], 1))} = $chanusers{$svr}{$ex[4]}{lc $ex[$i]}.$_; + delete $chanusers{$svr}{$ex[4]}{lc $ex[$i]}; } else { # Or not. $chanusers{$svr}{$ex[4]}{lc(substr($ex[$i], 1))} = $_; } $fi = 1; + $ex[$i] = substr $ex[$i], 1; } } + # Check if there's still a prefix. + foreach (keys %{$csprefix{$svr}}) { + if (substr($ex[$i], 0, 1) eq $csprefix{$svr}{$_}) { goto 'PFITER' } + } # They had status, so go to the next user. next if $fi; # They didn't, set them as a normal user.