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

  @type t :: {:chghost, old_mask :: Irc.Mask.t, new_mask :: Irc.Mask.t}

  def init(_) do
    {"CHGHOST", nil, "chghost"}
  end

  def handle_line(_, %Line{source: old_mask, args: [new_user, new_host]}) do
    new_mask = %Irc.Mask{old_mask | user: new_user, host: new_host}
    {:event, {:chghost, old_mask, new_mask}}
  end

end