summaryrefslogtreecommitdiff
path: root/lib/irc/puppet_connection.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irc/puppet_connection.ex')
-rw-r--r--lib/irc/puppet_connection.ex18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/irc/puppet_connection.ex b/lib/irc/puppet_connection.ex
index 91a26b3..fd0a98e 100644
--- a/lib/irc/puppet_connection.ex
+++ b/lib/irc/puppet_connection.ex
@@ -12,7 +12,7 @@ defmodule IRC.PuppetConnection do
DynamicSupervisor.start_link(__MODULE__, [], name: __MODULE__)
end
- def start_child(%IRC.Account{id: account_id}, %IRC.Connection{id: connection_id}) do
+ def start_child(%Nola.Account{id: account_id}, %IRC.Connection{id: connection_id}) do
spec = %{id: {account_id, connection_id}, start: {IRC.PuppetConnection, :start_link, [account_id, connection_id]}, restart: :transient}
DynamicSupervisor.start_child(__MODULE__, spec)
end
@@ -27,7 +27,7 @@ defmodule IRC.PuppetConnection do
end
end
- def whereis(account = %IRC.Account{id: account_id}, connection = %IRC.Connection{id: connection_id}) do
+ def whereis(account = %Nola.Account{id: account_id}, connection = %IRC.Connection{id: connection_id}) do
{:global, name} = name(account_id, connection_id)
case :global.whereis_name(name) do
:undefined -> nil
@@ -35,11 +35,11 @@ defmodule IRC.PuppetConnection do
end
end
- def send_message(account = %IRC.Account{id: account_id}, connection = %IRC.Connection{id: connection_id}, channel, text) do
+ def send_message(account = %Nola.Account{id: account_id}, connection = %IRC.Connection{id: connection_id}, channel, text) do
GenServer.cast(name(account_id, connection_id), {:send_message, self(), channel, text})
end
- def start_and_send_message(account = %IRC.Account{id: account_id}, connection = %IRC.Connection{id: connection_id}, channel, text) do
+ def start_and_send_message(account = %Nola.Account{id: account_id}, connection = %IRC.Connection{id: connection_id}, channel, text) do
{:global, name} = name(account_id, connection_id)
pid = whereis(account, connection)
pid = if !pid do
@@ -53,7 +53,7 @@ defmodule IRC.PuppetConnection do
GenServer.cast(pid, {:send_message, self(), channel, text})
end
- def start(account = %IRC.Account{}, connection = %IRC.Connection{}) do
+ def start(account = %Nola.Account{}, connection = %IRC.Connection{}) do
IRC.PuppetConnection.Supervisor.start_child(account, connection)
end
@@ -66,7 +66,7 @@ defmodule IRC.PuppetConnection do
end
def init([account_id, connection_id]) do
- account = %IRC.Account{} = IRC.Account.get(account_id)
+ account = %Nola.Account{} = Nola.Account.get(account_id)
connection = %IRC.Connection{} = IRC.Connection.lookup(connection_id)
Logger.metadata(puppet_conn: account.id <> "@" <> connection.id)
backoff = :backoff.init(@min_backoff, @max_backoff)
@@ -78,7 +78,7 @@ defmodule IRC.PuppetConnection do
def handle_continue(:connect, state) do
#ipv6 = if @env == :prod do
# subnet = Nola.Subnet.assign(state.account_id)
- # IRC.Account.put_meta(IRC.Account.get(state.account_id), "subnet", subnet)
+ # Nola.Account.put_meta(Nola.Account.get(state.account_id), "subnet", subnet)
# ip = Pfx.host(subnet, 1)
# {:ok, ipv6} = :inet_parse.ipv6_address(to_charlist(ip))
# System.cmd("add-ip6", [ip])
@@ -146,7 +146,7 @@ defmodule IRC.PuppetConnection do
ExIRC.Client.msg(state.client, :privmsg, channel, text)
meta = %{puppet: true, from: pid}
- account = IRC.Account.get(state.account_id)
+ account = Nola.Account.get(state.account_id)
nick = make_nick(state)
sender = %ExIRC.SenderInfo{network: state.network, nick: suffix_nick(nick), user: nick, host: "puppet."}
reply_fun = fn(text) ->
@@ -219,7 +219,7 @@ defmodule IRC.PuppetConnection do
end
def make_nick(state) do
- account = IRC.Account.get(state.account_id)
+ account = Nola.Account.get(state.account_id)
user = IRC.UserTrack.find_by_account(state.network, account)
base_nick = if(user, do: user.nick, else: account.name)
clean_nick = case String.split(base_nick, ":", parts: 2) do