aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoffix Znet <cpan@zoffix.com>2016-06-09 21:53:21 -0400
committerZoffix Znet <cpan@zoffix.com>2016-06-09 21:53:21 -0400
commit7a17edf5807b585698a219aaf551f1393139c001 (patch)
tree9461ca747fadfcd33d379bc9c0409c9d3dcc4dcc
parent140959e4f170d732d990e69b9a0ca129b89e3ac4 (diff)
Fix multi-channel join for non-spec-conforming servers
-rw-r--r--lib/IRC/Client.pm62
-rw-r--r--t/release/01-basic.t24
2 files changed, 10 insertions, 16 deletions
diff --git a/lib/IRC/Client.pm6 b/lib/IRC/Client.pm6
index cacd7c1..6803203 100644
--- a/lib/IRC/Client.pm6
+++ b/lib/IRC/Client.pm6
@@ -80,7 +80,7 @@ method !handle-event ($e) {
given $e.command {
when '001' {
%!servers{ $e.server }<nick> = $e.args[0];
- self!ssay: "JOIN @.channels[]", :server($e.server);
+ self!ssay: "JOIN $_", :server($e.server) for @.channels;
}
when 'PING' { $e.reply }
when 'JOIN' {
diff --git a/t/release/01-basic.t b/t/release/01-basic.t
index e6a2cd7..114f4c4 100644
--- a/t/release/01-basic.t
+++ b/t/release/01-basic.t
@@ -1,12 +1,15 @@
use lib <lib t/release>;
use Test;
+use Test::Notice;
use IRC::Client;
use Test::IRC::Server;
my $Wait = (%*ENV<IRC_CLIENT_TEST_WAIT>//1) * 5;
+notice 'Testing connection to one server and joining two channels';
+
+diag 'Starting IRC Server';
my $s = Test::IRC::Server.new;
-# $s.start;
END { $s.kill };
loop {
@@ -14,6 +17,7 @@ loop {
sleep 0.5;
}
+diag 'Starting IRC Client';
start {
my $irc = IRC::Client.new(
:debug(%*ENV<IRC_CLIENT_DEBUG>//0)
@@ -25,6 +29,7 @@ start {
).run;
}
+diag 'Waiting for things to happen...';
Promise.in($Wait).then: {$s.kill}
await $s.promise;
@@ -40,6 +45,9 @@ my $out = [
:event("ircd_daemon_nick")},
{
:args($[["IRCBot!~Perl6IRC\@simple.poco.server.irc", "#perl6"],]), :event("ircd_daemon_join")
+ },
+ {
+ :args($[["IRCBot!~Perl6IRC\@simple.poco.server.irc", "#perl7"],]), :event("ircd_daemon_join")
}
];
@@ -52,17 +60,3 @@ for $s.out {
is-deeply $s.out, $out, 'Server output looks right';
done-testing;
-
-# sleep 10;
-
-# dd $s.out;
-#
-# [
-# {:args($[[Any],]), :event("ircd_registered") },
-# {:args($[[5000, 1, "0.0.0.0"],]), :event("ircd_listener_add")}
-# ]
-
-
-# ok 1;
-# done-testing;
-#