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