From 18615cc9bb33801fbde2716513071e7b32af2ab2 Mon Sep 17 00:00:00 2001 From: Zoffix Znet Date: Sun, 24 Jul 2016 16:20:12 -0400 Subject: moar work --- lib/IRC/Client/Grammar/Actions.pm6 | 2 +- lib/IRC/Client/Message.pm6 | 35 ++++++++++++++++++++++++++++------- lib/IRC/Client/Plugin.pm6 | 4 ---- 3 files changed, 29 insertions(+), 12 deletions(-) delete mode 100644 lib/IRC/Client/Plugin.pm6 (limited to 'lib/IRC/Client') diff --git a/lib/IRC/Client/Grammar/Actions.pm6 b/lib/IRC/Client/Grammar/Actions.pm6 index 7c16227..b1fcc53 100644 --- a/lib/IRC/Client/Grammar/Actions.pm6 +++ b/lib/IRC/Client/Grammar/Actions.pm6 @@ -45,7 +45,7 @@ method message ($match) { my $msg; given %msg-args { - when /^ $=(<[0..9]>**3) $/ { + when /^ <[0..9]>**3 $/ { $msg = IRC::Client::Message::Numeric.new: |%msg-args; } when 'JOIN' { diff --git a/lib/IRC/Client/Message.pm6 b/lib/IRC/Client/Message.pm6 index 74261c9..84eba2c 100644 --- a/lib/IRC/Client/Message.pm6 +++ b/lib/IRC/Client/Message.pm6 @@ -16,9 +16,6 @@ role IRC::Client::Message { constant M = IRC::Client::Message; role Join does M { has $.channel; } -role Notice does M { has $.text; } -role Notice::Channel does Notice { has $.channel; } -role Notice::Me does Notice { } role Mode does M { has @.modes; } role Mode::Channel does Mode { has $.channel; } role Mode::Me does Mode { } @@ -34,16 +31,40 @@ role Ping does M { method reply { $.irc.send-cmd: 'PONG', $.args, :$.server; } } -role Privmsg does M { has $.text; } +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; + $.irc.send-cmd: 'PRIVMSG', $where // $.channel, "$.nick, $text", + :$.server; } } role Privmsg::Me does Privmsg { method reply ($text, :$where) { - $where //= $.nick; - $.irc.send-cmd: 'PRIVMSG', $where, $text, :$.server; + $.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, "$.nick, $text", + :$.server; + $.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 2493c3f..0000000 --- a/lib/IRC/Client/Plugin.pm6 +++ /dev/null @@ -1,4 +0,0 @@ -unit role IRC::Client::Plugin; - -has $.IRC_HANDLED = my class IRC_FLAG_HANDLED {}; -has $.IRC_NOT_HANDLED = my class IRC_FLAG_NOT_HANDLED {}; -- cgit v1.1