Skip to content

Commit fc173f2

Browse files
committed
some updates
1 parent 98d3305 commit fc173f2

24 files changed

+304
-637
lines changed

resources/irc/meta.xml

Lines changed: 63 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -56,82 +56,78 @@
5656
</settings>
5757

5858
<!-- Don't touch anything below! -->
59-
<info author="MCvarial" version="1.0.1" type="misc" name="irc" description="Echobot to be used on irc" />
59+
<info author="MCvarial" version="1.0.2" type="misc" name="irc" description="Echobot to be used on irc" />
6060

61-
<export function="ircHop" type="server" http="false" />
62-
<export function="ircSay" type="server" http="false" />
63-
<export function="ircRaw" type="server" http="false" />
64-
<export function="ircPart" type="server" http="false" />
65-
<export function="ircJoin" type="server" http="false" />
66-
<export function="ircAction" type="server" http="false" />
67-
<export function="ircNotice" type="server" http="false" />
68-
<export function="outputIRC" type="server" http="false" />
69-
<export function="ircConnect" type="server" http="false" />
70-
<export function="ircIdentify" type="server" http="false" />
71-
<export function="ircReconnect" type="server" http="false" />
72-
<export function="ircDisconnect" type="server" http="false" />
73-
<export function="ircChangeNick" type="server" http="false" />
61+
<export function="ircHop" type="server" http="false" />
62+
<export function="ircSay" type="server" http="false" />
63+
<export function="ircRaw" type="server" http="false" />
64+
<export function="ircPart" type="server" http="false" />
65+
<export function="ircJoin" type="server" http="false" />
66+
<export function="ircAction" type="server" http="false" />
67+
<export function="ircNotice" type="server" http="false" />
68+
<export function="outputIRC" type="server" http="false" />
69+
<export function="ircConnect" type="server" http="false" />
70+
<export function="ircIdentify" type="server" http="false" />
71+
<export function="ircReconnect" type="server" http="false" />
72+
<export function="ircDisconnect" type="server" http="false" />
73+
<export function="ircChangeNick" type="server" http="false" />
7474

75-
<export function="ircGetServers" type="server" http="false" />
76-
<export function="ircGetServerName" type="server" http="false" />
77-
<export function="ircGetServerHost" type="server" http="false" />
78-
<export function="ircGetServerPort" type="server" http="false" />
79-
<export function="ircGetServerPass" type="server" http="false" />
80-
<export function="ircGetServerNick" type="server" http="false" />
81-
<export function="ircIsServerSecure" type="server" http="false" />
82-
<export function="ircGetServerChannels" type="server" http="false" />
75+
<export function="ircGetServers" type="server" http="false" />
76+
<export function="ircGetServerName" type="server" http="false" />
77+
<export function="ircGetServerHost" type="server" http="false" />
78+
<export function="ircGetServerPort" type="server" http="false" />
79+
<export function="ircGetServerPass" type="server" http="false" />
80+
<export function="ircGetServerNick" type="server" http="false" />
81+
<export function="ircIsServerSecure" type="server" http="false" />
82+
<export function="ircGetServerChannels" type="server" http="false" />
8383

84-
<export function="ircGetChannelServer" type="server" http="false" />
85-
<export function="ircSetChannels" type="server" http="false" />
86-
<export function="ircSetChannelMode" type="server" http="false" />
87-
<export function="ircGetChannelName" type="server" http="false" />
88-
<export function="ircGetChannelMode" type="server" http="false" />
89-
<export function="ircGetChannelUsers" type="server" http="false" />
90-
<export function="ircGetChannelTopic" type="server" http="false" />
91-
<export function="ircGetChannelFromName" type="server" http="false" />
92-
<export function="ircIsEchoChannel" type="server" http="false" />
84+
<export function="ircGetChannelServer" type="server" http="false" />
85+
<export function="ircSetChannels" type="server" http="false" />
86+
<export function="ircSetChannelMode" type="server" http="false" />
87+
<export function="ircGetChannelName" type="server" http="false" />
88+
<export function="ircGetChannelMode" type="server" http="false" />
89+
<export function="ircGetChannelUsers" type="server" http="false" />
90+
<export function="ircGetChannelTopic" type="server" http="false" />
91+
<export function="ircGetChannelFromName" type="server" http="false" />
92+
<export function="ircIsEchoChannels" type="server" http="false" />
9393

