diff options
author | href <href@random.sh> | 2020-07-07 21:39:10 +0200 |
---|---|---|
committer | href <href@random.sh> | 2020-07-07 21:39:51 +0200 |
commit | d6ee134a5957e299c3ad59011df320b3c41e6e61 (patch) | |
tree | 29567e6635466f8a3415a935b3cc8a777019f5bc /lib/lsg_irc.ex | |
parent | bleh (diff) |
pouet
Diffstat (limited to '')
-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 |