diff options
Diffstat (limited to 'lib/irc/client/command/names.ex')
-rw-r--r-- | lib/irc/client/command/names.ex | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/irc/client/command/names.ex b/lib/irc/client/command/names.ex new file mode 100644 index 0000000..b5a84a6 --- /dev/null +++ b/lib/irc/client/command/names.ex @@ -0,0 +1,22 @@ +defmodule Irc.Client.Command.Names do + alias Irc.Parser.Line + require Irc.Parser.Numeric + import Irc.Parser.Numeric + + def init() do + {[rpl_NAMREPLY(), rpl_ENDOFNAMES()], :names, ["userhost-in-names"]} + end + + def handle_line(%Line{command: rpl_NAMREPLY()}) do + :buffer + end + + def handle_line(%Line{command: rpl_ENDOFNAMES(), args: [_, target | _]}) do + :finish + end + + def handle_buffer(buffer = [%Line{args: [_, target | _]} | _]) do + {:event, {:names, target, buffer}} + end + +end |