summaryrefslogtreecommitdiff
path: root/lib/lsg_irc/connection_handler.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lsg_irc/connection_handler.ex')
-rw-r--r--lib/lsg_irc/connection_handler.ex17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/lsg_irc/connection_handler.ex b/lib/lsg_irc/connection_handler.ex
index 337fe00..8d07e58 100644
--- a/lib/lsg_irc/connection_handler.ex
+++ b/lib/lsg_irc/connection_handler.ex
@@ -1,19 +1,20 @@
defmodule LSG.IRC.ConnectionHandler do
defmodule State do
- defstruct host: "irc.quakenet.org",
- port: 6667,
- pass: "",
- nick: "`115ans",
- user: "115ans",
- name: "https://sys.115ans.net/irc",
- client: nil
+ defstruct [:host, :port, :pass, :nick, :name, :user, :client]
end
def start_link(client) do
- GenServer.start_link(__MODULE__, [%State{client: client}])
+ 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
+ IO.puts inspect(state)
ExIRC.Client.add_handler state.client, self
ExIRC.Client.connect! state.client, state.host, state.port
{:ok, state}