summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/lsg_web/controllers/irc_controller.ex11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/lsg_web/controllers/irc_controller.ex b/lib/lsg_web/controllers/irc_controller.ex
index 9ddeefc..32007c2 100644
--- a/lib/lsg_web/controllers/irc_controller.ex
+++ b/lib/lsg_web/controllers/irc_controller.ex
@@ -6,11 +6,14 @@ defmodule LSGWeb.IrcController do
def index(conn, params) do
network = Map.get(params, "network")
channel = if c = Map.get(params, "channel"), do: LSGWeb.reformat_chan(c)
- commands = for mod <- ([IRC.Account.AccountPlugin] ++ Application.get_env(:lsg, :irc)[:plugins] ++ Application.get_env(:lsg, :irc)[:handlers]) do
- identifier = Module.split(mod) |> List.last |> String.replace("Plugin", "") |> Macro.underscore
- {identifier, mod.irc_doc()}
+ commands = for mod <- Enum.uniq([IRC.Account.AccountPlugin] ++ IRC.Plugin.enabled()) do
+ if is_atom(mod) do
+ identifier = Module.split(mod) |> List.last |> String.replace("Plugin", "") |> Macro.underscore
+ {identifier, mod.irc_doc()}
+ end
end
- |> Enum.reject(fn({_, i}) -> i == nil end)
+ |> Enum.filter(& &1)
+ |> Enum.filter(fn({_, doc}) -> doc end)
members = cond do
network -> IRC.Membership.expanded_members_or_friends(conn.assigns.account, network, channel)
true -> IRC.Membership.of_account(conn.assigns.account)