Don't crash on UTF-8 input
This commit is contained in:
parent
f1d7e8a753
commit
999c215578
2 changed files with 4 additions and 2 deletions
|
@ -35,7 +35,8 @@ defmodule Nulform.IRC do
|
|||
[sender, "PRIVMSG", target | text] ->
|
||||
<<":", sender :: binary>> = sender
|
||||
new_msg = PRIVMSG.new [info: msg, sender: sender,
|
||||
target: target, text: Enum.join(text, " ")]
|
||||
target: target,
|
||||
text: Nulform.Utilities.to_utf8 Enum.join(text, " ")]
|
||||
|
||||
_ ->
|
||||
nil
|
||||
|
|
|
@ -30,7 +30,8 @@ defmodule Nulform do
|
|||
def listen_loop(urlanalyzer) do
|
||||
receive do
|
||||
{:nulform, :msg_in, msg} ->
|
||||
IO.puts(to_binary(msg.connection_id) <> " -> " <> msg.raw_msg)
|
||||
IO.puts(to_binary(msg.connection_id) <> " -> "
|
||||
<> Nulform.Utilities.to_utf8 msg.raw_msg)
|
||||
:gen_server.cast urlanalyzer, msg
|
||||
|
||||
case String.split msg.raw_msg do
|
||||
|
|
Loading…
Reference in a new issue