summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2019-09-24 17:09:58 +0200
committerPatrick Spek <p.spek@tyil.nl>2019-09-24 17:09:58 +0200
commit04abe32611444a6d737c199ec9e7c4717128460c (patch)
treee7ab4e8182fd324d02785e0066ebf22172fa2c41
parentab7e24a97a33713b185b684f57727134c9acfe56 (diff)
downloadIRC::Client::Plugin::NickServ-04abe32611444a6d737c199ec9e7c4717128460c.tar.gz
IRC::Client::Plugin::NickServ-04abe32611444a6d737c199ec9e7c4717128460c.tar.bz2
Make reclaiming a nick actually work
-rw-r--r--lib/IRC/Client/Plugin/NickServ.pm618
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/IRC/Client/Plugin/NickServ.pm6 b/lib/IRC/Client/Plugin/NickServ.pm6
index 70f3875..a6c8972 100644
--- a/lib/IRC/Client/Plugin/NickServ.pm6
+++ b/lib/IRC/Client/Plugin/NickServ.pm6
@@ -20,19 +20,27 @@ class IRC::Client::Plugin::NickServ does IRC::Client::Plugin
my Str $pass = $!config<nickserv><password>;
# Nothing to do if we don't have a username and a password
- return unless $user && $pass;
+ if (!$user || !$pass) {
+ note "Missing username or password for NickServ auth";
+ return;
+ }
# Send the identify command
$e.irc.send-cmd: "NS identify $user $pass";
+ }
- # If we're using our preferred nick, we're done
- return unless $e.irc.current-nick eq $e.irc.nick.first;
+ multi method irc-notice($e where m:i/"you are now identified"/)
+ {
+ return if $e.server.current-nick eq $e.server.nick.first;
# Ghost our nick
- $e.irc.send-cmd: "NS GHOST {$e.irc.nick.first}";
+ $e.irc.send-cmd: "NS GHOST {$e.server.nick.first}";
+ }
+ multi method irc-notice($e where m:i/"has been ghosted"/)
+ {
# Use our nick
- $e.irc.send-cmd: "NICK {$e.irc.nick.first}";
+ $e.irc.nick: $e.server.nick.first;
}
}