From ea775d4c980c040149e1e6355c52b0cd479a09b1 Mon Sep 17 00:00:00 2001 From: Elijah Perrault Date: Mon, 21 Mar 2011 14:18:57 -0600 Subject: [PATCH] More tab removal. --- lib/Core/IRC.pm | 42 ++++---- lib/Lib/Auto.pm | 6 +- lib/Parser/Config.pm | 252 +++++++++++++++++++++---------------------- lib/Parser/Lang.pm | 70 ++++++------ lib/State/IRC.pm | 42 ++++---- 5 files changed, 206 insertions(+), 206 deletions(-) diff --git a/lib/Core/IRC.pm b/lib/Core/IRC.pm index 2d6ac2c..adcd2cd 100644 --- a/lib/Core/IRC.pm +++ b/lib/Core/IRC.pm @@ -79,8 +79,8 @@ hook_add("on_connect", "on_connect_modes", sub { my ($svr) = @_; if (conf_get("server:$svr:modes")) { - my $connmodes = (conf_get("server:$svr:modes"))[0][0]; - API::IRC::umode($svr, $connmodes); + my $connmodes = (conf_get("server:$svr:modes"))[0][0]; + API::IRC::umode($svr, $connmodes); } return 1; @@ -100,8 +100,8 @@ hook_add("on_connect", "plaintext_auth", sub { my ($svr) = @_; if (conf_get("server:$svr:idstr")) { - my $idstr = (conf_get("server:$svr:idstr"))[0][0]; - Auto::socksnd($svr, $idstr); + my $idstr = (conf_get("server:$svr:idstr"))[0][0]; + Auto::socksnd($svr, $idstr); } return 1; @@ -116,9 +116,9 @@ hook_add("on_connect", "autojoin", sub { # Join the channels. if (!defined $cajoin[1]) { - # For single-line ajoins. - my @sajoin = split(',', $cajoin[0]); - + # For single-line ajoins. + my @sajoin = split(',', $cajoin[0]); + foreach (@sajoin) { # Check if a key was specified. if ($_ =~ m/\s/xsm) { @@ -128,13 +128,13 @@ hook_add("on_connect", "autojoin", sub { } else { # Else join without one. - API::IRC::cjoin($svr, $_); + API::IRC::cjoin($svr, $_); } } } else { - # For multi-line ajoins. - foreach (@cajoin) { + # For multi-line ajoins. + foreach (@cajoin) { # Check if a key was specified. if ($_ =~ m/\s/xsm) { # There was, join with it. @@ -178,17 +178,17 @@ hook_add('on_isupport', 'core.prefixchanmode.getdata', sub { # Find PREFIX and CHANMODES. foreach my $ex (@ex) { - if ($ex =~ m/^PREFIX/xsm) { - # Found PREFIX. - my $rpx = substr($ex, 8); - my ($pm, $pp) = split('\)', $rpx); - my @apm = split(//, $pm); - my @app = split(//, $pp); - foreach my $ppm (@apm) { - # Store data. - $Proto::IRC::csprefix{$svr}{$ppm} = shift(@app); - } - } + if ($ex =~ m/^PREFIX/xsm) { + # Found PREFIX. + my $rpx = substr($ex, 8); + my ($pm, $pp) = split('\)', $rpx); + my @apm = split(//, $pm); + my @app = split(//, $pp); + foreach my $ppm (@apm) { + # Store data. + $Proto::IRC::csprefix{$svr}{$ppm} = shift(@app); + } + } elsif ($ex =~ m/^CHANMODES/xsm) { # Found CHANMODES. my ($mtl, $mtp, $mtpp, $mts) = split m/[,]/xsm, substr($ex, 10); diff --git a/lib/Lib/Auto.pm b/lib/Lib/Auto.pm index eea28e5..5e9f09f 100644 --- a/lib/Lib/Auto.pm +++ b/lib/Lib/Auto.pm @@ -157,10 +157,10 @@ sub ircsock { # Prepare socket data. my %conndata = ( - Proto => 'tcp', + Proto => 'tcp', LocalAddr => $cdata->{'bind'}[0], - PeerAddr => $cdata->{'host'}[0], - PeerPort => $cdata->{'port'}[0], + PeerAddr => $cdata->{'host'}[0], + PeerPort => $cdata->{'port'}[0], Timeout => 20, ); # Set IPv6/SSL data. diff --git a/lib/Parser/Config.pm b/lib/Parser/Config.pm index 6ad7cad..47e8bbf 100644 --- a/lib/Parser/Config.pm +++ b/lib/Parser/Config.pm @@ -14,7 +14,7 @@ sub new # Check to see if the configuration file exists. if (!-e "$Auto::bin{etc}/$file") { - return; + return; } # Open, read and close the config. @@ -44,135 +44,135 @@ sub parse # Iterate the file. foreach my $buff (@fbuf) { - # Main newline buffer. - if (defined $buff) { - # If the line begins with a #, it's a comment so ignore it. - if (substr($buff, 0, 1) eq '#') { - next; - } - - if ($buff =~ m/;/) { - # Semicolon buffer. - my @asbuf = split(';', $buff); - foreach my $asbuff (@asbuf) { - if (defined $asbuff) { - - # Space buffer. - my @ebuf = split(' ', $asbuff); - if (!defined $ebuf[0] or !defined $ebuf[1]) { - # Garbage. Ignoring. - next; - } - my $param = $ebuf[1]; - - if (substr($param, 0, 1) eq '"' and substr($param, length($param) - 1, 1) ne '"') { - # Multi-word string. - $param = substr($param, 1); - - for (my $i = 2; $i < scalar(@ebuf); $i++) { - if (substr($ebuf[$i], length($ebuf[$i]) - 1, 1) eq '"') { - $param .= " ".substr($ebuf[$i], 0, length($ebuf[$i]) - 1); - last; - } - else { - $param .= " ".$ebuf[$i]; - } - } - } - elsif (substr($param, 0, 1) eq '"' and substr($param, length($param) - 1, 1) eq '"') { - # Single-word string. - $param = substr($param, 1, length($ebuf[1]) - 2); - } - elsif ($param =~ m/[0-9]/) { - # Numeric. - $param =~ s/[^0-9.]//g; - } - else { - # Garbage. - next; - } - - my @param = ($param); - - unless (!$blk) { - # We're inside a block. - if ($blk =~ m/@@@/) { - # We're inside a block with a parameter. - my @sblk = split('@@@', $blk); - - # Check to see if this config option already exists. - if (defined $rs{$sblk[0]}{$sblk[1]}{$ebuf[0]}) { - # It does, so merely push this second one to the existing array. - push(@{ $rs{$sblk[0]}{$sblk[1]}{$ebuf[0]} }, $param); - } - else { - # It doesn't, create it as an array. - @{ $rs{$sblk[0]}{$sblk[1]}{$ebuf[0]} } = @param; - } - } - else { - # We're inside a block with no parameter. - - # Check to see if this config option already exists. - if (defined $rs{$blk}{$ebuf[0]}) { - # It does, so merely push this second one to the existing array. + # Main newline buffer. + if (defined $buff) { + # If the line begins with a #, it's a comment so ignore it. + if (substr($buff, 0, 1) eq '#') { + next; + } + + if ($buff =~ m/;/) { + # Semicolon buffer. + my @asbuf = split(';', $buff); + foreach my $asbuff (@asbuf) { + if (defined $asbuff) { + + # Space buffer. + my @ebuf = split(' ', $asbuff); + if (!defined $ebuf[0] or !defined $ebuf[1]) { + # Garbage. Ignoring. + next; + } + my $param = $ebuf[1]; + + if (substr($param, 0, 1) eq '"' and substr($param, length($param) - 1, 1) ne '"') { + # Multi-word string. + $param = substr($param, 1); + + for (my $i = 2; $i < scalar(@ebuf); $i++) { + if (substr($ebuf[$i], length($ebuf[$i]) - 1, 1) eq '"') { + $param .= " ".substr($ebuf[$i], 0, length($ebuf[$i]) - 1); + last; + } + else { + $param .= " ".$ebuf[$i]; + } + } + } + elsif (substr($param, 0, 1) eq '"' and substr($param, length($param) - 1, 1) eq '"') { + # Single-word string. + $param = substr($param, 1, length($ebuf[1]) - 2); + } + elsif ($param =~ m/[0-9]/) { + # Numeric. + $param =~ s/[^0-9.]//g; + } + else { + # Garbage. + next; + } + + my @param = ($param); + + unless (!$blk) { + # We're inside a block. + if ($blk =~ m/@@@/) { + # We're inside a block with a parameter. + my @sblk = split('@@@', $blk); + + # Check to see if this config option already exists. + if (defined $rs{$sblk[0]}{$sblk[1]}{$ebuf[0]}) { + # It does, so merely push this second one to the existing array. + push(@{ $rs{$sblk[0]}{$sblk[1]}{$ebuf[0]} }, $param); + } + else { + # It doesn't, create it as an array. + @{ $rs{$sblk[0]}{$sblk[1]}{$ebuf[0]} } = @param; + } + } + else { + # We're inside a block with no parameter. + + # Check to see if this config option already exists. + if (defined $rs{$blk}{$ebuf[0]}) { + # It does, so merely push this second one to the existing array. push(@{ $rs{$blk}{$ebuf[0]} }, $param); - } - else { - # It doesn't, create it as an array. - @{ $rs{$blk}{$ebuf[0]} } = @param; - } - } - } - else { - # We're not inside a block. - - # Check to see if this config option already exists. - if (defined $rs{$ebuf[0]}) { - # It does, so merely push this second one to the existing array. - push(@{ $rs{$ebuf[0]} }, $param); - } - else { - # It doesn't, create it as an array. - @{ $rs{$ebuf[0]} } = @param; - } - } - } - } - } - else { - # No semicolon space buffer. - my @ebuf = split(' ', $buff); - - if (!defined $ebuf[0]) { - # Garbage. Ignoring. - next; - } - - if (defined $ebuf[1]) { - if ($ebuf[1] eq '{') { - # This is the beginning of a block with no parameter. + } + else { + # It doesn't, create it as an array. + @{ $rs{$blk}{$ebuf[0]} } = @param; + } + } + } + else { + # We're not inside a block. + + # Check to see if this config option already exists. + if (defined $rs{$ebuf[0]}) { + # It does, so merely push this second one to the existing array. + push(@{ $rs{$ebuf[0]} }, $param); + } + else { + # It doesn't, create it as an array. + @{ $rs{$ebuf[0]} } = @param; + } + } + } + } + } + else { + # No semicolon space buffer. + my @ebuf = split(' ', $buff); + + if (!defined $ebuf[0]) { + # Garbage. Ignoring. + next; + } + + if (defined $ebuf[1]) { + if ($ebuf[1] eq '{') { + # This is the beginning of a block with no parameter. $blk = $ebuf[0]; - } - elsif (defined $ebuf[2]) { - if ($ebuf[2] eq '{') { - # This is the beginning of a block with a parameter. - my $param = $ebuf[1]; - $param =~ s/"//g; - $blk = $ebuf[0].'@@@'.$param; - } - } - } - if ($ebuf[0] eq '}') { - # This is the end of a block. - $blk = 0; - } - } - } - } + } + elsif (defined $ebuf[2]) { + if ($ebuf[2] eq '{') { + # This is the beginning of a block with a parameter. + my $param = $ebuf[1]; + $param =~ s/"//g; + $blk = $ebuf[0].'@@@'.$param; + } + } + } + if ($ebuf[0] eq '}') { + # This is the end of a block. + $blk = 0; + } + } + } + } # Return the configuration data. - return %rs; + return %rs; } diff --git a/lib/Parser/Lang.pm b/lib/Parser/Lang.pm index 4246021..8ca1b2d 100644 --- a/lib/Parser/Lang.pm +++ b/lib/Parser/Lang.pm @@ -14,10 +14,10 @@ sub parse # Check that the language file exists. if (!-e "$Auto::bin{lng}/$lang.alf") { - # Otherwise, use English. - dbug "Language '$lang' not found. Using English."; - alog "Language '$lang' not found. Using English."; - $lang = 'en'; + # Otherwise, use English. + dbug "Language '$lang' not found. Using English."; + alog "Language '$lang' not found. Using English."; + $lang = 'en'; } # Open, read and close the file. @@ -27,37 +27,37 @@ sub parse # Iterate the file buffer. foreach my $buff (@fbuf) { - if (defined $buff) { - # Space buffer. - my @sbuf = split(' ', $buff); - - # Check for all required values. - if (!defined $sbuf[0] or !defined $sbuf[1] or !defined $sbuf[2]) { - # Missing a value. - next; - } - - # Make sure the first value is "msge". - if ($sbuf[0] ne "msge") { - # It isn't. - next; - } - - my $id = $sbuf[1]; - my $val = $sbuf[2]; - - # If the translation is multi-word, continue to parse. - if (defined $sbuf[3]) { - for (my $i = 3; $i < scalar(@sbuf); $i++) { - $val .= " ".$sbuf[$i]; - } - } - - # Save to memory. - $id =~ s/"//g; - $val =~ s/"//g; - $API::Std::LANGE{$id} = $val; - } + if (defined $buff) { + # Space buffer. + my @sbuf = split(' ', $buff); + + # Check for all required values. + if (!defined $sbuf[0] or !defined $sbuf[1] or !defined $sbuf[2]) { + # Missing a value. + next; + } + + # Make sure the first value is "msge". + if ($sbuf[0] ne "msge") { + # It isn't. + next; + } + + my $id = $sbuf[1]; + my $val = $sbuf[2]; + + # If the translation is multi-word, continue to parse. + if (defined $sbuf[3]) { + for (my $i = 3; $i < scalar(@sbuf); $i++) { + $val .= " ".$sbuf[$i]; + } + } + + # Save to memory. + $id =~ s/"//g; + $val =~ s/"//g; + $API::Std::LANGE{$id} = $val; + } } return 1; } diff --git a/lib/State/IRC.pm b/lib/State/IRC.pm index b35fd45..fc62075 100644 --- a/lib/State/IRC.pm +++ b/lib/State/IRC.pm @@ -15,34 +15,34 @@ hook_add('on_namesreply', 'state.irc.names', sub { if (defined $chanusers{$svr}{$chan}) { delete $chanusers{$svr}{$chan} } # Iterate through each user. for (1..$#data) { - my $fi = 0; + my $fi = 0; PFITER: foreach my $spfx (keys %{ $Proto::IRC::csprefix{$svr} }) { - # Check if the user has status in the channel. - if (substr($data[$_], 0, 1) eq $Proto::IRC::csprefix{$svr}{$spfx}) { - # He/she does. Lets set that. - if (defined $chanusers{$svr}{$chan}{lc $data[$_]}) { - # If the user has multiple statuses. - $chanusers{$svr}{$chan}{lc substr $data[$_], 1} = $chanusers{$svr}{$chan}{lc $data[$_]}.$spfx; + # Check if the user has status in the channel. + if (substr($data[$_], 0, 1) eq $Proto::IRC::csprefix{$svr}{$spfx}) { + # He/she does. Lets set that. + if (defined $chanusers{$svr}{$chan}{lc $data[$_]}) { + # If the user has multiple statuses. + $chanusers{$svr}{$chan}{lc substr $data[$_], 1} = $chanusers{$svr}{$chan}{lc $data[$_]}.$spfx; delete $chanusers{$svr}{$chan}{lc $data[$_]}; - } - else { - # Or not. - $chanusers{$svr}{$chan}{lc substr $data[$_], 1} = $spfx; - } - $fi = 1; + } + else { + # Or not. + $chanusers{$svr}{$chan}{lc substr $data[$_], 1} = $spfx; + } + $fi = 1; $data[$_] = substr $data[$_], 1; - } - } + } + } # Check if there's still a prefix. foreach my $spfx (keys %{$Proto::IRC::csprefix{$svr}}) { if (substr($data[$_], 0, 1) eq $Proto::IRC::csprefix{$svr}{$spfx}) { goto 'PFITER' } } - # They had status, so go to the next user. - next if $fi; - # They didn't, set them as a normal user. - if (!defined $chanusers{$svr}{$chan}{lc $data[$_]}) { - $chanusers{$svr}{$chan}{lc $data[$_]} = 1; - } + # They had status, so go to the next user. + next if $fi; + # They didn't, set them as a normal user. + if (!defined $chanusers{$svr}{$chan}{lc $data[$_]}) { + $chanusers{$svr}{$chan}{lc $data[$_]} = 1; + } } return 1;