diff options
author | Paul Schoenfelder <paulschoenfelder@gmail.com> | 2013-12-07 15:37:17 -0600 |
---|---|---|
committer | Paul Schoenfelder <paulschoenfelder@gmail.com> | 2013-12-07 15:37:17 -0600 |
commit | bf4ee4ade6e1e7c2f04ae9c8cacdae811f6fb19c (patch) | |
tree | 3fee92c7ed6c376d4de06f0e50c518d74300f430 /lib/exirc/client.ex | |
parent | Fix comments in utils (diff) |
Refactor commands.ex to fix import issues
Diffstat (limited to 'lib/exirc/client.ex')
-rw-r--r-- | lib/exirc/client.ex | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/exirc/client.ex b/lib/exirc/client.ex index 95d1829..6e6e71a 100644 --- a/lib/exirc/client.ex +++ b/lib/exirc/client.ex @@ -2,8 +2,8 @@ defmodule ExIrc.Client do @moduledoc """ Maintains the state and behaviour for individual IRC client connections """ - import Irc.Commands - import ExIrc.Logger + use Irc.Commands + import ExIrc.Logger alias ExIrc.Channels, as: Channels alias ExIrc.Utils, as: Utils @@ -259,12 +259,12 @@ defmodule ExIrc.Client do ############### # Sucessfully logged in - def handle_data(IrcMessage[cmd: @rpl_WELCOME] = _msg, ClientState[logged_on?: false] = state) do + def handle_data(IrcMessage[cmd: @rpl_welcome] = _msg, ClientState[logged_on?: false] = state) do {:noreply, state.logged_on?(true).login_time(:erlang.now())} end # Server capabilities - def handle_data(IrcMessage[cmd: @rpl_ISUPPORT] = msg, state) do + def handle_data(IrcMessage[cmd: @rpl_isupport] = msg, state) do {:noreply, Utils.isup(msg.args, state)} end @@ -283,7 +283,7 @@ defmodule ExIrc.Client do # Topic message on join # 3 arguments is not RFC compliant but _very_ common # 2 arguments is RFC compliant - def handle_data(IrcMessage[cmd: @rpl_TOPIC] = msg, state) do + def handle_data(IrcMessage[cmd: @rpl_topic] = msg, state) do {channel, topic} = case msg.args do [_nick, channel, topic] -> {channel, topic} [channel, topic] -> {channel, topic} @@ -299,7 +299,7 @@ defmodule ExIrc.Client do end # NAMES reply - def handle_data(IrcMessage[cmd: @rpl_NAMEREPLY] = msg, state) do + def handle_data(IrcMessage[cmd: @rpl_namereply] = msg, state) do {channel_type, channel, names} = case msg.args do [_nick, channel_type, channel, names] -> {channel_type, channel, names} [channel_type, channel, names] -> {channel_type, channel, names} |