94-
<export function="ircSetUserMode" type="server" http="false" />
95-
<export function="ircGetUserMode" type="server" http="false" />
96-
<export function="ircIsUserBot" type="server" http="false" />
97-
<export function="ircGetUserNick" type="server" http="false" />
98-
<export function="ircGetUsers" type="server" http="false" />
99-
<export function="ircGetUserServer" type="server" http="false" />
100-
<export function="ircGetUserLevel" type="server" http="false" />
101-
<export function="ircGetUserVhost" type="server" http="false" />
102-
<export function="ircIsUserSecure" type="server" http="false" />
103-
<export function="ircGetUserFromName" type="server" http="false" />
104-
<export function="ircGetUserRealName" type="server" http="false" />
105-
<export function="ircGetUserChannels" type="server" http="false" />
94+
<export function="ircSetUserMode" type="server" http="false" />
95+
<export function="ircGetUserMode" type="server" http="false" />
96+
<export function="ircGetUserNick" type="server" http="false" />
97+
<export function="ircGetUsers" type="server" http="false" />
98+
<export function="ircGetUserServer" type="server" http="false" />
99+
<export function="ircGetUserLevel" type="server" http="false" />
100+
<export function="ircGetUserVhost" type="server" http="false" />
101+
<export function="ircGetUserFromName" type="server" http="false" />
106102

107-
<export function="addIRCCommandHandler" type="server" http="false" />
108-
<export function="ircGetCommands" type="server" http="false" />
109-
<export function="ircGetCommandLevel" type="server" http="false" />
103+
<export function="addIRCCommandHandler" type="server" http="false" />
104+
<export function="ircGetCommands" type="server" http="false" />
105+
<export function="ircGetCommandLevel" type="server" http="false" />
110106
<export function="ircIsCommandEchoChannelOnly" type="server" http="false" />
111107

112108
<!-- Don't touch this, you might break it. -->
113-
<script src="scripts/socketerrors.lua" type="server" />
114-
<script src="scripts/loading.lua" type="server" />
115-
<script src="scripts/utility.lua" type="server" />
116-
<script src="scripts/channels.lua" type="server" />
117-
<script src="scripts/logging.lua" type="server" />
118-
<script src="scripts/servers.lua" type="server" />
119-
<script src="scripts/users.lua" type="server" />
120-
<script src="scripts/handling.lua" type="server" />
121-
<script src="scripts/commands.lua" type="server" />
122-
<script src="scripts/levels.lua" type="server" />
123-
<script src="scripts/acl.lua" type="server" />
124-
<script src="scripts/ads.lua" type="client" />
125-
<script src="scripts/echo.lua" type="server" />
126-
<script src="scripts/irccommands.lua" type="server" />
127-
<script src="scripts/mutes.lua" type="server" />
128-
<script src="scripts/ircclient_server.lua" type="server" />
129-
<script src="scripts/ircclient_client.lua" type="client" />
109+
<script src="scripts/socketerrors.lua" type="server" />
110+
<script src="scripts/loading.lua" type="server" />
111+
<script src="scripts/utility.lua" type="server" />
112+
<script src="scripts/channels.lua" type="server" />
113+
<script src="scripts/logging.lua" type="server" />
114+
<script src="scripts/servers.lua" type="server" />
115+
<script src="scripts/users.lua" type="server" />
116+
<script src="scripts/handling.lua" type="server" />
117+
<script src="scripts/commands.lua" type="server" />
118+
<script src="scripts/levels.lua" type="server" />
119+
<script src="scripts/acl.lua" type="server" />
120+
<script src="scripts/ads.lua" type="client" />
121+
<script src="scripts/echo.lua" type="server" />
122+
<script src="scripts/irccommands.lua" type="server" />
123+
<script src="scripts/mutes.lua" type="server" />
124+
<script src="scripts/ircclient_server.lua" type="server" />
125+
<script src="scripts/ircclient_client.lua" type="client" />
130126

