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