summaryrefslogtreecommitdiff
path: root/lib/plugins/account.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/plugins/account.ex')
-rw-r--r--lib/plugins/account.ex26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/plugins/account.ex b/lib/plugins/account.ex
index 96405bb..20abab7 100644
--- a/lib/plugins/account.ex
+++ b/lib/plugins/account.ex
@@ -21,7 +21,7 @@ defmodule Nola.Plugins.Account do
{:ok, nil}
end
- def handle_info({:irc, :text, m = %IRC.Message{account: account, text: "help"}}, state) do
+ def handle_info({:irc, :text, m = %Nola.Message{account: account, text: "help"}}, state) do
text = [
"account: show current account and auth token",
"auth: show authentications methods",
@@ -38,7 +38,7 @@ defmodule Nola.Plugins.Account do
{:noreply, state}
end
- def handle_info({:irc, :text, m = %IRC.Message{account: account, text: "auth"}}, state) do
+ def handle_info({:irc, :text, m = %Nola.Message{account: account, text: "auth"}}, state) do
spec = [{{:"$1", :"$2"}, [{:==, :"$2", {:const, account.id}}], [:"$1"]}]
predicates = :dets.select(Nola.Account.file("predicates"), spec)
text = for {net, {key, value}} <- predicates, do: "#{net}: #{to_string(key)}: #{value}"
@@ -46,7 +46,7 @@ defmodule Nola.Plugins.Account do
{:noreply, state}
end
- def handle_info({:irc, :text, m = %IRC.Message{account: account, text: "whoami"}}, state) do
+ def handle_info({:irc, :text, m = %Nola.Message{account: account, text: "whoami"}}, state) do
users = for user <- Nola.UserTrack.find_by_account(m.account) do
chans = Enum.map(user.privileges, fn({chan, _}) -> chan end)
|> Enum.join(" ")
@@ -56,7 +56,7 @@ defmodule Nola.Plugins.Account do
{:noreply, state}
end
- def handle_info({:irc, :text, m = %IRC.Message{account: account, text: "account"}}, state) do
+ def handle_info({:irc, :text, m = %Nola.Message{account: account, text: "account"}}, state) do
account = Nola.Account.lookup(m.sender)
text = ["Account Id: #{account.id}",
"Authenticate to this account from another network: \"auth #{account.id} #{account.token}\" to the other bot!"]
@@ -64,7 +64,7 @@ defmodule Nola.Plugins.Account do
{:noreply, state}
end
- def handle_info({:irc, :text, m = %IRC.Message{sender: sender, text: "auth"<>_}}, state) do
+ def handle_info({:irc, :text, m = %Nola.Message{sender: sender, text: "auth"<>_}}, state) do
#account = Nola.Account.lookup(m.sender)
case String.split(m.text, " ") do
["auth", id, token] ->
@@ -75,13 +75,13 @@ defmodule Nola.Plugins.Account do
{:noreply, state}
end
- def handle_info({:irc, :text, m = %IRC.Message{account: account, text: "set-name "<>name}}, state) do
+ def handle_info({:irc, :text, m = %Nola.Message{account: account, text: "set-name "<>name}}, state) do
Nola.Account.update_account_name(account, name)
m.replyfun.("Name changed: #{name}")
{:noreply, state}
end
- def handle_info({:irc, :text, m = %IRC.Message{text: "disable-sms"}}, state) do
+ def handle_info({:irc, :text, m = %Nola.Message{text: "disable-sms"}}, state) do
if Nola.Account.get_meta(m.account, "sms-number") do
Nola.Account.delete_meta(m.account, "sms-number")
m.replfyun.("SMS disabled.")
@@ -91,14 +91,14 @@ defmodule Nola.Plugins.Account do
{:noreply, state}
end
- def handle_info({:irc, :text, m = %IRC.Message{text: "web"}}, state) do
+ def handle_info({:irc, :text, m = %Nola.Message{text: "web"}}, state) do
auth_url = Untappd.auth_url()
login_url = Nola.AuthToken.new_url(m.account.id, nil)
m.replyfun.("-> " <> login_url)
{:noreply, state}
end
- def handle_info({:irc, :text, m = %IRC.Message{text: "enable-sms"}}, state) do
+ def handle_info({:irc, :text, m = %Nola.Message{text: "enable-sms"}}, state) do
code = String.downcase(EntropyString.small_id())
Nola.Account.put_meta(m.account, "sms-validation-code", code)
Nola.Account.put_meta(m.account, "sms-validation-target", m.network)
@@ -109,7 +109,7 @@ defmodule Nola.Plugins.Account do
{:noreply, state}
end
- def handle_info({:irc, :text, m = %IRC.Message{text: "enable-telegram"}}, state) do
+ def handle_info({:irc, :text, m = %Nola.Message{text: "enable-telegram"}}, state) do
code = String.downcase(EntropyString.small_id())
Nola.Account.delete_meta(m.account, "telegram-id")
Nola.Account.put_meta(m.account, "telegram-validation-code", code)
@@ -120,14 +120,14 @@ defmodule Nola.Plugins.Account do
{:noreply, state}
end
- def handle_info({:irc, :text, m = %IRC.Message{text: "enable-untappd"}}, state) do
+ def handle_info({:irc, :text, m = %Nola.Message{text: "enable-untappd"}}, state) do
auth_url = Untappd.auth_url()
login_url = Nola.AuthToken.new_url(m.account.id, {:external_redirect, auth_url})
m.replyfun.(["To link your Untappd account, open this URL:", login_url])
{:noreply, state}
end
- def handle_info({:irc, :text, m = %IRC.Message{text: "getmeta"<>_}}, state) do
+ def handle_info({:irc, :text, m = %Nola.Message{text: "getmeta"<>_}}, state) do
result = case String.split(m.text, " ") do
["getmeta"] ->
for {k, v} <- Nola.Account.get_all_meta(m.account) do
@@ -150,7 +150,7 @@ defmodule Nola.Plugins.Account do
{:noreply, state}
end
- def handle_info({:irc, :text, m = %IRC.Message{text: "setusermeta"<>_}}, state) do
+ def handle_info({:irc, :text, m = %Nola.Message{text: "setusermeta"<>_}}, state) do
result = case String.split(m.text, " ") do
["setusermeta", key, value] ->
Nola.Account.put_user_meta(m.account, key, value)