commit 453d38abd6e17f6e7f79e4360663e42657016760 from: Izzy Blacklock date: Thu Aug 03 02:07:43 2023 UTC Converted botnow to use $irc object commit - fd105d18cd34566946742b9e99f4775fc832a9c0 commit + 453d38abd6e17f6e7f79e4360663e42657016760 blob - 06a915548218a8e430c69b7fbab1af6849b48d68 blob + 61a13377ad00336f1eff5d8fdca009229495d54d --- botnow +++ botnow @@ -106,18 +106,6 @@ foreach my $mod (@modules) { $init->(); } -# Globals used from IRCNOW::IO::IRC; -# XXX These need to become an object in IRCNOW::IO::IRC instead of globals -#if (defined($conf{networks})) { -# @IRCNOW::IO::IRC::networks = split(/\s+/, $conf{networks}); -#} - -#my $bots = \@IRCNOW::IO::IRC::bots; -my $call = $IRCNOW::IO::IRC::call; -my $localnet = $conf{localnet}; -$IRCNOW::IO::IRC::localnet = $localnet; -my $staff = $conf{staff}; -@IRCNOW::IO::IRC::stafflist = split(/ /,$staff); $IRCNOW::IO::verbosity = $conf{verbose}; my $verbosity = $conf{verbose}; $IRCNOW::IO::backupspath = $conf{backupspath} || "/home/botnow/backups/"; @@ -166,23 +154,23 @@ while(my @ready = $sel->can_read) { next; } if ($response =~ /^PING :(.*)\r\n$/i) { - IRCNOW::IO::IRC::putserv($bot, "PONG :$1"); + $irc->putserv($bot, "PONG :$1"); } elsif ($response =~ /^:irc.znc.in (.*) (.*) :(.*)\r\n$/) { my ($type, $target, $text) = ($1, $2, $3); if ($type eq "464" && $target =~ /^$nick.?$/ && $text eq "Password required") { - IRCNOW::IO::IRC::putserv($bot, "PASS $nick/$bot->{name}:$pass"); + $irc->putserv($bot, "PASS $nick/$bot->{name}:$pass"); if ($bot->{name} =~ /^$localnet$/i) { - IRCNOW::IO::IRC::putserv($bot, "OPER $nick $pass"); - IRCNOW::IO::IRC::putserv($bot, "PRIVMSG *status :LoadMod --type=user controlpanel"); - IRCNOW::IO::IRC::putserv($bot, "PRIVMSG *controlpanel :get Admin $nick"); - IRCNOW::IO::IRC::putserv($bot, "PRIVMSG *controlpanel :get Nick cloneuser"); + $irc->putserv($bot, "OPER $nick $pass"); + $irc->putserv($bot, "PRIVMSG *status :LoadMod --type=user controlpanel"); + $irc->putserv($bot, "PRIVMSG *controlpanel :get Admin $nick"); + $irc->putserv($bot, "PRIVMSG *controlpanel :get Nick cloneuser"); foreach my $chan (@teamchans) { - IRCNOW::IO::IRC::putserv($bot, "JOIN $chan"); + $irc->putserv($bot, "JOIN $chan"); } } if ($bot->{name} !~ /^$localnet$/i) { foreach my $chan (@chans) { - IRCNOW::IO::IRC::putserv($bot, "JOIN $chan"); + $irc->putserv($bot, "JOIN $chan"); } } } elsif ($type eq "464" && $target =~ /^$nick.?$/ && $text eq "Invalid Password") { @@ -424,11 +412,11 @@ while(my @ready = $sel->can_read) { #Unexpected bncnow.pl 454: irc.guava.ircnow.org 396 guava.guava.ircnow.org :is your displayed hostname now } elsif ($code =~ /^464$/) { # Invalid password for oper foreach my $chan (@teamchans) { - IRCNOW::IO::IRC::putserv($bot, "PRIVMSG $chan :$nick oper password failed; the bot will be unable to view uncloaked IP addresses"); + $irc->putserv($bot, "PRIVMSG $chan :$nick oper password failed; the bot will be unable to view uncloaked IP addresses"); } } elsif ($code =~ /^477$/) { # Can't join channel foreach my $chan (@teamchans) { - IRCNOW::IO::IRC::putserv($bot, "PRIVMSG $chan :ERROR: $nick on $server: $text"); + $irc->putserv($bot, "PRIVMSG $chan :ERROR: $nick on $server: $text"); } } elsif ($code == 716 && $text =~ /^([-_\|`a-zA-Z0-9]+) :is in \+g mode \(server-side ignore.\)/) { debug(ALL, "$text");