Fix routing bug in IRC and base plugin
Previously, messages were only routed from IRC if they were *not* for the current user. This should only be happening for privmsg messages, since a plugin is generally aware of what it's sending out. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -77,9 +77,8 @@ defmodule Omnibot.Irc do
|
|||||||
msg = Msg.parse(line)
|
msg = Msg.parse(line)
|
||||||
|
|
||||||
# Send the message to the router
|
# Send the message to the router
|
||||||
if (!msg.prefix) || (msg.prefix.nick != State.cfg().nick) do
|
|
||||||
route_msg(self(), msg)
|
route_msg(self(), msg)
|
||||||
end
|
|
||||||
{:noreply, socket}
|
{:noreply, socket}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ defmodule Omnibot.Plugin.Base do
|
|||||||
nick = msg.prefix.nick
|
nick = msg.prefix.nick
|
||||||
case String.upcase(msg.command) do
|
case String.upcase(msg.command) do
|
||||||
"PRIVMSG" ->
|
"PRIVMSG" ->
|
||||||
|
if (!msg.prefix) || (msg.prefix.nick != Omnibot.State.cfg().nick) do
|
||||||
[channel | params] = msg.params
|
[channel | params] = msg.params
|
||||||
line = Enum.join(params, " ")
|
line = Enum.join(params, " ")
|
||||||
|
|
||||||
@@ -53,7 +54,7 @@ defmodule Omnibot.Plugin.Base do
|
|||||||
else: on_channel_msg(irc, channel, nick, line)
|
else: on_channel_msg(irc, channel, nick, line)
|
||||||
_ -> on_channel_msg(irc, channel, nick, line)
|
_ -> on_channel_msg(irc, channel, nick, line)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
"JOIN" ->
|
"JOIN" ->
|
||||||
[channel | _] = msg.params
|
[channel | _] = msg.params
|
||||||
on_join(irc, channel, nick)
|
on_join(irc, channel, nick)
|
||||||
|
|||||||
Reference in New Issue
Block a user