summaryrefslogtreecommitdiff
path: root/lib/lsg
diff options
context:
space:
mode:
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