aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZoffix Znet <cpan@zoffix.com>2016-05-07 09:52:33 -0400
committerZoffix Znet <cpan@zoffix.com>2016-05-07 09:52:33 -0400
commit72c3d0c15907024fd2cfa4426c7dfa521609d647 (patch)
tree762357992ca4757404973c3e262e1ab839b799f1 /lib
parent14ae143796586ce9eda266d03a9be2d6d3f1b6ee (diff)
Connect only after ERR_NOMOTD or END_MOTD messages
Diffstat (limited to 'lib')
-rw-r--r--lib/IRC/Client.pm611
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/IRC/Client.pm6 b/lib/IRC/Client.pm6
index 2fa04dc..f9c8c88 100644
--- a/lib/IRC/Client.pm6
+++ b/lib/IRC/Client.pm6
@@ -28,6 +28,12 @@ method handle-event ($e) {
return unless $res === IRC_NOT_HANDLED;
}
+ # Wait for END_MOTD or ERR_NOMOTD before attempting to join
+ if $e<command> eq '422' | '376' {
+ $.ssay("JOIN {@!channels[]}\n");
+ .irc-connected: self for @!plugs.grep(*.^can: 'irc-connected');
+ }
+
my $nick = $!nick;
if ( ( $e<command> eq 'PRIVMSG' and $e<params>[0] eq $nick )
or ( $e<command> eq 'NOTICE' and $e<params>[0] eq $nick )
@@ -124,9 +130,6 @@ method run {
$.ssay("PASS $!password\n") if $!password.defined;
$.ssay("NICK $!nick\n");
$.ssay("USER $!username $!username $!host :$!userreal\n");
- $.ssay("JOIN {@!channels[]}\n");
-
- .irc-connected: self for @!plugs.grep(*.^can: 'irc-connected');
# my $left-overs = '';
react {
@@ -168,4 +171,4 @@ sub plug-name {
$plug ~~ s:g/^ $cur '/' | '.pm6'$//;
$plug ~~ s/'/'/::/;
return "[$plug] ";
-} \ No newline at end of file
+}