diff options
author | Cliff Rowley <cliffrowley@gmail.com> | 2014-06-25 01:50:44 +0100 |
---|---|---|
committer | Cliff Rowley <cliffrowley@gmail.com> | 2014-06-25 16:43:07 +0100 |
commit | de040c2cd16418387d9b73048f47dd986cb5a90f (patch) | |
tree | bd783173588931033819a0a2a9b7bd18f002637e /lib | |
parent | Update to Elixir 0.13.3 (diff) |
Update to Elixir 0.14.1
Diffstat (limited to 'lib')
-rw-r--r-- | lib/app.ex | 4 | ||||
-rw-r--r-- | lib/exirc/channels.ex | 2 | ||||
-rw-r--r-- | lib/exirc/exirc.ex | 4 | ||||
-rw-r--r-- | lib/exirc/utils.ex | 30 |
4 files changed, 19 insertions, 21 deletions
@@ -2,9 +2,9 @@ defmodule ExIrc.App do @moduledoc """ Entry point for the ExIrc application. """ - use Application.Behaviour + use Application def start(_type, _args) do ExIrc.start! end -end
\ No newline at end of file +end diff --git a/lib/exirc/channels.ex b/lib/exirc/channels.ex index 17f5d24..a96cb2e 100644 --- a/lib/exirc/channels.ex +++ b/lib/exirc/channels.ex @@ -72,7 +72,7 @@ defmodule ExIrc.Channels do Update the type of a tracked channel when it changes """ def set_type(channel_tree, channel_name, channel_type) when is_binary(channel_type) do - set_type(channel_tree, channel_name, List.from_char_data!(channel_type)) + set_type(channel_tree, channel_name, String.to_char_list(channel_type)) end def set_type(channel_tree, channel_name, channel_type) do name = downcase(channel_name) diff --git a/lib/exirc/exirc.ex b/lib/exirc/exirc.ex index 0f818c1..7f1ff63 100644 --- a/lib/exirc/exirc.ex +++ b/lib/exirc/exirc.ex @@ -24,12 +24,12 @@ defmodule ExIrc do # Quit (message is optional) ExIrc.Client.quit client, "message" - + # Stop and close the client connection ExIrc.Client.stop! client """ - use Supervisor.Behaviour + use Supervisor ############## # Public API diff --git a/lib/exirc/utils.ex b/lib/exirc/utils.ex index 45e6c76..3da2832 100644 --- a/lib/exirc/utils.ex +++ b/lib/exirc/utils.ex @@ -1,7 +1,5 @@ defmodule ExIrc.Utils do - import String, only: [from_char_data!: 1] - ###################### # IRC Message Parsing ###################### @@ -28,14 +26,14 @@ defmodule ExIrc.Utils do end defp parse_from(from, msg) do - case Regex.split(~r/(!|@|\.)/, iodata_to_binary(from)) 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} [_, "." | _] -> # from is probably a server name - %{msg | :server => from_char_data!(from)} + %{msg | :server => to_string(from)} [nick] -> %{msg | :nick => nick} end @@ -53,23 +51,23 @@ defmodule ExIrc.Utils do case args do [1 | ctcp_rev] -> [ctcp_cmd | args] = ctcp_rev |> Enum.reverse |> :string.tokens(' ') - %{msg | :cmd => from_char_data!(ctcp_cmd), :args => args, :ctcp => true} + %{msg | :cmd => to_string(ctcp_cmd), :args => args, :ctcp => true} _ -> - %{msg | :cmd => from_char_data!(cmd), :ctcp => :invalid} + %{msg | :cmd => to_string(cmd), :ctcp => :invalid} end end defp get_cmd([cmd | rest], msg) do - get_args(rest, %{msg | :cmd => from_char_data!(cmd)}) + get_args(rest, %{msg | :cmd => to_string(cmd)}) end # Parse command args from message defp get_args([], msg) do args = msg.args - |> Enum.reverse + |> Enum.reverse |> Enum.filter(fn(arg) -> arg != [] end) - |> Enum.map(&String.from_char_data!/1) + |> Enum.map(&List.to_string/1) %{msg | :args => args} end @@ -120,7 +118,7 @@ defmodule ExIrc.Utils do end defp isup_param("PREFIX=" <> user_prefixes, state) do prefixes = Regex.run(~r/\((.*)\)(.*)/, user_prefixes, capture: :all_but_first) - |> Enum.map(&List.from_char_data!/1) + |> Enum.map(&String.to_char_list/1) |> List.zip %{state | :user_prefixes => prefixes} end @@ -150,15 +148,15 @@ defmodule ExIrc.Utils do ' ', :lists.nth(m, @months_of_year), ' ', - :io_lib.format("~2..0s", [integer_to_list(d)]), + :io_lib.format("~2..0s", [Integer.to_char_list(d)]), ' ', - :io_lib.format("~2..0s", [integer_to_list(h)]), + :io_lib.format("~2..0s", [Integer.to_char_list(h)]), ':', - :io_lib.format("~2..0s", [integer_to_list(n)]), + :io_lib.format("~2..0s", [Integer.to_char_list(n)]), ':', - :io_lib.format("~2..0s", [integer_to_list(s)]), + :io_lib.format("~2..0s", [Integer.to_char_list(s)]), ' ', - integer_to_list(y)] |> List.flatten |> String.from_char_data! + Integer.to_char_list(y)] |> List.flatten |> List.to_string end defp trim_crlf(charlist) do @@ -168,4 +166,4 @@ defmodule ExIrc.Utils do end end -end
\ No newline at end of file +end |