summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarDoug Freed <dwfreed@mtu.edu>2015-12-04 11:10:56 +0400
committerLibravatarDoug Freed <dwfreed@mtu.edu>2015-12-04 11:10:56 +0400
commit9f74a4bf7bbe1695354a954e13912d74a4173b02 (patch)
tree8d752896007dfa3e3e995b4b5d7aafe18af5482f
parent8573114bda2d6de4cf9360900b4d1e80f05db4b1 (diff)
Better services handling
-rw-r--r--lib/ASM/Event.pm17
-rw-r--r--lib/ASM/Services.pm11
-rwxr-xr-xmeta.pl2
3 files changed, 25 insertions, 5 deletions
diff --git a/lib/ASM/Event.pm b/lib/ASM/Event.pm
index f75ee42..f9ae609 100644
--- a/lib/ASM/Event.pm
+++ b/lib/ASM/Event.pm
@@ -75,6 +75,7 @@ sub new
$conn->add_handler('channelurlis', \&on_channelurlis);
$conn->add_handler('480', \&on_jointhrottled);
$conn->add_handler('invite', \&blah); # This doesn't need to be fancy; I just need it to go through inspect
+ $conn->add_handler('servicesdown', \&on_servicesdown);
bless($self);
return $self;
}
@@ -230,7 +231,9 @@ sub on_connect {
$conn->sl("MODE $event->{args}->[0] +Q");
if (lc $event->{args}->[0] ne lc $::settings->{nick}) {
ASM::Util->dprint('Attempting to regain my main nick', 'startup');
- $conn->privmsg( 'NickServ@services.', "regain $::settings->{nick} $::settings->{pass}" );
+ $conn->sl("NickServ regain $::settings->{nick} $::settings->{pass}");
+ } else {
+ $conn->sl("NickServ identify $::settings->{nick} $::settings->{pass}");
}
$conn->sl('CAP REQ :extended-join multi-prefix account-notify'); #god help you if you try to use this bot off freenode
}
@@ -861,7 +864,7 @@ sub on_whoxover
foreach my $c (@{$::settings->{autojoins}}) { $x{$c} = 1; }
foreach my $cx (keys %::sc) { delete $x{$cx}; }
if (scalar (keys %x)) {
- $conn->privmsg($::settings->{masterchan}, "Syncing appears to have failed for " . ASM::Util->commaAndify(keys %x));
+ $conn->privmsg($::settings->{masterchan}, "Syncing appears to have failed for " . ASM::Util->commaAndify(keys %x)) unless $::no_autojoins;
}
}
}
@@ -890,4 +893,14 @@ sub on_byechan {
#TODO do del event stuff
}
+sub on_servicesdown
+{
+ my ($conn, $event) = @_;
+ if ($event->{args}->[1] eq 'NickServ') {
+ $::no_autojoins = 1;
+ $conn->join($::settings->{masterchan}); # always join masterchan, so we can find you
+ $conn->sl("PING :" . time);
+ }
+}
+
return 1;
diff --git a/lib/ASM/Services.pm b/lib/ASM/Services.pm
index 528901d..2d4beb6 100644
--- a/lib/ASM/Services.pm
+++ b/lib/ASM/Services.pm
@@ -18,9 +18,10 @@ sub doServices {
if ($event->{from} eq 'NickServ!NickServ@services.')
{
ASM::Util->dprint("NickServ: $event->{args}->[0]", 'snotice');
- if ( $event->{args}->[0] =~ /^This nickname is registered/ )
+ if ( $::no_autojoins && $event->{args}->[0] =~ /^Please identify/ )
{
- $conn->privmsg( 'NickServ@services.', "identify $::settings->{nick} $::settings->{pass}" );
+ $::no_autojoins = 0;
+ $conn->sl("NickServ identify $::settings->{nick} $::settings->{pass}" );
}
elsif ( $event->{args}->[0] =~ /^You are now identified/ )
{
@@ -52,6 +53,12 @@ sub doServices {
{
die("NickServ password invalid.")
}
+ elsif ($event->{args}->[0] =~ /frozen/ )
+ {
+ $::no_autojoins = 1;
+ $conn->join($::settings->{masterchan}); # always join masterchan, so we can find you
+ $conn->sl("PING :" . time);
+ }
}
elsif ($event->{from} eq 'ChanServ!ChanServ@services.')
{
diff --git a/meta.pl b/meta.pl
index 7ea526b..6a9f934 100755
--- a/meta.pl
+++ b/meta.pl
@@ -34,6 +34,7 @@ $::pass = '';
@::string_blacklist=();
$::netsplit = 0;
$::netsplit_ignore_lag = 0;
+$::no_autojoins = 0;
$::debug = 0;
$::cset = '';
$::pacealerts = 1;
@@ -110,7 +111,6 @@ sub init {
Nick => $::settings->{nick},
Ircname => $::settings->{realname},
Username => $::settings->{username},
- Password => $::settings->{pass},
Pacing => 0 );
$conn->debug($::debug);
$::inspector = ASM::Inspect->new();