diff options
Diffstat (limited to 'lib/lsg_irc.ex')
-rw-r--r-- | lib/lsg_irc.ex | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/lsg_irc.ex b/lib/lsg_irc.ex index cb1e382..c811d18 100644 --- a/lib/lsg_irc.ex +++ b/lib/lsg_irc.ex @@ -1,29 +1,29 @@ defmodule LSG.IRC do def application_childs do - {:ok, irc_client} = ExIRC.start_link! + env = Application.get_env(:lsg, :irc) import Supervisor.Spec + + IRC.Connection.setup() + IRC.Plugin.setup() + for plugin <- Application.get_env(:lsg, :irc)[:plugins], do: IRC.Plugin.declare(plugin) + [ + worker(Registry, [[keys: :duplicate, name: IRC.ConnectionPubSub]], id: :registr_irc_conn), worker(Registry, [[keys: :duplicate, name: IRC.PubSub]], id: :registry_irc), + worker(IRC.Membership, []), + worker(IRC.Account, []), worker(IRC.UserTrack.Storage, []), - worker(IRC.ConnectionHandler, [irc_client]), - worker(IRC.LoginHandler, [irc_client]), - worker(IRC.UserTrackHandler, [irc_client]), - worker(IRC.PubSubHandler, [irc_client], [name: :irc_pub_sub]), - ] - ++ - for handler <- Application.get_env(:lsg, :irc)[:handlers] do - worker(handler, [irc_client], [name: handler]) - end - ++ - for plugin <- Application.get_env(:lsg, :irc)[:plugins] do - worker(plugin, [], [name: plugin]) - end - ++ [ - worker(LSG.IRC.AlcoologAnnouncerPlugin, []) + worker(IRC.Account.AccountPlugin, []), + supervisor(IRC.Plugin.Supervisor, [], [name: IRC.Plugin.Supervisor]), + supervisor(IRC.Connection.Supervisor, [], [name: IRC.Connection.Supervisor]), ] end - + def after_start() do + # Start plugins first to let them get on connection events. + IRC.Plugin.start_all() + IRC.Connection.start_all() + end end |