diff options
author | href <href@random.sh> | 2018-02-17 21:21:42 +0100 |
---|---|---|
committer | href <href@random.sh> | 2018-02-17 21:21:42 +0100 |
commit | 50c6a09ff64cb081b27a0c30790b86873449d172 (patch) | |
tree | ba1bebfc7e367f169276692e0ac02709d62d6516 /lib/lsg_irc/connection_handler.ex | |
parent | txt: 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.ex | 17 |
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} |