From 1d4fd5a162da4341f5702cc1b7f764a43798cbea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Diego=20Mart=C3=ADnez?= <kaeza@users.noreply.github.com>
Date: Fri, 24 Mar 2017 22:33:43 -0300
Subject: [PATCH] Better method to avoid impersonation.

---
 hooks.lua | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hooks.lua b/hooks.lua
index 564bb44..8a4bf97 100644
--- a/hooks.lua
+++ b/hooks.lua
@@ -104,8 +104,9 @@ function irc.hooks.channelChat(msg)
 	irc:check_botcmd(msg)
 
 	-- Don't let a user impersonate someone else by using the nick "IRC"
-	if msg.user.nick == "IRC" then
-		irc.sendLocal("<IRC@IRC> "..text)
+	local fake = msg.user.nick:lower():match("^[il|]rc$")
+	if fake then
+		irc.sendLocal("<"..msg.user.nick.."@IRC> "..text)
 		return
 	end
 
-- 
GitLab