summaryrefslogtreecommitdiff
path: root/lib/lsg_irc.ex
diff options
context:
space:
mode:
authorhref <href@random.sh>2018-05-02 19:03:35 +0200
committerhref <href@random.sh>2018-05-02 19:04:28 +0200
commita47dc245808921309f58e8b1c4b6fa028b2df073 (patch)
tree1842d413f2a43d3759b439417f053052b878a1f7 /lib/lsg_irc.ex
parent (diff)
meh
Diffstat (limited to '')
-rw-r--r--lib/lsg_irc.ex24
1 files changed, 10 insertions, 14 deletions
diff --git a/lib/lsg_irc.ex b/lib/lsg_irc.ex
index b988e04..482cb5d 100644
--- a/lib/lsg_irc.ex
+++ b/lib/lsg_irc.ex
@@ -4,26 +4,22 @@ defmodule LSG.IRC do
{:ok, irc_client} = ExIRC.start_link!
import Supervisor.Spec
[
- worker(LSG.IRC.UserTrack.Storage, []),
- worker(LSG.IRC.ConnectionHandler, [irc_client]),
- worker(LSG.IRC.LoginHandler, [irc_client]),
- worker(LSG.IRC.UserTrackHandler, [irc_client]),
+ worker(Registry, [[keys: :duplicate, name: IRC.PubSub]], id: :registry_irc),
+ 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])
+ worker(handler, [irc_client], [name: handler])
end
- end
-
- def admin?(%{nick: nick, user: user, host: host}) do
- for {n, u, h} <- Application.get_env(:lsg, :irc, [])[:admins]||[] do
- admin_part_match?(n, nick) && admin_part_match?(u, user) && admin_part_match?(h, host)
+ ++
+ for plugin <- Application.get_env(:lsg, :irc)[:plugins] do
+ worker(plugin, [], [name: plugin])
end
- |> Enum.any?
end
- defp admin_part_match?(:_, _), do: true
- defp admin_part_match?(a, a), do: true
- defp admin_part_match?(_, _), do: false
end