diff options
Diffstat (limited to 'lib/irc')
-rw-r--r-- | lib/irc/connection.ex | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/irc/connection.ex b/lib/irc/connection.ex index 0980262..fcb6c5e 100644 --- a/lib/irc/connection.ex +++ b/lib/irc/connection.ex @@ -279,9 +279,17 @@ defmodule IRC.Connection do # Received something in a channel def handle_info({:received, text, sender, chan}, state) do - user = IRC.UserTrack.find_by_nick(state.network, sender.nick) + user = if user = IRC.UserTrack.find_by_nick(state.network, sender.nick) do + user + else + Logger.error("Could not lookup user for message: #{inspect {state.network, chan, sender.nick}}") + user = IRC.UserTrack.joined(chan, sender, []) + ExIRC.Client.who(state.client, chan) # Rewho everything in case of need ? We shouldn't not know that user.. + user + end if !user do - Logger.error("Could not lookup user for message: #{inspect {state.network, sender.nick}}") + ExIRC.Client.who(state.client, chan) # Rewho everything in case of need ? We shouldn't not know that user.. + Logger.error("Could not lookup user nor create it for message: #{inspect {state.network, chan, sender.nick}}") else if !Map.get(user.options, :puppet) do reply_fun = fn(text) -> irc_reply(state, {chan, sender}, text) end |