summaryrefslogtreecommitdiff
path: root/lib/irc/client/command/account.ex
blob: e0088cd7da7555e51215c332143210ee20e6378d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
defmodule Irc.Client.Command.Account do
  alias Irc.Line

  #@type t :: (logout :: {:account, Irc.Mask.t}) | (login :: {:account, Irc.Mask.t, String.t})

  def init(_) do
    {"ACCOUNT", nil, "account-notify"}
  end

  def handle_line(_, %Line{command: "ACCOUNT", source: target, args: ["*"]}) do
    {:event, {:account, target}}
  end

  def handle_line(_, %Line{command: "ACCOUNT", source: target, args: [account_name]}) do
    {:event, {:account, target, account_name}}
  end

end