diff options
| author | 2015-12-04 11:10:56 +0400 | |
|---|---|---|
| committer | 2015-12-04 11:10:56 +0400 | |
| commit | 9f74a4bf7bbe1695354a954e13912d74a4173b02 (patch) | |
| tree | 8d752896007dfa3e3e995b4b5d7aafe18af5482f /lib/ASM/Event.pm | |
| parent | 8573114bda2d6de4cf9360900b4d1e80f05db4b1 (diff) | |
Better services handling
Diffstat (limited to 'lib/ASM/Event.pm')
| -rw-r--r-- | lib/ASM/Event.pm | 17 |
1 files changed, 15 insertions, 2 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; |