131-
<script src="scripts/runcode/server.lua" type="server" />
132-
<script src="scripts/runcode/server_util.lua" type="server" />
133-
<script src="scripts/runcode/client.lua" type="client" />
134-
<script src="scripts/runcode/client_util.lua" type="client" />
127+
<script src="scripts/runcode/server.lua" type="server" />
128+
<script src="scripts/runcode/server_util.lua" type="server" />
129+
<script src="scripts/runcode/client.lua" type="client" />
130+
<script src="scripts/runcode/client_util.lua" type="client" />
135131

136132
<html src="logs.html" />
137133
</meta>

resources/irc/scripts/acl.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
-- Project: irc
33
-- Author: MCvarial
44
-- Contact: [email protected]
5-
-- Version: 1.0.0
5+
-- Version: 1.0.2
66
-- Date: 31.10.2010
77
---------------------------------------------------------------------
88

@@ -13,14 +13,17 @@ local commands = {}
1313
-- Acl
1414
------------------------------------
1515
function func_addIRCCommandHandler (cmd,fn,level,echochanonly)
16+
if not level then level = 0 end
17+
if not echochanonly then echochanonly = true end
1618
if not acl[string.lower(cmd)] then
1719
acl[string.lower(cmd)] = {name = string.lower(cmd),level = level,echoChannelOnly = echochannelonly}
1820
end
1921
commands[string.lower(cmd)] = fn
2022
return true
2123
end
24+
registerFunction("addIRCCommandHandler","func_addIRCCommandHandler","string","function","(number)","(boolean)")
2225

23-
function func_ircGetCommands ()
26+
function ircGetCommands ()
2427
local cmds = {}
2528
for cmd,fn in pairs (commands) do
2629
table.insert(cmds,cmd)
@@ -34,13 +37,15 @@ function func_ircGetCommandLevel (cmd)
3437
end
3538
return false
3639
end
40+
registerFunction("ircGetCommandLevel","func_ircGetCommandLevel","string")
3741

3842
function func_ircIsCommandEchoChannelOnly (cmd)
3943
if acl[cmd] then
4044
return acl[cmd].echoChannelOnly
4145
end
4246
return false
4347
end
48+
registerFunction("ircIsCommandEchoChannelOnly","func_ircIsCommandEchoChannelOnly","string")
4449

