- foreach $mode (split(//, $modes)) {
- # sign.
- if ($mode =~ /[-+]/) {
- $parity = 1 if ($mode eq "+");
- $parity = 0 if ($mode eq "-");
- next;
- }
-
- # mode with target.
- if ($mode =~ /[bklov]/) {
- my $target = shift @targets;
-
- if ($parity) {
- $chanstats{$chan}{'Op'}++ if ($mode eq "o");
- $chanstats{$chan}{'Ban'}++ if ($mode eq "b");
- } else {
- $chanstats{$chan}{'Deop'}++ if ($mode eq "o");
- $chanstats{$chan}{'Unban'}++ if ($mode eq "b");
- }
-
- # modes w/ target affecting nick => cache it.
- if ($mode =~ /[bov]/) {
- $channels{$chan}{$mode}{$target}++ if $parity;
- delete $channels{$chan}{$mode}{$target} if !$parity;
-
- # lets do some custom stuff.
- if ($mode eq "o" and $parity) {
- if ($nick eq "ChanServ" and $target =~ /^\Q$ident\E$/i) {
- &VERB("hookmode: chanserv deopped us! asking",2);
- &chanServCheck($chan);
- }
-
- &chanLimitVerify($chan);
- }
- }
-
- if ($mode =~ /[l]/) {
- $channels{$chan}{$mode} = $target if $parity;
- delete $channels{$chan}{$mode} if !$parity;
- }
- }
-
- # important channel modes, targetless.
- if ($mode =~ /[mt]/) {
- $channels{$chan}{$mode}++ if $parity;
- delete $channels{$chan}{$mode} if !$parity;
- }
+ foreach $mode ( split( //, $modes ) ) {
+
+ # sign. tmp parity needed to store current state
+ if ( $mode =~ /[-+]/ ) {
+ $parity = 1 if ( $mode eq '+' );
+ $parity = 0 if ( $mode eq '-' );
+ next;
+ }
+
+ # mode with target.
+ if ( $mode =~ /[bklov]/ ) {
+ my $target = shift @targets;
+
+ if ($parity) {
+ $chanstats{ lc $chan }{'Op'}++ if ( $mode eq 'o' );
+ $chanstats{ lc $chan }{'Ban'}++ if ( $mode eq 'b' );
+ }
+ else {
+ $chanstats{ lc $chan }{'Deop'}++ if ( $mode eq 'o' );
+ $chanstats{ lc $chan }{'Unban'}++ if ( $mode eq 'b' );
+ }
+
+ # modes w/ target affecting nick => cache it.
+ if ( $mode =~ /[bov]/ ) {
+ $channels{ lc $chan }{$mode}{$target}++ if $parity;
+ delete $channels{ lc $chan }{$mode}{$target} if !$parity;
+
+ # lets do some custom stuff.
+ if ( $mode =~ /o/ and not $parity ) {
+ if ( $target =~ /^\Q$ident\E$/i ) {
+ &VERB( 'hookmode: someone deopped us!', 2 );
+ &chanServCheck($chan);
+ }
+
+ &chanLimitVerify($chan);
+ }
+ }
+
+ if ( $mode =~ /[l]/ ) {
+ $channels{ lc $chan }{$mode} = $target if $parity;
+ delete $channels{ lc $chan }{$mode} if !$parity;
+ }
+ }
+
+ # important channel modes, targetless.
+ if ( $mode =~ /[mt]/ ) {
+ $channels{ lc $chan }{$mode}++ if $parity;
+ delete $channels{ lc $chan }{$mode} if !$parity;
+ }