summaryrefslogtreecommitdiff
path: root/lib/irc/connection_handler.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irc/connection_handler.ex')
-rw-r--r--lib/irc/connection_handler.ex36
1 files changed, 0 insertions, 36 deletions
diff --git a/lib/irc/connection_handler.ex b/lib/irc/connection_handler.ex
deleted file mode 100644
index 1c335f2..0000000
--- a/lib/irc/connection_handler.ex
+++ /dev/null
@@ -1,36 +0,0 @@
-defmodule IRC.ConnectionHandler do
- defmodule State do
- defstruct [:host, :port, :pass, :nick, :name, :user, :client]
- end
-
- def start_link(client) do
- irc = Application.get_env(:lsg, :irc)[:irc]
- host = irc[:host]
- port = irc[:port]
- nick = irc[:nick]
- user = irc[:user]
- name = irc[:name]
- GenServer.start_link(__MODULE__, [%State{client: client, host: host, port: port, nick: nick, user: user, name: name}])
- end
-
- def init([state]) do
- ExIRC.Client.add_handler state.client, self
- ExIRC.Client.connect! state.client, state.host, state.port
- {:ok, state}
- end
-
- def handle_info({:connected, server, port}, state) do
- debug "Connected to #{server}:#{port}"
- ExIRC.Client.logon state.client, state.pass, state.nick, state.user, state.name
- {:noreply, state}
- end
-
- # Catch-all for messages you don't care about
- def handle_info(msg, state) do
- {:noreply, state}
- end
-
- defp debug(msg) do
- IO.puts IO.ANSI.yellow() <> msg <> IO.ANSI.reset()
- end
-end