summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Bracco <href@random.sh>2022-12-20 12:22:41 +0000
committerJordan Bracco <href@random.sh>2022-12-20 19:29:42 +0100
commite78e8049334bea5336d87f0909d9e1a3876989e5 (patch)
tree88f1abcd9f814d0f8d68813029c99d89731cc66d
parentRe-reorg files a bit, lol, refs T77. (diff)
Rename IRC.{Connection,PuppetConnection} to Nola.Irc.{Connection,PuppetConnection}, refs T77.
-rw-r--r--lib/irc.ex18
-rw-r--r--lib/irc/connection.ex18
-rw-r--r--lib/irc/puppet_connection.ex28
-rw-r--r--lib/matrix.ex4
-rw-r--r--lib/nola/account.ex6
-rw-r--r--lib/nola/user_track.ex14
-rw-r--r--lib/plugins/alcoolog.ex6
-rw-r--r--lib/plugins/alcoolog_announcer.ex6
-rw-r--r--lib/plugins/say.ex2
-rw-r--r--lib/plugins/sms.ex8
-rw-r--r--lib/plugins/tell.ex2
-rw-r--r--lib/telegram.ex8
-rw-r--r--lib/telegram/room.ex10
-rw-r--r--lib/web/context_plug.ex4
-rw-r--r--lib/web/controllers/alcoolog_controller.ex2
-rw-r--r--lib/web/live/chat_live.ex4
16 files changed, 70 insertions, 70 deletions
diff --git a/lib/irc.ex b/lib/irc.ex
index dd1a5d2..3898068 100644
--- a/lib/irc.ex
+++ b/lib/irc.ex
@@ -5,13 +5,13 @@ defmodule Nola.Irc do
def env(key, default \\ nil), do: Keyword.get(env(), key, default)
def send_message_as(account, network, channel, text, force_puppet \\ false) do
- connection = IRC.Connection.get_network(network)
- if connection && (force_puppet || IRC.PuppetConnection.whereis(account, connection)) do
- IRC.PuppetConnection.start_and_send_message(account, connection, channel, text)
+ connection = Nola.Irc.Connection.get_network(network)
+ if connection && (force_puppet || Nola.Irc.PuppetConnection.whereis(account, connection)) do
+ Nola.Irc.PuppetConnection.start_and_send_message(account, connection, channel, text)
else
user = Nola.UserTrack.find_by_account(network, account)
nick = if(user, do: user.nick, else: account.name)
- IRC.Connection.broadcast_message(network, channel, "<#{nick}> #{text}")
+ Nola.Irc.Connection.broadcast_message(network, channel, "<#{nick}> #{text}")
end
end
@@ -31,19 +31,19 @@ defmodule Nola.Irc do
def application_childs do
import Supervisor.Spec
- IRC.Connection.setup()
+ Nola.Irc.Connection.setup()
[
- worker(Registry, [[keys: :duplicate, name: IRC.ConnectionPubSub]], id: :registr_irc_conn),
- supervisor(IRC.Connection.Supervisor, [], [name: IRC.Connection.Supervisor]),
- supervisor(IRC.PuppetConnection.Supervisor, [], [name: IRC.PuppetConnection.Supervisor]),
+ worker(Registry, [[keys: :duplicate, name: Nola.Irc.ConnectionPubSub]], id: :registr_irc_conn),
+ supervisor(Nola.Irc.Connection.Supervisor, [], [name: Nola.Irc.Connection.Supervisor]),
+ supervisor(Nola.Irc.PuppetConnection.Supervisor, [], [name: Nola.Irc.PuppetConnection.Supervisor]),
]
end
# Start plugins first to let them get on connection events.
def after_start() do
Logger.info("Starting connections")
- IRC.Connection.start_all()
+ Nola.Irc.Connection.start_all()
end
end
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
diff --git a/lib/irc/puppet_connection.ex b/lib/irc/puppet_connection.ex
index 2604876..f5e2e5c 100644
--- a/lib/irc/puppet_connection.ex
+++ b/lib/irc/puppet_connection.ex
@@ -1,4 +1,4 @@
-defmodule IRC.PuppetConnection do
+defmodule Nola.Irc.PuppetConnection do
require Logger
@min_backoff :timer.seconds(5)
@max_backoff :timer.seconds(2*60)
@@ -12,8 +12,8 @@ defmodule IRC.PuppetConnection do
DynamicSupervisor.start_link(__MODULE__, [], name: __MODULE__)
end
- 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}
+ def start_child(%Nola.Account{id: account_id}, %Nola.Irc.Connection{id: connection_id}) do
+ spec = %{id: {account_id, connection_id}, start: {Nola.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 = %Nola.Account{id: account_id}, connection = %IRC.Connection{id: connection_id}) do
+ def whereis(account = %Nola.Account{id: account_id}, connection = %Nola.Irc.Connection{id: connection_id}) do
{:global, name} = name(account_id, connection_id)
case :global.whereis_name(name) do
:undefined -> nil
@@ -35,15 +35,15 @@ defmodule IRC.PuppetConnection do
end
end
- def send_message(account = %Nola.Account{id: account_id}, connection = %IRC.Connection{id: connection_id}, channel, text) do
+ def send_message(account = %Nola.Account{id: account_id}, connection = %Nola.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 = %Nola.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 = %Nola.Irc.Connection{id: connection_id}, channel, text) do
{:global, name} = name(account_id, connection_id)
pid = whereis(account, connection)
pid = if !pid do
- case IRC.PuppetConnection.Supervisor.start_child(account, connection) do
+ case Nola.Irc.PuppetConnection.Supervisor.start_child(account, connection) do
{:ok, pid} -> pid
{:error, {:already_started, pid}} -> pid
end
@@ -53,8 +53,8 @@ defmodule IRC.PuppetConnection do
GenServer.cast(pid, {:send_message, self(), channel, text})
end
- def start(account = %Nola.Account{}, connection = %IRC.Connection{}) do
- IRC.PuppetConnection.Supervisor.start_child(account, connection)
+ def start(account = %Nola.Account{}, connection = %Nola.Irc.Connection{}) do
+ Nola.Irc.PuppetConnection.Supervisor.start_child(account, connection)
end
def start_link(account_id, connection_id) do
@@ -67,7 +67,7 @@ defmodule IRC.PuppetConnection do
def init([account_id, connection_id]) do
account = %Nola.Account{} = Nola.Account.get(account_id)
- connection = %IRC.Connection{} = IRC.Connection.lookup(connection_id)
+ connection = %Nola.Irc.Connection{} = Nola.Irc.Connection.lookup(connection_id)
Logger.metadata(puppet_conn: account.id <> "@" <> connection.id)
backoff = :backoff.init(@min_backoff, @max_backoff)
|> :backoff.type(:jitter)
@@ -85,7 +85,7 @@ defmodule IRC.PuppetConnection do
# ipv6
#end
- conn = IRC.Connection.lookup(state.connection_id)
+ conn = Nola.Irc.Connection.lookup(state.connection_id)
client_opts = []
|> Keyword.put(:network, conn.network)
client = if state.client && Process.alive?(state.client) do
@@ -150,14 +150,14 @@ defmodule IRC.PuppetConnection do
nick = make_nick(state)
sender = %ExIRC.SenderInfo{network: state.network, nick: suffix_nick(nick), user: nick, host: "puppet."}
reply_fun = fn(text) ->
- IRC.Connection.broadcast_message(state.network, channel, text)
+ Nola.Irc.Connection.broadcast_message(state.network, channel, text)
end
- message = %Nola.Message{id: FlakeId.get(), at: NaiveDateTime.utc_now(), text: text, network: state.network, account: account, sender: sender, channel: channel, replyfun: reply_fun, trigger: IRC.Connection.extract_trigger(text), meta: meta}
+ message = %Nola.Message{id: FlakeId.get(), at: NaiveDateTime.utc_now(), text: text, network: state.network, account: account, sender: sender, channel: channel, replyfun: reply_fun, trigger: Nola.Irc.Connection.extract_trigger(text), meta: meta}
message = case Nola.UserTrack.messaged(message) do
:ok -> message
{:ok, message} -> message
end
- IRC.Connection.publish(message, ["#{message.network}/#{channel}:messages"])
+ Nola.Irc.Connection.publish(message, ["#{message.network}/#{channel}:messages"])
idle = if length(state.buffer) == 0 do
:erlang.cancel_timer(state.idle)
diff --git a/lib/matrix.ex b/lib/matrix.ex
index 9334816..0ad0836 100644
--- a/lib/matrix.ex
+++ b/lib/matrix.ex
@@ -62,7 +62,7 @@ defmodule Nola.Matrix do
def application_childs() do
import Supervisor.Spec
[
- supervisor(Nola.Matrix.Room.Supervisor, [], [name: IRC.PuppetConnection.Supervisor]),
+ supervisor(Nola.Matrix.Room.Supervisor, [], [name: Nola.Irc.PuppetConnection.Supervisor]),
]
end
@@ -96,7 +96,7 @@ defmodule Nola.Matrix do
Logger.debug("Matrix: creating room #{inspect room_alias}")
localpart = localpart(room_alias)
with {:ok, network, channel} <- extract_network_channel_from_localpart(localpart),
- %IRC.Connection{} <- IRC.Connection.get_network(network, channel),
+ %Nola.Irc.Connection{} <- Nola.Irc.Connection.get_network(network, channel),
room = [visibility: :public, room_alias_name: localpart, name: if(network == "random", do: channel, else: "#{network}/#{channel}")],
{:ok, %{"room_id" => room_id}} <- Client.Room.create_room(client(), room) do
Logger.info("Matrix: created room #{room_alias} #{room_id}")
diff --git a/lib/nola/account.ex b/lib/nola/account.ex
index 31e237c..47e46b8 100644
--- a/lib/nola/account.ex
+++ b/lib/nola/account.ex
@@ -137,8 +137,8 @@ defmodule Nola.Account do
:dets.delete(file("db"), old_id)
Nola.Membership.merge_account(old_id, new_id)
Nola.UserTrack.merge_account(old_id, new_id)
- IRC.Connection.dispatch("account", {:account_change, old_id, new_id})
- IRC.Connection.dispatch("conn", {:account_change, old_id, new_id})
+ Nola.Irc.Connection.dispatch("account", {:account_change, old_id, new_id})
+ Nola.Irc.Connection.dispatch("conn", {:account_change, old_id, new_id})
end
:ok
end
@@ -174,7 +174,7 @@ defmodule Nola.Account do
def lookup(something, make_default \\ true) do
account = do_lookup(something, make_default)
if account && Map.get(something, :nick) do
- IRC.Connection.dispatch("account", {:account_auth, Map.get(something, :nick), account.id})
+ Nola.Irc.Connection.dispatch("account", {:account_auth, Map.get(something, :nick), account.id})
end
account
end
diff --git a/lib/nola/user_track.ex b/lib/nola/user_track.ex
index 720fb58..f6a02ae 100644
--- a/lib/nola/user_track.ex
+++ b/lib/nola/user_track.ex
@@ -189,7 +189,7 @@ defmodule Nola.UserTrack do
user
end
- IRC.Connection.publish_event(network, %{type: :connect, user_id: user.id, account_id: user.account})
+ Nola.Irc.Connection.publish_event(network, %{type: :connect, user_id: user.id, account_id: user.account})
:ok
else
:error
@@ -220,7 +220,7 @@ defmodule Nola.UserTrack do
:ets.insert(ets, User.to_tuple(user))
end)
- IRC.Connection.publish_event({sender.network, channel}, %{type: :join, user_id: user.id, account_id: user.account})
+ Nola.Irc.Connection.publish_event({sender.network, channel}, %{type: :join, user_id: user.id, account_id: user.account})
user
end
@@ -262,7 +262,7 @@ defmodule Nola.UserTrack do
user = %User{user | nick: new_nick, account: account.id, nicks: [old_nick|user.nicks]}
Storage.insert(User.to_tuple(user))
channels = for {channel, _} <- user.privileges, do: channel
- IRC.Connection.publish_event(network, %{type: :nick, user_id: user.id, account_id: account.id, nick: new_nick, old_nick: old_nick})
+ Nola.Irc.Connection.publish_event(network, %{type: :nick, user_id: user.id, account_id: account.id, nick: new_nick, old_nick: old_nick})
end
end
@@ -275,7 +275,7 @@ defmodule Nola.UserTrack do
user = %User{user | privileges: Map.put(user.privileges, channel, privs)}
Storage.insert(User.to_tuple(user))
- IRC.Connection.publish_event({network, channel}, %{type: :privileges, user_id: user.id, account_id: user.account, added: add, removed: remove})
+ Nola.Irc.Connection.publish_event({network, channel}, %{type: :privileges, user_id: user.id, account_id: user.account, added: add, removed: remove})
end
end
@@ -295,9 +295,9 @@ defmodule Nola.UserTrack do
if Enum.count(privs) > 0 do
user = %User{user | privileges: privs}
Storage.insert(User.to_tuple(user))
- IRC.Connection.publish_event({network, channel}, %{type: :part, user_id: user.id, account_id: user.account, reason: nil})
+ Nola.Irc.Connection.publish_event({network, channel}, %{type: :part, user_id: user.id, account_id: user.account, reason: nil})
else
- IRC.Connection.publish_event(network, %{type: :quit, user_id: user.id, account_id: user.account, reason: "Left all known channels"})
+ Nola.Irc.Connection.publish_event(network, %{type: :quit, user_id: user.id, account_id: user.account, reason: "Left all known channels"})
Storage.delete(user.id)
end
end
@@ -309,7 +309,7 @@ defmodule Nola.UserTrack do
for {channel, _} <- user.privileges do
Nola.Membership.touch(user.account, sender.network, channel)
end
- IRC.Connection.publish_event(sender.network, %{type: :quit, user_id: user.id, account_id: user.account, reason: reason})
+ Nola.Irc.Connection.publish_event(sender.network, %{type: :quit, user_id: user.id, account_id: user.account, reason: reason})
end
Storage.delete(user.id)
end
diff --git a/lib/plugins/alcoolog.ex b/lib/plugins/alcoolog.ex
index 41b5a4f..28723d0 100644
--- a/lib/plugins/alcoolog.ex
+++ b/lib/plugins/alcoolog.ex
@@ -429,7 +429,7 @@ defmodule Nola.Plugins.Alcoolog do
user = Nola.UserTrack.find_by_account(net, m.account)
nick = if(user, do: user.nick, else: m.account.name)
extra = " " <> present_type(name, comment) <> ""
- IRC.Connection.broadcast_message(net, chan, msg.(nick, extra))
+ Nola.Irc.Connection.broadcast_message(net, chan, msg.(nick, extra))
end
miss = cond do
@@ -454,7 +454,7 @@ defmodule Nola.Plugins.Alcoolog do
for {net, chan} <- Nola.Membership.notify_channels(m.account) do
user = Nola.UserTrack.find_by_account(net, m.account)
nick = if(user, do: user.nick, else: m.account.name)
- IRC.Connection.broadcast_message(net, chan, "#{nick}: #{miss}")
+ Nola.Irc.Connection.broadcast_message(net, chan, "#{nick}: #{miss}")
end
end
end
@@ -853,7 +853,7 @@ defmodule Nola.Plugins.Alcoolog do
for {net, chan} <- notify do
user = Nola.UserTrack.find_by_account(net, m.account)
nick = if(user, do: user.nick, else: m.account.name)
- IRC.Connection.broadcast_message(net, chan, "#{nick} -santai #{points} #{type} #{descr}")
+ Nola.Irc.Connection.broadcast_message(net, chan, "#{nick} -santai #{points} #{type} #{descr}")
end
{:noreply, state}
_ ->
diff --git a/lib/plugins/alcoolog_announcer.ex b/lib/plugins/alcoolog_announcer.ex
index 937002e..f172d85 100644
--- a/lib/plugins/alcoolog_announcer.ex
+++ b/lib/plugins/alcoolog_announcer.ex
@@ -95,12 +95,12 @@ defmodule Nola.Plugins.AlcoologAnnouncer do
{:timed, list} ->
spawn(fn() ->
for line <- list do
- IRC.Connection.broadcast_message("evolu.net", "#dmz", line)
+ Nola.Irc.Connection.broadcast_message("evolu.net", "#dmz", line)
:timer.sleep(:timer.seconds(5))
end
end)
string ->
- IRC.Connection.broadcast_message("evolu.net", "#dmz", string)
+ Nola.Irc.Connection.broadcast_message("evolu.net", "#dmz", string)
end
end
@@ -238,7 +238,7 @@ defmodule Nola.Plugins.AlcoologAnnouncer do
for {net, chan} <- Nola.Membership.notify_channels(account) do
user = Nola.UserTrack.find_by_account(net, account)
nick = if(user, do: user.nick, else: account.name)
- IRC.Connection.broadcast_message(net, chan, "#{nick}: #{message}")
+ Nola.Irc.Connection.broadcast_message(net, chan, "#{nick}: #{message}")
end
end
end
diff --git a/lib/plugins/say.ex b/lib/plugins/say.ex
index 9bfe1bd..3df3ac8 100644
--- a/lib/plugins/say.ex
+++ b/lib/plugins/say.ex
@@ -64,7 +64,7 @@ defmodule Nola.Plugins.Say do
if with_nick? do
IRC.send_message_as(account, net, chan, text)
else
- IRC.Connection.broadcast_message(net, chan, text)
+ Nola.Irc.Connection.broadcast_message(net, chan, text)
end
end
end
diff --git a/lib/plugins/sms.ex b/lib/plugins/sms.ex
index a3b7b7d..8dd15ad 100644
--- a/lib/plugins/sms.ex
+++ b/lib/plugins/sms.ex
@@ -17,7 +17,7 @@ defmodule Nola.Plugins.Sms do
Nola.Account.delete_meta(account, "sms-validation-code")
Nola.Account.delete_meta(account, "sms-validation-number")
Nola.Account.delete_meta(account, "sms-validation-target")
- IRC.Connection.broadcast_message(net, account, "SMS Number #{from} added!")
+ Nola.Irc.Connection.broadcast_message(net, account, "SMS Number #{from} added!")
send_sms(from, "Yay! Number linked to account #{account.name}")
end
end
@@ -28,7 +28,7 @@ defmodule Nola.Plugins.Sms do
reply_fun = fn(text) ->
send_sms(from, text)
end
- trigger_text = if Enum.any?(IRC.Connection.triggers(), fn({trigger, _}) -> String.starts_with?(message, trigger) end) do
+ trigger_text = if Enum.any?(Nola.Irc.Connection.triggers(), fn({trigger, _}) -> String.starts_with?(message, trigger) end) do
message
else
"!"<>message
@@ -42,10 +42,10 @@ defmodule Nola.Plugins.Sms do
account: account,
sender: %ExIRC.SenderInfo{nick: account.name},
replyfun: reply_fun,
- trigger: IRC.Connection.extract_trigger(trigger_text)
+ trigger: Nola.Irc.Connection.extract_trigger(trigger_text)
}
Logger.debug("converted sms to message: #{inspect message}")
- IRC.Connection.publish(message, ["messages:sms"])
+ Nola.Irc.Connection.publish(message, ["messages:sms"])
message
end
end
diff --git a/lib/plugins/tell.ex b/lib/plugins/tell.ex
index bc1f24e..b4d05dc 100644
--- a/lib/plugins/tell.ex
+++ b/lib/plugins/tell.ex
@@ -47,7 +47,7 @@ defmodule Nola.Plugins.Tell do
fromnick = if user, do: user.nick, else: account.name
"#{nick}: <#{fromnick}> #{message}"
end)
- Enum.each(strs, fn(s) -> IRC.Connection.broadcast_message(network, channel, s) end)
+ Enum.each(strs, fn(s) -> Nola.Irc.Connection.broadcast_message(network, channel, s) end)
:dets.delete(state.dets, {network, channel, account_id})
end
{:noreply, state}
diff --git a/lib/telegram.ex b/lib/telegram.ex
index 9a2812d..dcd8b1f 100644
--- a/lib/telegram.ex
+++ b/lib/telegram.ex
@@ -57,7 +57,7 @@ defmodule Nola.Telegram do
Nola.Account.put_meta(account, "telegram-username", m["chat"]["username"])
Nola.Account.delete_meta(account, "telegram-validation-code")
Nola.Account.delete_meta(account, "telegram-validation-target")
- IRC.Connection.broadcast_message(net, account, "Telegram #{m["chat"]["username"]} account added!")
+ Nola.Irc.Connection.broadcast_message(net, account, "Telegram #{m["chat"]["username"]} account added!")
"Yay! Linked to account **#{account.name}**."
else
"Token invalid"
@@ -190,7 +190,7 @@ defmodule Nola.Telegram do
String.starts_with?(text, "/") ->
"/"<>text = text
"!"<>text
- Enum.any?(IRC.Connection.triggers(), fn({trigger, _}) -> String.starts_with?(text, trigger) end) ->
+ Enum.any?(Nola.Irc.Connection.triggers(), fn({trigger, _}) -> String.starts_with?(text, trigger) end) ->
text
true ->
"!"<>text
@@ -204,10 +204,10 @@ defmodule Nola.Telegram do
account: account,
sender: %ExIRC.SenderInfo{nick: account.name},
replyfun: reply_fun,
- trigger: IRC.Connection.extract_trigger(trigger_text),
+ trigger: Nola.Irc.Connection.extract_trigger(trigger_text),
at: nil
}
- IRC.Connection.publish(message, ["messages:private", "messages:telegram", "telegram/#{account.id}:messages"])
+ Nola.Irc.Connection.publish(message, ["messages:private", "messages:telegram", "telegram/#{account.id}:messages"])
message
end
diff --git a/lib/telegram/room.ex b/lib/telegram/room.ex
index 8e95ca8..f3c3715 100644
--- a/lib/telegram/room.ex
+++ b/lib/telegram/room.ex
@@ -44,8 +44,8 @@ defmodule Nola.TelegramRoom do
{:ok, tg_room = %{"network" => _net, "channel" => _chan}} -> tg_room
{:error, :not_found} ->
[net, chan] = String.split(chat["title"], "/", parts: 2)
- {net, chan} = case IRC.Connection.get_network(net, chan) do
- %IRC.Connection{} -> {net, chan}
+ {net, chan} = case Nola.Irc.Connection.get_network(net, chan) do
+ %Nola.Irc.Connection{} -> {net, chan}
_ -> {nil, nil}
end
{:ok, _id, _rev} = Couch.post(@couch, %{"_id" => id, "network" => net, "channel" => nil})
@@ -95,14 +95,14 @@ defmodule Nola.TelegramRoom do
def handle_update(%{"message" => %{"from" => from = %{"id" => user_id}, "text" => text}}, _token, state) do
account = find_or_create_meta_account(from, state)
- connection = IRC.Connection.get_network(state.net)
+ connection = Nola.Irc.Connection.get_network(state.net)
IRC.send_message_as(account, state.net, state.chan, text, true)
{:ok, state}
end
def handle_update(data = %{"message" => %{"from" => from = %{"id" => user_id}, "location" => %{"latitude" => lat, "longitude" => lon}}}, _token, state) do
account = find_or_create_meta_account(from, state)
- connection = IRC.Connection.get_network(state.net)
+ connection = Nola.Irc.Connection.get_network(state.net)
IRC.send_message_as(account, state.net, state.chan, "@ #{lat}, #{lon}", true)
{:ok, state}
end
@@ -172,7 +172,7 @@ defmodule Nola.TelegramRoom do
do
path = NolaWeb.Router.Helpers.url(NolaWeb.Endpoint) <> "/files/#{s3path}"
txt = "#{type}: #{text}#{path}"
- connection = IRC.Connection.get_network(state.net)
+ connection = Nola.Irc.Connection.get_network(state.net)
IRC.send_message_as(account, state.net, state.chan, txt, true)
else
error ->
diff --git a/lib/web/context_plug.ex b/lib/web/context_plug.ex
index fcdf42f..0a16340 100644
--- a/lib/web/context_plug.ex
+++ b/lib/web/context_plug.ex
@@ -29,11 +29,11 @@ defmodule NolaWeb.ContextPlug do
oidc_account = Nola.Account.find_meta_account("identity-id", get_session(conn, :oidc_id))
- conns = IRC.Connection.get_network(network)
+ conns = Nola.Irc.Connection.get_network(network)
chan = if c = Map.get(conn.params, "chan") do
NolaWeb.reformat_chan(c)
end
- chan_conn = IRC.Connection.get_network(network, chan)
+ chan_conn = Nola.Irc.Connection.get_network(network, chan)
memberships = if account do
Nola.Membership.of_account(account)
diff --git a/lib/web/controllers/alcoolog_controller.ex b/lib/web/controllers/alcoolog_controller.ex
index 6337da5..8263df1 100644
--- a/lib/web/controllers/alcoolog_controller.ex
+++ b/lib/web/controllers/alcoolog_controller.ex
@@ -190,7 +190,7 @@ defmodule NolaWeb.AlcoologController do
# NolaWeb.reformat_chan(c)
# end
# irc_conn = if network do
- # IRC.Connection.get_network(network, chan)
+ # Nola.Irc.Connection.get_network(network, chan)
# end
# bot = if(irc_conn, do: irc_conn.nick)#
#
diff --git a/lib/web/live/chat_live.ex b/lib/web/live/chat_live.ex
index 3f126f2..f8bab7d 100644
--- a/lib/web/live/chat_live.ex
+++ b/lib/web/live/chat_live.ex
@@ -5,7 +5,7 @@ defmodule NolaWeb.ChatLive do
def mount(%{"network" => network, "chan" => chan}, %{"account" => account_id}, socket) do
chan = NolaWeb.reformat_chan(chan)
- connection = IRC.Connection.get_network(network, chan)
+ connection = Nola.Irc.Connection.get_network(network, chan)
account = Nola.Account.get(account_id)
membership = Nola.Membership.of_account(Nola.Account.get("DRgpD4fLf8PDJMLp8Dtb"))
if account && connection && Enum.member?(membership, {connection.network, chan}) do
@@ -14,7 +14,7 @@ defmodule NolaWeb.ChatLive do
{:ok, _} = Registry.register(Nola.PubSub, "#{connection.network}/#{chan}:#{t}", plugin: __MODULE__)
end
- IRC.PuppetConnection.start(account, connection)
+ Nola.Irc.PuppetConnection.start(account, connection)
users = Nola.UserTrack.channel(connection.network, chan)
|> Enum.map(fn(tuple) -> Nola.UserTrack.User.from_tuple(tuple) end)