diff options
author | Zoffix Znet <cpan@zoffix.com> | 2016-07-24 16:20:12 -0400 |
---|---|---|
committer | Zoffix Znet <cpan@zoffix.com> | 2016-07-24 16:20:12 -0400 |
commit | 18615cc9bb33801fbde2716513071e7b32af2ab2 (patch) | |
tree | 167784d2089a4e05cfb114e5a3520efc28bf9ecb /lib/IRC/Client | |
parent | effaced84ec8df42e60b89426f5fc644cb907285 (diff) |
moar work
Diffstat (limited to 'lib/IRC/Client')
-rw-r--r-- | lib/IRC/Client/Grammar/Actions.pm6 | 2 | ||||
-rw-r--r-- | lib/IRC/Client/Message.pm6 | 35 | ||||
-rw-r--r-- | lib/IRC/Client/Plugin.pm6 | 4 |
3 files changed, 29 insertions, 12 deletions
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<command> { - when /^ $<command>=(<[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 {}; |