summaryrefslogtreecommitdiff
path: root/lib/lsg_irc/connection_handler.ex
diff options
context:
space:
mode:
authorhref <href@random.sh>2018-02-17 21:21:42 +0100
committerhref <href@random.sh>2018-02-17 21:21:42 +0100
commit50c6a09ff64cb081b27a0c30790b86873449d172 (patch)
treeba1bebfc7e367f169276692e0ac02709d62d6516 /lib/lsg_irc/connection_handler.ex
parenttxt: fix against malicious filenames (aka 'fuck you shiv') (diff)
:)
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}