4550
addEvent("onIRCMessage")
4651
addEventHandler("onIRCMessage",root,

resources/irc/scripts/ads.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
-- Project: irc
33
-- Author: MCvarial
44
-- Contact: [email protected]
5-
-- Version: 1.0.0
5+
-- Version: 1.0.2
66
-- Date: 31.10.2010
77
---------------------------------------------------------------------
88

resources/irc/scripts/channels.lua

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
-- Project: irc
33
-- Author: MCvarial
44
-- Contact: [email protected]
5-
-- Version: 1.0.0
5+
-- Version: 1.0.2
66
-- Date: 31.10.2010
77
---------------------------------------------------------------------
88

@@ -20,74 +20,62 @@ function func_ircGetChannelFromName (channel)
2020
end
2121
return false
2222
end
23+
registerFunction("ircGetChannelFromName","func_ircGetChannelFromName","string")
2324

24-
function func_ircGetEchoChannel ()
25+
function ircGetEchoChannels ()
26+
local channels = {}
2527
for i,channel in ipairs (ircGetChannels()) do
2628
if ircIsEchoChannel(channel) then
27-
return channel
29+
table.insert(channels,channel)
2830
end
2931
end
30-
return false
32+
return channels
3133
end
3234

3335
function func_ircGetChannelServer (channel)
34-
if channels[channel] then
35-
return getElementParent(channel)
36-
end
37-
return false
36+
return getElementParent(channel)
3837
end
38+
registerFunction("ircGetChannelServer","func_ircGetChannelServer","irc-channel")
3939

40-
function func_ircGetChannels (server)
40+
function ircGetChannels (server)
4141
if servers[server] then
4242
local channels = {}
4343
for i,channels in ipairs (ircGetChannels()) do
4444
if ircGetChannelServer(channel) == server then
4545
table.insert(channels,channel)
4646
end
4747
end
48-
return channel
48+
return channels
4949
end
5050
return getElementsByType("irc-channel")
5151
end
5252

5353
function func_ircSetChannelMode (channel,mode)
54-
if channels[channel] and type(mode) == "string" then
55-
return ircRaw(getElementParent(channel),"MODE "..channels[channel][1].." :"..mode)
56-
end
57-
return false
54+
return ircRaw(getElementParent(channel),"MODE "..channels[channel][1].." :"..mode)
5855
end
56+
registerFunction("ircSetChannelMode","func_ircSetChannelMode","irc-channel","string")
5957

6058
function func_ircGetChannelName (channel)
61-
if channels[channel] then
62-
return channels[channel][1]
63-
end
64-
return false
59+
return channels[channel][1]
6560
end
61+
registerFunction("ircGetChannelName","func_ircGetChannelName","irc-channel")
6662

6763
function func_ircGetChannelMode (channel)
68-
if channels[channel] then
69-
return channels[channel][2]
70-
end
71-
return false
64+
return channels[channel][2]
7265
end
66+
registerFunction("ircGetChannelMode","func_ircGetChannelMode","irc-channel")
7367

7468
function func_ircGetChannelUsers (channel)
75-
if channels[channel] then
76-
return channels[channel][4]
77-
end
78-
return false
69+
return channels[channel][4]
7970
end
71+
registerFunction("ircGetChannelUsers","func_ircGetChannelUsers","irc-channel")
8072

8173
function func_ircGetChannelTopic (channel)
82-
if channels[channel] then
83-
return channels[channel][3]
84-
end
85-
return false
74+
return channels[channel][3]
8675
end
76+
registerFunction("ircGetChannelTopic","func_ircGetChannelTopic","irc-channel")
8777

8878
function func_ircIsEchoChannel (channel)
89-
if channels[channel] then
90-
return channels[channel][7]
91-
end
92-
return false
93-
end
79+
return channels[channel][7]
80+
end
81+
registerFunction("ircIsEchoChannel","func_ircIsEchoChannel","irc-channel")

resources/irc/scripts/client.lua

Lines changed: 0 additions & 17 deletions
This file was deleted.

resources/irc/scripts/commands.lua

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
-- Author: MCvarial
44
-- Contact: [email protected]
55
-- Version: 1.0.0
6-
-- Date: 31.10.2010
6+
-- Date: 31.10.2012
77
---------------------------------------------------------------------
88

99
------------------------------------
@@ -54,17 +54,6 @@ addCommandHandler("ircsay",
5454
end
5555
)
5656

57-
addCommandHandler("levels",
58-
function (source)
59-
if source ~= getElementsByType("console")[1] then return end
60-
local users = ircGetUsers()
61-
for i,user in ipairs (users) do
62-
users[i] = ircGetUserNick(user).." ("..(ircGetUserLevel(user,ircGetEchoChannel()) or "?")..")"
63-
end
64-
outputServerLog("IRC: users: "..table.concat(users,", "))
65-
end
66-
)
67-
6857
addCommandHandler("level",
6958
function (source,cmd,username,channelname)
7059
if source ~= getElementsByType("console")[1] then return end

0 commit comments

Comments
 (0)