summaryrefslogtreecommitdiff
path: root/lib/lsg_irc/admin_handler.ex
diff options
context:
space:
mode:
authorhref <href@random.sh>2018-02-17 21:21:42 +0100
committerhref <href@random.sh>2018-02-17 21:21:42 +0100
commit50c6a09ff64cb081b27a0c30790b86873449d172 (patch)
treeba1bebfc7e367f169276692e0ac02709d62d6516 /lib/lsg_irc/admin_handler.ex
parenttxt: fix against malicious filenames (aka 'fuck you shiv') (diff)
:)
Diffstat (limited to 'lib/lsg_irc/admin_handler.ex')
-rw-r--r--lib/lsg_irc/admin_handler.ex32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/lsg_irc/admin_handler.ex b/lib/lsg_irc/admin_handler.ex
new file mode 100644
index 0000000..27d35c3
--- /dev/null
+++ b/lib/lsg_irc/admin_handler.ex
@@ -0,0 +1,32 @@
+defmodule LSG.IRC.AdminHandler do
+ @moduledoc """
+ # admin
+
+ !op
+ op; requiert admin
+ """
+
+ def irc_doc, do: nil
+
+ def start_link(client) do
+ GenServer.start_link(__MODULE__, [client])
+ end
+
+ def init([client]) do
+ ExIRC.Client.add_handler client, self
+ {:ok, client}
+ end
+
+ def handle_info({:received, "!op", sender, chan}, client) do
+ if LSG.IRC.admin?(sender) do
+ ExIRC.Client.mode(client, chan, "+o", sender.nick)
+ end
+ {:noreply, client}
+ end
+
+ def handle_info(msg, client) do
+ IO.inspect(msg)
+ {:noreply, client}
+ end
+
+end