Skip to content

Commit 0e3c465

Browse files
committed
made users, channels & commands case insensitive
1 parent f778e81 commit 0e3c465

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

resources/irc/scripts/acl.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ local commands = {}
1313
-- Acl
1414
------------------------------------
1515
function func_addIRCCommandHandler (cmd,fn,level,echochanonly)
16-
if not acl[cmd] then
17-
acl[cmd] = {name = cmd,level = level,echoChannelOnly = echochannelonly}
16+
if not acl[string.lower(cmd)] then
17+
acl[string.lower(cmd)] = {name = string.lower(cmd),level = level,echoChannelOnly = echochannelonly}
1818
end
19-
commands[cmd] = fn
19+
commands[string.lower(cmd)] = fn
2020
return true
2121
end
2222

@@ -45,7 +45,7 @@ end
4545
addEvent("onIRCMessage")
4646
addEventHandler("onIRCMessage",root,
4747
function (channel,message)
48-
local cmd = gettok(message,1,32)
48+
local cmd = string.lower(gettok(message,1,32))
4949
local args = split(message,32)
5050
if commands[cmd] and acl[cmd] and acl[cmd].level and (tonumber(acl[cmd].level) or 0) <= (tonumber(ircGetUserLevel(source,channel)) or 0) then
5151
if ircIsCommandEchoChannelOnly(cmd) then

resources/irc/scripts/channels.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ channels = {} -- syntax: [channel] = {string name,string mode,string topic,table
1414
------------------------------------
1515
function func_ircGetChannelFromName (channel)
1616
for i,chan in ipairs (ircGetChannels()) do
17-
if ircGetChannelName(chan) == channel then
17+
if string.lower(ircGetChannelName(chan)) == string.lower(channel) then
1818
return chan
1919
end
2020
end

resources/irc/scripts/users.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ end
6565

6666
function func_ircGetUserFromNick (nick)
6767
for i,user in ipairs (ircGetUsers()) do
68-
if ircGetUserNick(user) == nick then
68+
if string.lower(ircGetUserNick(user)) == string.lower(nick) then
6969
return user
7070
end
7171
end

0 commit comments

Comments
 (0)