summaryrefslogtreecommitdiff
path: root/lib/lsg
diff options
context:
space:
mode:
authorhref <href@random.sh>2021-09-02 09:56:32 +0200
committerhref <href@random.sh>2021-09-02 09:56:32 +0200
commit9b6d97fb820d2efc6892b0ada3340df10df35f4b (patch)
tree6d7200c07e610a2ae56128cf716e4ffda18d9d9e /lib/lsg
parentweb: show help for only enabled plugins (diff)
puppet connections
Diffstat (limited to '')
-rw-r--r--lib/lsg/telegram_room.ex6
-rw-r--r--lib/lsg_irc.ex1
-rw-r--r--lib/lsg_irc/say_plugin.ex10
3 files changed, 9 insertions, 8 deletions
diff --git a/lib/lsg/telegram_room.ex b/lib/lsg/telegram_room.ex
index 8c228e1..f973c58 100644
--- a/lib/lsg/telegram_room.ex
+++ b/lib/lsg/telegram_room.ex
@@ -22,10 +22,8 @@ defmodule LSG.TelegramRoom do
def handle_update(%{"message" => %{"from" => %{"id" => user_id}, "text" => text}}, _token, state) do
account = IRC.Account.find_meta_account("telegram-id", user_id)
- user = IRC.UserTrack.find_by_account(state.net, account)
- nick = if(user, do: user.nick, else: account.name)
- prefix = "<#{nick}> "
- IRC.Connection.broadcast_message(state.net, state.chan, "#{prefix}#{text}")
+ connection = IRC.Connection.get_network(state.net)
+ IRC.PuppetConnection.send_message(account, connection, state.chan, text)
{:ok, state}
end
diff --git a/lib/lsg_irc.ex b/lib/lsg_irc.ex
index ba0828a..c2782ad 100644
--- a/lib/lsg_irc.ex
+++ b/lib/lsg_irc.ex
@@ -21,6 +21,7 @@ defmodule LSG.IRC do
worker(IRC.Account.AccountPlugin, []),
supervisor(IRC.Plugin.Supervisor, [], [name: IRC.Plugin.Supervisor]),
supervisor(IRC.Connection.Supervisor, [], [name: IRC.Connection.Supervisor]),
+ supervisor(IRC.PuppetConnection.Supervisor, [], [name: IRC.PuppetConnection.Supervisor]),
]
end
diff --git a/lib/lsg_irc/say_plugin.ex b/lib/lsg_irc/say_plugin.ex
index 690d0a6..c385e77 100644
--- a/lib/lsg_irc/say_plugin.ex
+++ b/lib/lsg_irc/say_plugin.ex
@@ -61,10 +61,12 @@ defmodule LSG.IRC.SayPlugin do
for {net, chan} <- IRC.Membership.of_account(account) do
chan2 = String.replace(chan, "#", "")
if (target == "#{net}/#{chan}" || target == "#{net}/#{chan2}" || target == chan || target == chan2) do
- user = IRC.UserTrack.find_by_account(net, account)
- nick = if(user, do: user.nick, else: account.name)
- prefix = if(with_nick?, do: "<#{nick}> ", else: "")
- IRC.Connection.broadcast_message(net, chan, "#{prefix}#{text}")
+ if with_nick? do
+ connection = IRC.Connection.get_network(net)
+ IRC.PuppetConnection.send_message(account, connection, chan, text)
+ else
+ IRC.Connection.broadcast_message(net, chan, text)
+ end
end
end
end