summaryrefslogtreecommitdiff
path: root/lib/irc/connection.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irc/connection.ex')
-rw-r--r--lib/irc/connection.ex18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/irc/connection.ex b/lib/irc/connection.ex
index cff556d..7a0ca9d 100644
--- a/lib/irc/connection.ex
+++ b/lib/irc/connection.ex
@@ -1,4 +1,4 @@
-defmodule IRC.Connection do
+defmodule Nola.Irc.Connection do
require Logger
use Ecto.Schema
@@ -10,7 +10,7 @@ defmodule IRC.Connection do
## Start connections
```
- IRC.Connection.start_link(host: "irc.random.sh", port: 6697, nick: "pouetbot", channels: ["#dev"])
+ Nola.Irc.Connection.start_link(host: "irc.random.sh", port: 6697, nick: "pouetbot", channels: ["#dev"])
## PubSub topics
@@ -53,8 +53,8 @@ defmodule IRC.Connection do
DynamicSupervisor.start_link(__MODULE__, [], name: __MODULE__)
end
- def start_child(%IRC.Connection{} = conn) do
- spec = %{id: conn.id, start: {IRC.Connection, :start_link, [conn]}, restart: :transient}
+ def start_child(%Nola.Irc.Connection{} = conn) do
+ spec = %{id: conn.id, start: {Nola.Irc.Connection, :start_link, [conn]}, restart: :transient}
DynamicSupervisor.start_child(__MODULE__, spec)
end
@@ -106,7 +106,7 @@ defmodule IRC.Connection do
end
def start_all() do
- for conn <- connections(), do: {conn, IRC.Connection.Supervisor.start_child(conn)}
+ for conn <- connections(), do: {conn, Nola.Irc.Connection.Supervisor.start_child(conn)}
end
def get_network(network, channel \\ nil) do
@@ -140,7 +140,7 @@ defmodule IRC.Connection do
end
def start_connection(%__MODULE__{} = conn) do
- IRC.Connection.Supervisor.start_child(conn)
+ Nola.Irc.Connection.Supervisor.start_child(conn)
end
def stop_connection(%__MODULE__{id: id}) do
@@ -158,7 +158,7 @@ defmodule IRC.Connection do
{:error, {:existing, conn}}
else
:dets.insert(dets(), to_tuple(conn))
- IRC.Connection.Supervisor.start_child(conn)
+ Nola.Irc.Connection.Supervisor.start_child(conn)
end
error -> error
end
@@ -173,7 +173,7 @@ defmodule IRC.Connection do
end
def broadcast_message(net, chan, message) do
- dispatch("conn", {:broadcast, net, chan, message}, IRC.ConnectionPubSub)
+ dispatch("conn", {:broadcast, net, chan, message}, Nola.Irc.ConnectionPubSub)
end
def broadcast_message(list, message) when is_list(list) do
for {net, chan} <- list do
@@ -212,7 +212,7 @@ defmodule IRC.Connection do
def handle_continue(:connect, state) do
client_opts = []
|> Keyword.put(:network, state.conn.network)
- {:ok, _} = Registry.register(IRC.ConnectionPubSub, "conn", [])
+ {:ok, _} = Registry.register(Nola.Irc.ConnectionPubSub, "conn", [])
client = if state.client && Process.alive?(state.client) do
Logger.info("Reconnecting client")
state.client