summaryrefslogtreecommitdiff
path: root/lib/IRC/Client/Plugin/NickServ.pm6
diff options
context:
space:
mode:
Diffstat (limited to 'lib/IRC/Client/Plugin/NickServ.pm6')
-rw-r--r--lib/IRC/Client/Plugin/NickServ.pm617
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/IRC/Client/Plugin/NickServ.pm6 b/lib/IRC/Client/Plugin/NickServ.pm6
index d7f2f1e..70f3875 100644
--- a/lib/IRC/Client/Plugin/NickServ.pm6
+++ b/lib/IRC/Client/Plugin/NickServ.pm6
@@ -16,12 +16,23 @@ class IRC::Client::Plugin::NickServ does IRC::Client::Plugin
method irc-n376($e)
{
# Extract the config parameters
- my Str $nick = $!config<nickserv><nickname>
- // $!config<bot><nickname>;
+ my Str $user = $!config<nickserv><nickname> // $!config<bot><nickname>;
my Str $pass = $!config<nickserv><password>;
+ # Nothing to do if we don't have a username and a password
+ return unless $user && $pass;
+
# Send the identify command
- $e.irc.send-cmd: "NS identify $nick $pass";
+ $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;
+
+ # Ghost our nick
+ $e.irc.send-cmd: "NS GHOST {$e.irc.nick.first}";
+
+ # Use our nick
+ $e.irc.send-cmd: "NICK {$e.irc.nick.first}";
}
}