Removing tabs.
This commit is contained in:
1 parent
637db6bae4
commit
153084f808
1 file changed
+88
-88
@@ -235,8 +235,8 @@ undef $USECONFIG;
|
|||||||
if (conf_get('die')) {
|
if (conf_get('die')) {
|
||||||
if ((conf_get('die'))[0][0] == 1) {
|
if ((conf_get('die'))[0][0] == 1) {
|
||||||
say '!!! You didn\'t read the whole config.';
|
say '!!! You didn\'t read the whole config.';
|
||||||
say '!!! Insert new user then try again.';
|
say '!!! Insert new user then try again.';
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,11 +244,11 @@ if (conf_get('die')) {
|
|||||||
my @REQCVALS = qw(locale expire_logs server fantasy_pf ratelimit database:format bantype);
|
my @REQCVALS = qw(locale expire_logs server fantasy_pf ratelimit database:format bantype);
|
||||||
foreach my $REQCVAL (@REQCVALS) {
|
foreach my $REQCVAL (@REQCVALS) {
|
||||||
if (!conf_get($REQCVAL)) {
|
if (!conf_get($REQCVAL)) {
|
||||||
my $err = 2;
|
my $err = 2;
|
||||||
if ($REQCVAL eq 'expire_logs') {
|
if ($REQCVAL eq 'expire_logs') {
|
||||||
$err = 1;
|
$err = 1;
|
||||||
}
|
}
|
||||||
err($err, "Missing required configuration value: $REQCVAL", 1);
|
err($err, "Missing required configuration value: $REQCVAL", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
undef @REQCVALS;
|
undef @REQCVALS;
|
||||||
@@ -356,44 +356,44 @@ if (conf_get('privset')) {
|
|||||||
my %tcprivs = conf_get('privset');
|
my %tcprivs = conf_get('privset');
|
||||||
|
|
||||||
foreach my $tckpriv (keys %tcprivs) {
|
foreach my $tckpriv (keys %tcprivs) {
|
||||||
# For each privset, get the inner values.
|
# For each privset, get the inner values.
|
||||||
my %mcprivs = conf_get("privset:$tckpriv");
|
my %mcprivs = conf_get("privset:$tckpriv");
|
||||||
|
|
||||||
# Iterate through them.
|
# Iterate through them.
|
||||||
foreach my $mckpriv (keys %mcprivs) {
|
foreach my $mckpriv (keys %mcprivs) {
|
||||||
# Switch statement for the values.
|
# Switch statement for the values.
|
||||||
given ($mckpriv) {
|
given ($mckpriv) {
|
||||||
# If it's 'priv', save it as a privilege.
|
# If it's 'priv', save it as a privilege.
|
||||||
when ('priv') {
|
when ('priv') {
|
||||||
if (defined $PRIVILEGES{$tckpriv}) {
|
if (defined $PRIVILEGES{$tckpriv}) {
|
||||||
# If this privset exists, push to it.
|
# If this privset exists, push to it.
|
||||||
push @{ $PRIVILEGES{$tckpriv} }, ($mcprivs{$mckpriv})[0][0];
|
push @{ $PRIVILEGES{$tckpriv} }, ($mcprivs{$mckpriv})[0][0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# Otherwise, create it.
|
# Otherwise, create it.
|
||||||
@{ $PRIVILEGES{$tckpriv} } = (($mcprivs{$mckpriv})[0][0]);
|
@{ $PRIVILEGES{$tckpriv} } = (($mcprivs{$mckpriv})[0][0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# If it's 'inherit', inherit the privileges of another privset.
|
# If it's 'inherit', inherit the privileges of another privset.
|
||||||
when ('inherit') {
|
when ('inherit') {
|
||||||
# If the privset we're inheriting exists, continue.
|
# If the privset we're inheriting exists, continue.
|
||||||
if (defined $PRIVILEGES{($mcprivs{$mckpriv})[0][0]}) {
|
if (defined $PRIVILEGES{($mcprivs{$mckpriv})[0][0]}) {
|
||||||
# Iterate through each privilege.
|
# Iterate through each privilege.
|
||||||
foreach (@{ $PRIVILEGES{($mcprivs{$mckpriv})[0][0]} }) {
|
foreach (@{ $PRIVILEGES{($mcprivs{$mckpriv})[0][0]} }) {
|
||||||
# And save them to the privset inheriting them
|
# And save them to the privset inheriting them
|
||||||
if (defined $PRIVILEGES{$tckpriv}) {
|
if (defined $PRIVILEGES{$tckpriv}) {
|
||||||
# If this privset exists, push to it.
|
# If this privset exists, push to it.
|
||||||
push @{ $PRIVILEGES{$tckpriv} }, $_;
|
push @{ $PRIVILEGES{$tckpriv} }, $_;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# Otherwise, create it.
|
# Otherwise, create it.
|
||||||
@{ $PRIVILEGES{$tckpriv} } = ($_);
|
@{ $PRIVILEGES{$tckpriv} } = ($_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -423,9 +423,9 @@ if (!$DEBUG) {
|
|||||||
my $pidfile;
|
my $pidfile;
|
||||||
if ($UPREFIX) { $pidfile = "$bin{cwd}/auto.pid" }
|
if ($UPREFIX) { $pidfile = "$bin{cwd}/auto.pid" }
|
||||||
else { $pidfile = "$Bin/auto.pid" }
|
else { $pidfile = "$Bin/auto.pid" }
|
||||||
open my $FPID, '>', $pidfile or exit;
|
open my $FPID, '>', $pidfile or exit;
|
||||||
print {$FPID} "$APID\n" or exit;
|
print {$FPID} "$APID\n" or exit;
|
||||||
close $FPID or exit;
|
close $FPID or exit;
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
POSIX::setsid() or err(2, "Can't start a new session: $ERRNO", 1);
|
POSIX::setsid() or err(2, "Can't start a new session: $ERRNO", 1);
|
||||||
@@ -448,7 +448,7 @@ if (conf_get('module')) {
|
|||||||
alog '* Loading modules...';
|
alog '* Loading modules...';
|
||||||
dbug '* Loading modules...';
|
dbug '* Loading modules...';
|
||||||
foreach (@{ (conf_get('module'))[0] }) {
|
foreach (@{ (conf_get('module'))[0] }) {
|
||||||
mod_load($_);
|
mod_load($_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -498,38 +498,38 @@ if (conf_get('aliases:alias')) {
|
|||||||
while (1) {
|
while (1) {
|
||||||
# Timer check.
|
# Timer check.
|
||||||
foreach my $tk (keys %TIMERS) {
|
foreach my $tk (keys %TIMERS) {
|
||||||
if ($TIMERS{$tk}{time} <= time) {
|
if ($TIMERS{$tk}{time} <= time) {
|
||||||
&{ $TIMERS{$tk}{sub} }();
|
&{ $TIMERS{$tk}{sub} }();
|
||||||
if ($TIMERS{$tk}{type} == 1) {
|
if ($TIMERS{$tk}{type} == 1) {
|
||||||
# If it's type 1, delete from memory.
|
# If it's type 1, delete from memory.
|
||||||
delete $TIMERS{$tk};
|
delete $TIMERS{$tk};
|
||||||
}
|
}
|
||||||
elsif ($TIMERS{$tk}{type} == 2) {
|
elsif ($TIMERS{$tk}{type} == 2) {
|
||||||
# If it's type 2, reset timer.
|
# If it's type 2, reset timer.
|
||||||
$TIMERS{$tk}{time} = time + $TIMERS{$tk}{secs};
|
$TIMERS{$tk}{time} = time + $TIMERS{$tk}{secs};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# This should never happen.
|
# This should never happen.
|
||||||
delete $TIMERS{$tk};
|
delete $TIMERS{$tk};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Socket check.
|
# Socket check.
|
||||||
foreach my $sock ($SELECT->can_read(1)) {
|
foreach my $sock ($SELECT->can_read(1)) {
|
||||||
# Figure out what network is sending us data.
|
# Figure out what network is sending us data.
|
||||||
my $sockid;
|
my $sockid;
|
||||||
foreach (keys %SOCKET) {
|
foreach (keys %SOCKET) {
|
||||||
if ($SOCKET{$_} eq $sock) { $sockid = $_ }
|
if ($SOCKET{$_} eq $sock) { $sockid = $_ }
|
||||||
}
|
}
|
||||||
# Read the data.
|
# Read the data.
|
||||||
my $idata;
|
my $idata;
|
||||||
sysread $sock, $idata, POSIX::BUFSIZ, 0;
|
sysread $sock, $idata, POSIX::BUFSIZ, 0;
|
||||||
|
|
||||||
# Check for the data.
|
# Check for the data.
|
||||||
if (!defined $idata || length($idata) == 0) {
|
if (!defined $idata || length($idata) == 0) {
|
||||||
# Got EOF, close socket
|
# Got EOF, close socket
|
||||||
err(2, "Lost connection to $sockid!", 0);
|
err(2, "Lost connection to $sockid!", 0);
|
||||||
$SELECT->remove($sock);
|
$SELECT->remove($sock);
|
||||||
delete $SOCKET{$sockid};
|
delete $SOCKET{$sockid};
|
||||||
API::Std::event_run('on_disconnect', $sockid);
|
API::Std::event_run('on_disconnect', $sockid);
|
||||||
if (!keys %SOCKET) {
|
if (!keys %SOCKET) {
|
||||||
@@ -541,21 +541,21 @@ while (1) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Read the buffer.
|
# Read the buffer.
|
||||||
my $data .= $idata;
|
my $data .= $idata;
|
||||||
while ($data =~ s/(.*\n)//) {
|
while ($data =~ s/(.*\n)//) {
|
||||||
my $line = $1;
|
my $line = $1;
|
||||||
|
|
||||||
# Remove the newlines.
|
# Remove the newlines.
|
||||||
chomp $line;
|
chomp $line;
|
||||||
# Debug.
|
# Debug.
|
||||||
dbug $sockid.' >> '.$line;
|
dbug $sockid.' >> '.$line;
|
||||||
|
|
||||||
# Parse data.
|
# Parse data.
|
||||||
Proto::IRC::ircparse($sockid, $line);
|
Proto::IRC::ircparse($sockid, $line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,12 +568,12 @@ sub socksnd {
|
|||||||
my ($svr, $data) = @_;
|
my ($svr, $data) = @_;
|
||||||
|
|
||||||
if (defined $SOCKET{$svr}) {
|
if (defined $SOCKET{$svr}) {
|
||||||
syswrite $SOCKET{$svr}, $data."\r\n", POSIX::BUFSIZ, 0;
|
syswrite $SOCKET{$svr}, $data."\r\n", POSIX::BUFSIZ, 0;
|
||||||
dbug "$svr << $data";
|
dbug "$svr << $data";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user