diff options
Diffstat (limited to 'lib/lsg_irc/lsg_irc.ex')
-rw-r--r-- | lib/lsg_irc/lsg_irc.ex | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/lsg_irc/lsg_irc.ex b/lib/lsg_irc/lsg_irc.ex new file mode 100644 index 0000000..c2782ad --- /dev/null +++ b/lib/lsg_irc/lsg_irc.ex @@ -0,0 +1,37 @@ +defmodule LSG.IRC do + require Logger + + + def application_childs do + env = Application.get_env(:lsg, :irc) + import Supervisor.Spec + + IRC.Connection.setup() + IRC.Plugin.setup() + + # Probably just needed for migration + #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.Account.AccountPlugin, []), + supervisor(IRC.Plugin.Supervisor, [], [name: IRC.Plugin.Supervisor]), + supervisor(IRC.Connection.Supervisor, [], [name: IRC.Connection.Supervisor]), + supervisor(IRC.PuppetConnection.Supervisor, [], [name: IRC.PuppetConnection.Supervisor]), + ] + end + + def after_start() do + # Start plugins first to let them get on connection events. + Logger.debug("IRC.after_start - initializing plugins") + IRC.Plugin.start_all() + Logger.debug("IRC.after_start - initializing connections") + IRC.Connection.start_all() + Logger.debug("IRC.after_start - ok") + end + +end |