summaryrefslogtreecommitdiffstats
path: root/modules/services.pl
diff options
context:
space:
mode:
authorLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2012-08-19 03:23:35 +0000
committerLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2012-08-19 03:23:35 +0000
commit96a28d32af3d3aaa8292cbb7a498d2fbdca32546 (patch)
tree4ed4dfe077460f892c0a111a1862852724dc1de1 /modules/services.pl
parentfae3a46e8813b4804a6c23f6ee397fd8c8ede0bc (diff)
Utilize debug printer, remove dead code, eliminate a warning in mode tracking, handle joining channels better (less warnings), ignore chanserv entrymsgs
Diffstat (limited to 'modules/services.pl')
-rw-r--r--modules/services.pl33
1 files changed, 21 insertions, 12 deletions
diff --git a/modules/services.pl b/modules/services.pl
index d2b3d31..2950253 100644
--- a/modules/services.pl
+++ b/modules/services.pl
@@ -2,6 +2,9 @@ package ASM::Services;
use warnings;
use strict;
+use Data::Dumper;
+$Data::Dumper::Useqq=1;
+
sub new
{
my $self = {};
@@ -14,7 +17,7 @@ sub doServices {
my $i = 1;
if ($event->{from} eq 'NickServ!NickServ@services.')
{
- print "NickServ: $event->{args}->[0]\n";
+ ASM::Util->dprint("NickServ: $event->{args}->[0]", 'services');
if ( $event->{args}->[0] =~ /^This nickname is registered/ )
{
$conn->privmsg( 'NickServ', "identify $::settings->{nick} $::settings->{pass}" );
@@ -22,24 +25,27 @@ sub doServices {
elsif ( $event->{args}->[0] =~ /^You are now identified/ )
{
my @autojoins = @{$::settings->{autojoins}};
-# while (@autojoins) {
-# my $joinstr = join (',', shift @autojoins, shift @autojoins, shift @autojoins, shift @autojoins, shift @autojoins,
-# shift @autojoins, shift @autojoins, shift @autojoins, shift @autojoins, shift @autojoins);
-# $conn->schedule($i, sub { $conn->join($joinstr); });
-# $i += 1;
-# }
- $conn->join(join(',', @autojoins[0..30]));
- $conn->join(join(',', @autojoins[30..60]));
+ if (defined($autojoins[30])) {
+ $conn->join(join(',', @autojoins[0..30]));
+ if (defined($autojoins[60])) {
+ $conn->join(join(',', @autojoins[30..60]));
+ $conn->join(join(',', @autojoins[60..$#autojoins]));
+ } else {
+ $conn->join(join(',', @autojoins[30..$#autojoins]));
+ }
+ } else {
+ $conn->join(join(',', @autojoins));
+ }
$conn->schedule(2, sub { $conn->privmsg('#antispammeta', 'Now joined to all channels in '. (time - $::starttime) . " seconds."); });
}
elsif ($event->{args}->[0] =~ /has been (killed|released)/ )
{
- print "Got kill/release successful from nickserv!\n" if $::debugx{services};
+ ASM::Util->dprint('Got kill/release successful from NickServ!', 'services');
$conn->nick( $::settings->{nick} );
}
elsif ($event->{args}->[0] =~ /has been regained/ )
{
- print "Got regain successful from nickserv!\n" if $::debugx{services};
+ ASM::Util->dprint('Got regain successful from nickserv!', 'services');
}
elsif ($event->{args}->[0] =~ /Password Incorrect/ )
{
@@ -48,7 +54,10 @@ sub doServices {
}
elsif ($event->{from} eq 'ChanServ!ChanServ@services.')
{
- print "ChanServ: $event->{args}->[0] \n";
+ if ( $event->{args}->[0] =~ /^\[#/ ) {
+ return;
+ }
+ ASM::Util->dprint('ChanServ: '. Dumper($event->{args}->[0]), 'services');
if ( $event->{args}->[0] =~ /^All.*bans matching.*have been cleared on(.*)/)
{
$conn->join($1);