From 40a234c6e59d2ea9ef309850b8f38ad30e55017e Mon Sep 17 00:00:00 2001 From: href Date: Tue, 14 Jan 2020 16:03:05 +0100 Subject: =?UTF-8?q?=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/irc/client/command/names.ex | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 lib/irc/client/command/names.ex (limited to 'lib/irc/client/command/names.ex') 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 -- cgit v1.2.3