summaryrefslogtreecommitdiff
path: root/lib/irc/client/command/away.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irc/client/command/away.ex')
-rw-r--r--lib/irc/client/command/away.ex25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/irc/client/command/away.ex b/lib/irc/client/command/away.ex
new file mode 100644
index 0000000..3b6b38e
--- /dev/null
+++ b/lib/irc/client/command/away.ex
@@ -0,0 +1,25 @@
+defmodule Irc.Client.Command.Away do
+ alias Irc.Parser.Line
+
+ @type t :: away :: {:away, Irc.Mask.t, String.t} | unaway :: {:away, Irc.Mask.t}
+
+ def init() do
+ {"AWAY", :away, "away-notify"}
+ end
+
+ def handle_command(:away, args, _) do
+ command = case args do
+ [] -> ['AWAY']
+ [message] -> ['AWAY :', message]
+ end
+ {:send, command}
+ end
+
+ def hanle_line(%Line{command: "AWAY", source: source, args: args}, _) do
+ case args do
+ [] -> {:event, {:away, source}}
+ [message] -> {:event, {:away, {source, message}}}
+ end
+ end
+
+end