commit - 4f551346d1e758460d53f60a414d19bc62426a87
commit + c47c8f57b66d9dd4baa433930e8c9d421e5f3e70
blob - 58b684b442bd760bcbf7a9d69c2517f4662f81ac
blob + 226ba4973e78526a07480176f13bc7f24aff96cd
--- botnow
+++ botnow
my $verbosity = $conf{verbose};
$IRCNOW::IO::backupspath = $conf{backupspath} || "/home/botnow/backups/";
my $backupspath = $IRCNOW::IO::backupspath;
+my $irc = new IRCNOW::IO::IRC(
+ networks => \@networks,
+ localnet => $conf{localnet},
+ stafflist => [split(/ /, $staff)],
+ nick => $conf{nick},
+ host => $conf{host},
+ port => $conf{port},
+ pass => $conf{pass},
+);
-
-
my @chans = split /[,\s]+/m, $conf{chans};
my @teamchans;
if (defined($conf{teamchans})) { @teamchans = split /[,\s]+/m, $conf{teamchans}; }
my $nick = $conf{nick};
-my $host = $conf{host};
-my $port = $conf{port};
my $pass = $conf{pass};
my $expires = $conf{expires};
#rpath for reading file, wpath for writing file, cpath for creating path
#flock, fattr for sqlite
pledge( qw(stdio rpath wpath cpath inet dns proc exec flock fattr) ) or die "Unable to pledge: $!";
-
-# create sockets
-my $sel = IO::Select->new( );
-foreach my $network (@networks) {
- my $socket = IO::Socket::INET->new(PeerAddr=>$host, PeerPort=>$port, Proto=>'tcp', Timeout=>'300') || print "Failed to establish connection\n";
- $sel->add($socket);
- my $bot = {("sock" => $socket), ("name" => $network)};
- push(@$bots, $bot);
- IRCNOW::IO::IRC::putserv($bot, "NICK $nick");
- IRCNOW::IO::IRC::putserv($bot, "USER $nick * * :$nick");
-}
-
+my $sel = $irc->{sockets};
while(my @ready = $sel->can_read) {
my ($bot, $response);
my ($sender, $val);
blob - 3f18f6182f9b72994b517b93e6f824e2e84c1f42
blob + 4b27a5c2642363c642c12abe7cd48ba9ca1c6bea
--- install
+++ install
usermod -G _dovecot botnow
chmod g+rw ${HOSTNAMEIF}
cp captcha.png register.php ${HTDOCS}/
-cp LICENSE README botnow botnow.conf.example BNC.pm DNS.pm Mail.pm SQLite.pm Shell.pm table.sql Hash.pm Help.pm install networks captcha.png register.php words report ${HOMEDIR}/
+cp -r LICENSE README botnow botnow.conf.example table.sql install networks captcha.png register.php words report lib ${HOMEDIR}/
+# clone p5-IRCNOW library.
+mkdir ${HOMEDIR}/lib/p5-IRCNOW
+git clone git://got.ircnow.org/izzyb-IRCNOW-libs.git ${HOMEDIR}/lib/p5-IRCNOW/
+ln -s ${HOMEDIR}/lib/p5-IRCNOW/lib/IRCNOW ${HOMEDIR}/lib/
+
mkdir ${HOMEDIR}/backups/
chown -R ${USERNAME}:${USERNAME} ${HOMEDIR}
chmod -R go-rx ${HOMEDIR}