Skip to content

Commit

Permalink
fixed badarg issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Montuori committed Jul 14, 2014
1 parent 5649e72 commit 5adbac5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/exirc/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ defmodule ExIrc.Utils do

defp parse_from(from, msg) do
case Regex.split(~r/(!|@|\.)/, IO.iodata_to_binary(from)) do
[nick, "!", user, "@", host | host_rest] ->
%{msg | :nick => nick, :user => user, :host => host <> host_rest}
[nick, "@", host | host_rest] ->
%{msg | :nick => nick, :host => host <> host_rest}
[nick, "!", user, "@" | host] ->
%{msg | :nick => nick, :user => user, :host => Enum.join(host)}
[nick, "@" | host] ->
%{msg | :nick => nick, :host => Enum.join(host)}
[_, "." | _] ->
# from is probably a server name
%{msg | :server => to_string(from)}
Expand Down

0 comments on commit 5adbac5

Please sign in to comment.