aboutsummaryrefslogtreecommitdiff
path: root/lib/IRC/Client.pm6
diff options
context:
space:
mode:
authorZoffix Znet <cpan@zoffix.com>2016-06-04 10:32:49 -0400
committerZoffix Znet <cpan@zoffix.com>2016-06-04 10:32:49 -0400
commitcb0a6cace8871d17c9701edc1ccba26d1e6e0bfe (patch)
tree9a28a7b42927556ab6c19ed2260f5211c2ca71c4 /lib/IRC/Client.pm6
parent0daa494480f7abe37a6e593c6238811009b7b914 (diff)
Wtf
Diffstat (limited to 'lib/IRC/Client.pm6')
-rw-r--r--lib/IRC/Client.pm630
1 files changed, 17 insertions, 13 deletions
diff --git a/lib/IRC/Client.pm6 b/lib/IRC/Client.pm6
index 7c30c4a..7d8369a 100644
--- a/lib/IRC/Client.pm6
+++ b/lib/IRC/Client.pm6
@@ -13,6 +13,7 @@ has Str:D $.userhost = 'localhost';
has Str:D $.userreal = 'Perl6 IRC Client';
has Str:D @.channels = ['#perl6'];
has @.plugins;
+has @.servers;
has IO::Socket::Async $!sock;
method run {
@@ -28,24 +29,17 @@ method run {
my $str = try $buf.decode: 'utf8';
$str or $str = $buf.decode: 'latin-1';
$str ~= $left-overs;
- $!debug and "[server {DateTime.now}] {$str}".put;
- (my $events, $left-overs) = IRC::Client::Grammar.parse(
- $str, actions => IRC::Client::Grammar::Actions
- ).made;
-
- for @$events -> $e {
- say "[event] $e";
- CATCH { warn .backtrace }
- }
+
+ (my $events, $left-overs) = self!parse: $str;
+ # for @$events -> $e {
+ # say "[event] $e";
+ # CATCH { warn .backtrace }
+ # }
}
CATCH { warn .backtrace }
}
-
- say "Closing connection";
$!sock.close;
-
- # CATCH { warn .backtrace }
});
}
@@ -54,3 +48,13 @@ method !ssay (Str:D $msg) {
$!sock.print("$msg\n");
self;
}
+
+method !parse (Str:D $str) {
+ return IRC::Client::Grammar.parse(
+ $str,
+ actions => IRC::Client::Grammar::Actions.new(
+ irc => self,
+ server => 'dummy',
+ ),
+ ).made;
+}