diff options
author | Jordan Bracco <href@random.sh> | 2022-12-20 03:41:16 +0000 |
---|---|---|
committer | Jordan Bracco <href@random.sh> | 2022-12-20 19:29:42 +0100 |
commit | bf41d25373391444e313feaafca2dfd2de7bd66f (patch) | |
tree | 3a45423b87593ce373e8bc17dd90b79a1c9b0d3f /lib/irc | |
parent | More IRC. cleanup, refs T77. (diff) |
Re-reorg files a bit, lol, refs T77.
Diffstat (limited to 'lib/irc')
-rw-r--r-- | lib/irc/irc.ex | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/lib/irc/irc.ex b/lib/irc/irc.ex deleted file mode 100644 index dd1a5d2..0000000 --- a/lib/irc/irc.ex +++ /dev/null @@ -1,49 +0,0 @@ -defmodule Nola.Irc do - require Logger - - def env(), do: Nola.env(:irc) - def env(key, default \\ nil), do: Keyword.get(env(), key, default) - - def send_message_as(account, network, channel, text, force_puppet \\ false) do - connection = IRC.Connection.get_network(network) - if connection && (force_puppet || IRC.PuppetConnection.whereis(account, connection)) do - IRC.PuppetConnection.start_and_send_message(account, connection, channel, text) - else - user = Nola.UserTrack.find_by_account(network, account) - nick = if(user, do: user.nick, else: account.name) - IRC.Connection.broadcast_message(network, channel, "<#{nick}> #{text}") - end - end - - def admin?(%Message{sender: sender}), do: admin?(sender) - - def admin?(%{nick: nick, user: user, host: host}) do - for {n, u, h} <- Nola.IRC.env(:admins, []) do - admin_part_match?(n, nick) && admin_part_match?(u, user) && admin_part_match?(h, host) - end - |> Enum.any? - end - - defp admin_part_match?(:_, _), do: true - defp admin_part_match?(a, a), do: true - defp admin_part_match?(_, _), do: false - - def application_childs do - import Supervisor.Spec - - IRC.Connection.setup() - - [ - worker(Registry, [[keys: :duplicate, name: IRC.ConnectionPubSub]], id: :registr_irc_conn), - supervisor(IRC.Connection.Supervisor, [], [name: IRC.Connection.Supervisor]), - supervisor(IRC.PuppetConnection.Supervisor, [], [name: IRC.PuppetConnection.Supervisor]), - ] - end - - # Start plugins first to let them get on connection events. - def after_start() do - Logger.info("Starting connections") - IRC.Connection.start_all() - end - -end |