aboutsummaryrefslogtreecommitdiff
path: root/lib/IRC
diff options
context:
space:
mode:
authorZoffix Znet <zoffixznet@users.noreply.github.com>2016-07-26 08:50:02 -0400
committerGitHub <noreply@github.com>2016-07-26 08:50:02 -0400
commite0478c07e2096d85e20764c08c83a3d16c002e94 (patch)
tree592510005886adaadb49848d289c5c712279ecee /lib/IRC
parente997c1b0b5ad796425abfc9f81b91947357172ce (diff)
parentcc19189ff6b74bea5211d521a59dbff0c71a0749 (diff)
Merge Rewrite 2.0 version into master
Old version should not be used anymore and 2.0 is ready to go, sans some bugs
Diffstat (limited to 'lib/IRC')
-rw-r--r--lib/IRC/Client.pm6360
-rw-r--r--lib/IRC/Client/Grammar.pm6 (renamed from lib/IRC/Grammar.pm6)11
-rw-r--r--lib/IRC/Client/Grammar/Actions.pm6119
-rw-r--r--lib/IRC/Client/Message.pm670
-rw-r--r--lib/IRC/Client/Plugin.pm63
-rw-r--r--lib/IRC/Client/Plugin/Debugger.pm68
-rw-r--r--lib/IRC/Client/Plugin/PingPong.pm62
-rw-r--r--lib/IRC/Grammar/Actions.pm626
-rw-r--r--lib/IRC/Parser.pm67
9 files changed, 416 insertions, 190 deletions
diff --git a/lib/IRC/Client.pm6 b/lib/IRC/Client.pm6
index 700739c..9e3bfbd 100644
--- a/lib/IRC/Client.pm6
+++ b/lib/IRC/Client.pm6
@@ -1,174 +1,256 @@
-use v6;
-use IRC::Parser; # parse-irc
-use IRC::Client::Plugin::PingPong;
-use IRC::Client::Plugin;
unit class IRC::Client;
-has Bool:D $.debug = False;
-has Str:D $.host = 'localhost';
+use IRC::Client::Grammar;
+use IRC::Client::Grammar::Actions;
+
+my class IRC_FLAG_NEXT {};
+
+role IRC::Client::Plugin is export {
+ my IRC_FLAG_NEXT $.NEXT;
+ has $.irc is rw;
+}
+
+has Str:D $.host = 'localhost';
+has Int:D $.debug = 0;
has Str $.password;
-has Int:D $.port where 0 <= $_ <= 65535 = 6667;
-has Str:D $.nick = 'Perl6IRC';
-has Str:D $.username = 'Perl6IRC';
-has Str:D $.userhost = 'localhost';
-has Str:D $.userreal = 'Perl6 IRC Client';
-has Str:D @.channels = ['#perl6bot'];
-has IO::Socket::Async $.sock;
-has @.plugins = [];
-has @.plugins-essential = [
- IRC::Client::Plugin::PingPong.new
-];
-has @!plugs = [|@!plugins-essential, |@!plugins];
-
-method handle-event ($e) {
- $e<pipe> = {};
-
- for @!plugs.grep(*.^can: 'irc-all-events') -> $p {
- my $res = $p.irc-all-events(self, $e);
- return unless $res === IRC_NOT_HANDLED;
- }
+has Int:D $.port where 0 <= $_ <= 65535 = 6667;
+has Str:D $.nick is rw = 'Perl6IRC';
+has Str:D $.username = 'Perl6IRC';
+has Str:D $.userhost = 'localhost';
+has Str:D $.userreal = 'Perl6 IRC Client';
+has Str:D @.channels = ['#perl6'];
+has @.filters where .all ~~ Callable;
+has @.plugins;
+has %.servers;
+has Bool $!is-connected = False;
+has Lock $!lock = Lock.new;
+has Channel $!event-pipe = Channel.new;
- # 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 &colored = try {
+ require Terminal::ANSIColor;
+ &colored
+ = GLOBAL::Terminal::ANSIColor::EXPORT::DEFAULT::<&colored>;
+} // sub (Str $s, $) { $s };
- 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 )
- or ( $e<command> eq 'PRIVMSG'
- and $e<params>[1] ~~ /:i ^ $nick <[,:]> \s+/
- )
- ) {
- my %res = :where($e<who><nick> ),
- :who( $e<who><nick> ),
- :how( $e<command> ),
- :what( $e<params>[1] );
-
- %res<where> = $e<params>[0] # this message was said in the channel
- unless ( $e<command> eq 'PRIVMSG' and $e<params>[0] eq $nick )
- or ( $e<command> eq 'NOTICE' and $e<params>[0] eq $nick );
-
- %res<what>.subst-mutate: /:i ^ $nick <[,:]> \s+/, ''
- if %res<where> ~~ /^ <[#&]>/;
-
- for @!plugs.grep(*.^can: 'irc-to-me') -> $p {
- my $res = $p.irc-to-me(self, $e, %res);
- return unless $res === IRC_NOT_HANDLED;
- }
- }
+method run {
+ self!prep-servers;
+ .irc = self for @.plugins.grep: { .DEFINITE and .^can: 'irc' };
- if ( $e<command> eq 'PRIVMSG' and $e<params>[0] eq $!nick ) {
- for @!plugs.grep(*.^can: 'irc-privmsg-me') -> $p {
- my $res = $p.irc-privmsg-me(self, $e);
- return unless $res === IRC_NOT_HANDLED;
+ start {
+ my $closed = $!event-pipe.closed;
+ loop {
+ if $!event-pipe.receive -> $e {
+ $!debug and debug-print $e, :in, :server($e.server);
+ $!lock.protect: {
+ self!handle-event: $e;
+ CATCH { default { warn $_; warn .backtrace } }
+ };
+ }
+ elsif $closed { last }
}
}
- if ( $e<command> eq 'NOTICE' and $e<params>[0] eq $!nick ) {
- for @!plugs.grep(*.^can: 'irc-notice-me') -> $p {
- my $res = $p.irc-notice-me(self, $e);
- return unless $res === IRC_NOT_HANDLED;
- }
- }
+ for %!servers.kv -> $s-name, $s-conf {
+ $s-conf<promise>
+ = IO::Socket::Async.connect($s-conf<host>, $s-conf<port>).then: {
+ $!lock.protect: { $s-conf<sock> = .result; };
- my $cmd = 'irc-' ~ $e<command>.lc;
- for @!plugs.grep(*.^can: $cmd) -> $p {
- my $res = $p."$cmd"(self, $e);
- return unless $res === IRC_NOT_HANDLED;
- }
+ self!ssay: "PASS $!password", :server($s-name)
+ if $!password.defined;
+ self!ssay: "NICK $!nick", :server($s-name);
+ self!ssay:
+ "USER $!username $!username $!host :$!userreal",
+ :server($s-name);
+
+ my $left-overs = '';
+ react {
+ whenever $s-conf<sock>.Supply :bin -> $buf is copy {
+ my $str = try $buf.decode: 'utf8';
+ $str or $str = $buf.decode: 'latin-1';
+ $str = ($left-overs//'') ~ $str;
- for @!plugs.grep(*.^can: 'irc-unhandled') -> $p {
- my $res = $p.irc-unhandled(self, $e);
- return unless $res === IRC_NOT_HANDLED;
+ (my $events, $left-overs)
+ = self!parse: $str, :server($s-name);
+ $!event-pipe.send: $_ for $events.grep: *.defined;
+ }
+ CATCH { default { warn $_; warn .backtrace } }
+ }
+ $s-conf<sock>.close;
+ CATCH { default { warn $_; warn .backtrace } }
+ };
}
+ await Promise.allof: %!servers.values».<promise>;
}
-method notice (Str $who, Str $what) {
- my $msg = "NOTICE $who :$what\n";
- $!debug and "{plug-name}$msg".put;
- $!sock.print("$msg\n");
- self;
+method emit-custom (|c) {
+ $!event-pipe.send: c;
}
-method privmsg (Str $who, Str $what) {
- my $msg = "PRIVMSG $who :$what\n";
- $!debug and "{plug-name}$msg".put;
- $!sock.print("$msg\n");
- self;
+method send (:$where!, :$text!, :$server, :$notice) {
+ for $server || |%!servers.keys.sort {
+ self.send-cmd: $notice ?? 'NOTICE' !! 'PRIVMSG', $where, $text,
+ :server($_);
+ }
}
-method respond (
- Str:D :$how = 'privmsg',
- Str:D :$where is required,
- Str:D :$what is required is copy,
- Str:D :$who,
- :$when where Any|Dateish|Instant;
- # TODO: remove Any: https://rt.perl.org/Ticket/Display.html?id=127142
-) {
- $what = "$who, $what" if $who and $where ~~ /^<[#&]>/;
- my $method = $how.fc eq 'PRIVMSG'.fc ?? 'privmsg'
- !! $how.fc eq 'NOTICE'.fc ?? 'notice'
- !! fail 'Unknown :$how specified. Use PRIVMSG or NOTICE';
-
- if $when {
- Promise.at($when).then: { self."$method"($where, $what) };
- CATCH { warn .backtrace }
+method send-cmd ($cmd, *@args is copy, :$server, :$prefix = '') {
+ CATCH { default { warn $_; warn .backtrace } }
+
+ if $cmd eq 'NOTICE'|'PRIVMSG' and @!filters
+ and my @f = @!filters.grep({
+ .signature.ACCEPTS: \(@args[1])
+ or .signature.ACCEPTS: \(@args[1], where => @args[0])
+ })
+ {
+ start {
+ CATCH { default { warn $_; warn .backtrace } }
+
+ my ($where, $text) = @args;
+ for @f -> $f {
+ given $f.signature.params.elems {
+ when 1 { $text = $f($text); }
+ when 2 { ($text, $where) = $f($text, :$where) }
+ }
+ }
+ self!ssay: :$server, join ' ', $cmd, $where, ":$prefix$text";
+ }
}
else {
- self."$method"($where, $what);
+ @args[*-1] = ':' ~ @args[*-1];
+ self!ssay: :$server, join ' ', $cmd, @args;
}
- self;
}
-method run {
- .irc-start-up: self for @!plugs.grep(*.^can: 'irc-start-up');
-
- await IO::Socket::Async.connect( $!host, $!port ).then({
- $!sock = .result;
- $.ssay("PASS $!password\n") if $!password.defined;
- $.ssay("NICK $!nick\n");
- $.ssay("USER $!username $!username $!host :$!userreal\n");
-
- # my $left-overs = '';
- react {
- whenever $!sock.Supply :bin -> $buf is copy {
- 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 = parse-irc $str;
- for @$events -> $e {
- self.handle-event: $e;
- CATCH { warn .backtrace }
+method !prep-servers {
+ %!servers = '*' => {} unless %!servers;
+
+ for %!servers.values -> $s {
+ $s{$_} //= self."$_"()
+ for <host password port nick username userhost userreal>;
+ $s<channels> = @.channels;
+ $s<socket> = Nil;
+ }
+}
+
+method !handle-event ($e) {
+ given $e.command {
+ when '001' {
+ %!servers{ $e.server }<nick> = $e.args[0];
+ self!ssay: "JOIN $_", :server($e.server) for @.channels;
+ }
+ when 'PING' { return $e.reply; }
+ when 'JOIN' {
+ # say "Joined channel $e.channel() on $e.server()"
+ # if $e.nick eq %!servers{ $e.server }<nick>;
+ }
+ }
+
+ my $event-name = 'irc-' ~ $e.^name.subst('IRC::Client::Message::', '')
+ .lc.subst: '::', '-', :g;
+
+ my @events = flat gather {
+ given $event-name {
+ when 'irc-privmsg-channel' | 'irc-notice-channel' {
+ my $nick = $!nick;
+ if $e.text.subst-mutate: /^ $nick <[,:\s]> \s* /, '' {
+ take 'irc-addressed', ('irc-to-me' if $!is-connected);
+ }
+ elsif $e ~~ / << $nick >> / and $!is-connected {
+ take 'irc-mentioned';
}
+ take $event-name, $event-name eq 'irc-privmsg-channel'
+ ?? 'irc-privmsg' !! 'irc-notice';
+ }
+ when 'irc-privmsg-me' {
+ take $event-name, ('irc-to-me' if $!is-connected),
+ 'irc-privmsg';
+ }
+ when 'irc-notice-me' {
+ take $event-name, ('irc-to-me' if $!is-connected),
+ 'irc-notice';
+ }
+ when 'irc-mode-channel' | 'irc-mode-me' {
+ take $event-name, 'irc-mode';
+ }
+ when 'irc-numeric' {
+ if $e.command eq '001' {
+ $!is-connected = True ;
+ take 'irc-connected';
+ }
+ take 'irc-' ~ $e.command, $event-name;
}
-
- CATCH { warn .backtrace }
}
+ take 'irc-all';
+ }
+
+ EVENT: for @events -> $event {
+ debug-print "emitting `$event`", :sys
+ if $!debug >= 3 or ($!debug == 2 and not $event eq 'irc-all');
- say "Closing connection";
- $!sock.close;
+ for self!plugs-that-can($event, $e) {
+ my $res = ."$event"($e);
+ next if $res ~~ IRC_FLAG_NEXT;
+ if $res ~~ Promise {
+ $res.then: { $e.reply: $^r unless $^r ~~ Nil or $e.replied; }
+ } else {
+ $e.reply: $res unless $res ~~ Nil or $e.replied;
+ }
+ last EVENT;
- # CATCH { warn .backtrace }
- });
+ CATCH { default { warn $_, .backtrace; } }
+ }
+ }
}
-method ssay (Str:D $msg) {
- $!debug and "{plug-name}$msg".put;
- $!sock.print("$msg\n");
+method !plugs-that-can ($method, $e) {
+ gather {
+ for @!plugins -> $plug {
+ take $plug if .cando: \($plug, $e)
+ for $plug.^can: $method;
+ }
+ }
+}
+
+method !ssay (Str:D $msg, :$server = '*') {
+ $!debug and debug-print $msg, :out, :$server;
+ %!servers{ $server }<sock>.print("$msg\n");
self;
}
-#### HELPER SUBS
+method !parse (Str:D $str, :$server) {
+ return |IRC::Client::Grammar.parse(
+ $str,
+ :actions( IRC::Client::Grammar::Actions.new: :irc(self), :$server )
+ ).made;
+}
+
+sub debug-print (Str(Any) $str, :$in, :$out, :$sys, :$server) {
+ my $server-str = $server
+ ?? colored($server, 'bold white on_cyan') ~ ' ' !! '';
-sub plug-name {
- my $plug = callframe(3).file;
- my $cur = $?FILE;
- return '[core] ' if $plug eq $cur;
- $cur ~~ s/'.pm6'$//;
- $plug ~~ s:g/^ $cur '/' | '.pm6'$//;
- $plug ~~ s/'/'/::/;
- return "[$plug] ";
+ my @bits = $str.split: ' ';
+ if $in {
+ my ($pref, $cmd) = 0, 1;
+ if @bits[0] eq '❚⚠❚' {
+ @bits[0] = colored @bits[0], 'bold white on_red';
+ $pref++; $cmd++;
+ }
+ @bits[$pref] = colored @bits[$pref], 'bold magenta';
+ @bits[$cmd] = @bits[$cmd] ~~ /^ <[0..9]>**3 $/
+ ?? colored(@bits[$cmd], 'bold red')
+ !! colored(@bits[$cmd], 'bold yellow');
+ put colored('▬▬▶ ', 'bold blue' ) ~ $server-str ~ @bits.join: ' ';
+ }
+ elsif $out {
+ @bits[0] = colored @bits[0], 'bold magenta';
+ put colored('◀▬▬ ', 'bold green') ~ $server-str ~ @bits.join: ' ';
+ }
+ elsif $sys {
+ put colored(' ' x 4 ~ '↳', 'bold white') ~ ' '
+ ~ @bits.join(' ')
+ .subst: /(\`<-[`]>+\`)/, { colored(~$0, 'bold cyan') };
+ }
+ else {
+ die "Unknown debug print mode";
+ }
}
diff --git a/lib/IRC/Grammar.pm6 b/lib/IRC/Client/Grammar.pm6
index c05322c..feec9fd 100644
--- a/lib/IRC/Grammar.pm6
+++ b/lib/IRC/Client/Grammar.pm6
@@ -1,5 +1,6 @@
-unit grammar IRC::Grammar;
-token TOP { <message>+ }
+unit grammar IRC::Client::Grammar;
+token TOP { <message>+ <left-overs> }
+token left-overs { \N* }
token SPACE { ' '+ }
token message { [':' <prefix> <SPACE> ]? <command> <params> \n }
token prefix {
@@ -8,12 +9,12 @@ token message { [':' <prefix> <SPACE> ]? <command> <params> \n }
}
token servername { <host> }
token nick { <letter> [ <letter> | <number> | <special> ]* }
- token user { <-[\ \x0\r\n]>+? <before [<SPACE> | '@']>}
+ token user { <-[\ \x[0]\r\n]>+? <before [<SPACE> | '@']>}
token host { <-[\s!@]>+ }
token command { <letter>+ | <number>**3 }
token params { <SPACE>* [ ':' <trailing> | <middle> <params> ]? }
- token middle { <-[:\ \x0\r\n]> <-[\ \x0\r\n]>* }
- token trailing { <-[\x0\r\n]>* }
+ token middle { <-[:\ \x[0]\r\n]> <-[\ \x[0]\r\n]>* }
+ token trailing { <-[\x[0]\r\n]>* }
token letter { <[a..zA..Z]> }
token number { <[0..9]> }
diff --git a/lib/IRC/Client/Grammar/Actions.pm6 b/lib/IRC/Client/Grammar/Actions.pm6
new file mode 100644
index 0000000..b1fcc53
--- /dev/null
+++ b/lib/IRC/Client/Grammar/Actions.pm6
@@ -0,0 +1,119 @@
+unit class IRC::Client::Grammar::Actions;
+
+use IRC::Client::Message;
+
+has $.irc;
+has $.server;
+
+method TOP ($/) {
+ $/.make: (
+ $<message>».made,
+ ~( $<left-overs> // '' ),
+ );
+}
+
+method message ($match) {
+ my %args;
+ my $pref = $match<prefix>;
+ for qw/nick user host/ {
+ $pref{$_}.defined or next;
+ %args<who>{$_} = ~$pref{$_};
+ }
+ %args<who><host> = ~$pref<servername> if $pref<servername>.defined;
+
+ my $p = $match<params>;
+ loop {
+ %args<params>.append: ~$p<middle> if $p<middle>.defined;
+
+ if ( $p<trailing>.defined ) {
+ %args<params>.append: ~$p<trailing>;
+ last;
+ }
+ last unless $p<params>.defined;
+ $p = $p<params>;
+ }
+
+ my %msg-args =
+ command => $match<command>.uc,
+ args => %args<params>,
+ host => %args<who><host>//'',
+ irc => $!irc,
+ nick => %args<who><nick>//'',
+ server => $!server,
+ usermask => ~($match<prefix>//''),
+ username => %args<who><user>//'';
+
+ my $msg;
+ given %msg-args<command> {
+ when /^ <[0..9]>**3 $/ {
+ $msg = IRC::Client::Message::Numeric.new: |%msg-args;
+ }
+ when 'JOIN' {
+ $msg = IRC::Client::Message::Join.new:
+ :channel( %args<params>[0] ),
+ |%msg-args;
+ }
+ when 'PART' {
+ $msg = IRC::Client::Message::Part.new:
+ :channel( %args<params>[0] ),
+ |%msg-args;
+ }
+ when 'NICK' {
+ $msg = IRC::Client::Message::Nick.new:
+ :new-nick( %args<params>[0] ),
+ |%msg-args;
+ }
+ when 'NOTICE' { $msg = msg-notice %args, %msg-args }
+ when 'MODE' { $msg = msg-mode %args, %msg-args }
+ when 'PING' { $msg = IRC::Client::Message::Ping.new: |%msg-args }
+ when 'PRIVMSG' { $msg = msg-privmsg %args, %msg-args }
+ when 'QUIT' { $msg = IRC::Client::Message::Quit.new: |%msg-args }
+ default { $msg = IRC::Client::Message::Unknown.new: |%msg-args }
+ }
+
+ $match.make: $msg;
+}
+
+sub msg-privmsg (%args, %msg-args) {
+ %args<params>[0] ~~ /^<[#&]>/
+ and return IRC::Client::Message::Privmsg::Channel.new:
+ :channel( %args<params>[0] ),
+ :text( %args<params>[1] ),
+ |%msg-args;
+
+ return IRC::Client::Message::Privmsg::Me.new:
+ :text( %args<params>[1] ),
+ |%msg-args;
+}
+
+sub msg-notice (%args, %msg-args) {
+ %args<params>[0] ~~ /^<[#&]>/
+ and return IRC::Client::Message::Notice::Channel.new:
+ :channel( %args<params>[0] ),
+ :text( %args<params>[1] ),
+ |%msg-args;
+
+ return IRC::Client::Message::Notice::Me.new:
+ :text( %args<params>[1] ),
+ |%msg-args;
+}
+
+sub msg-mode (%args, %msg-args) {
+ if %args<params>[0] ~~ /^<[#&]>/ {
+ my @modes;
+ for %args<params>[1..*-1].join.comb: /\S/ {
+ state $sign;
+ /<[+-]>/ and $sign = $_ and next;
+ @modes.push: $sign => $_;
+ };
+ return IRC::Client::Message::Mode::Channel.new:
+ :channel( %args<params>[0] ),
+ :modes( @modes ),
+ |%msg-args;
+ }
+ else {
+ return IRC::Client::Message::Mode::Me.new:
+ :modes( %args<params>[1..*-1].join.comb: /<[a..zA..Z]>/ ),
+ |%msg-args;
+ }
+}
diff --git a/lib/IRC/Client/Message.pm6 b/lib/IRC/Client/Message.pm6
new file mode 100644
index 0000000..9559fd1
--- /dev/null
+++ b/lib/IRC/Client/Message.pm6
@@ -0,0 +1,70 @@
+unit package IRC::Client::Message;
+
+role IRC::Client::Message {
+ has $.irc is required;
+ has Str:D $.nick is required;
+ has Str:D $.username is required;
+ has Str:D $.host is required;
+ has Str:D $.usermask is required;
+ has Str:D $.command is required;
+ has Str:D $.server is required;
+ has $.args is required;
+
+ method Str { ":$!usermask $!command $!args[]" }
+}
+
+constant M = IRC::Client::Message;
+
+role Join does M { has $.channel; }
+role Mode does M { has @.modes; }
+role Mode::Channel does Mode { has $.channel; }
+role Mode::Me does Mode { }
+role Nick does M { has $.new-nick; }
+role Numeric does M { }
+role Part does M { has $.channel; }
+role Quit does M { }
+role Unknown does M {
+ method Str { "❚⚠❚ :$.usermask $.command $.args[]" }
+}
+
+role Ping does M {
+ method reply { $.irc.send-cmd: 'PONG', $.args, :$.server; }
+}
+
+role Privmsg does M {
+ has $.text is rw;
+ has Bool $.replied is rw = False;
+ method Str { $.text }
+}
+role Privmsg::Channel does Privmsg {
+ has $.channel;
+ method reply ($text, :$where) {
+ $.irc.send-cmd: 'PRIVMSG', $where // $.channel, $text,
+ :$.server, :prefix("$.nick, ");
+ }
+}
+role Privmsg::Me does Privmsg {
+ method reply ($text, :$where) {
+ $.irc.send-cmd: 'PRIVMSG', $where // $.nick, $text, :$.server;
+ }
+}
+
+role Notice does M {
+ has $.text is rw;
+ has Bool $.replied is rw = False;
+ method Str { $.text }
+}
+role Notice::Channel does Notice {
+ has $.channel;
+ method reply ($text, :$where) {
+ $.irc.send-cmd: 'NOTICE', $where // $.channel, $text,
+ :$.server, :prefix("$.nick, ");
+ $.replied = True;
+ }
+}
+role Notice::Me does Notice {
+ method reply ($text, :$where) {
+ $.irc.send-cmd: 'NOTICE', $where // $.nick, $text, :$.server;
+ $.replied = True;
+ }
+}
diff --git a/lib/IRC/Client/Plugin.pm6 b/lib/IRC/Client/Plugin.pm6
deleted file mode 100644
index d73d7bd..0000000
--- a/lib/IRC/Client/Plugin.pm6
+++ /dev/null
@@ -1,3 +0,0 @@
-constant IRC_HANDLED = "irc plugin handled \x1";
-constant IRC_NOT_HANDLED = "irc plugin not-handled \x2";
-unit class IRC::Client::Plugin;
diff --git a/lib/IRC/Client/Plugin/Debugger.pm6 b/lib/IRC/Client/Plugin/Debugger.pm6
deleted file mode 100644
index 13b1461..0000000
--- a/lib/IRC/Client/Plugin/Debugger.pm6
+++ /dev/null
@@ -1,8 +0,0 @@
-use Data::Dump;
-use IRC::Client::Plugin;
-unit class IRC::Client::Plugin::Debugger is IRC::Client::Plugin;
-
-method irc-all-events ($irc, $e) {
- say Dump $e, :indent(4);
- return IRC_NOT_HANDLED;
-}
diff --git a/lib/IRC/Client/Plugin/PingPong.pm6 b/lib/IRC/Client/Plugin/PingPong.pm6
deleted file mode 100644
index 2651fd6..0000000
--- a/lib/IRC/Client/Plugin/PingPong.pm6
+++ /dev/null
@@ -1,2 +0,0 @@
-unit class IRC::Client::Plugin::PingPong;
-method irc-ping ($irc, $e) { $irc.ssay("PONG {$irc.nick} $e<params>[0]") }
diff --git a/lib/IRC/Grammar/Actions.pm6 b/lib/IRC/Grammar/Actions.pm6
deleted file mode 100644
index 234e392..0000000
--- a/lib/IRC/Grammar/Actions.pm6
+++ /dev/null
@@ -1,26 +0,0 @@
-unit class IRC::Grammar::Actions;
-method TOP ($/) { $/.make: $<message>>>.made }
-method message ($/) {
- my $pref = $/<prefix>;
- my %args = command => ~$/<command>;
- for qw/nick user host/ {
- $pref{$_}.defined or next;
- %args<who>{$_} = $pref{$_}.Str;
- }
- %args<who><host> = ~$pref<servername> if $pref<servername>.defined;
-
- my $p = $/<params>;
-
- for ^100 { # bail out after 100 iterations; we're stuck
- if ( $p<middle>.defined ) {
- %args<params>.append: ~$p<middle>;
- }
- if ( $p<trailing>.defined ) {
- %args<params>.append: ~$p<trailing>;
- last;
- }
- $p = $p<params>;
- }
-
- $/.make: %args;
-}
diff --git a/lib/IRC/Parser.pm6 b/lib/IRC/Parser.pm6
deleted file mode 100644
index dda05e6..0000000
--- a/lib/IRC/Parser.pm6
+++ /dev/null
@@ -1,7 +0,0 @@
-use IRC::Grammar;
-use IRC::Grammar::Actions;
-unit class IRC::Parser;
-
-sub parse-irc (Str:D $input) is export {
- IRC::Grammar.parse($input, actions => IRC::Grammar::Actions).made // [];
-}