]> jfr.im git - irc/quakenet/newserv.git/blob - lua/lib/quakenet.lua
LUA: Add lua stdlib.
[irc/quakenet/newserv.git] / lua / lib / quakenet.lua
1 require("lib/quakenet/access")
2 require("lib/quakenet/iterators")
3 require("lib/quakenet/legacy")
4 require("lib/quakenet/achievements")
5
6 function chanmsg(a)
7 irc_smsg(a, "#qnet.keepout")
8 end
9
10 function crapchanmsg(a)
11 irc_smsg(a, "#qnet.trj")
12 end
13
14 function statusmsg(a)
15 irc_smsg("dd," .. a, "#qnet.keepout")
16 end
17
18 function chanmsgn(t)
19 string.gsub(t, "[^\r\n]+", chanmsg)
20 end
21
22 function noticen(n, t)
23 string.gsub(t, "[^\r\n]+", function(s) irc_notice(n, s) end);
24 end
25
26 local irc_localrealovmode = irc_localovmode;
27
28 function irc_localovmode(source, chan, ...)
29 if type(...) == 'table' then
30 irc_localrealovmode(source, chan, ...)
31 else
32 irc_localrealovmode(source, chan, { ... })
33 end
34 end
35
36 function irc_localaction(n, c, m)
37 irc_localchanmsg(n, c, string.char(1) .. "ACTION " .. m .. string.char(1))
38 end
39
40 function irctolower(l)
41 l = l:lower()
42 l = l:gsub("%[", "{")
43 l = l:gsub("%]", "}")
44 l = l:gsub("\\", "|")
45 l = l:gsub("%^", "~")
46 return l
47 end
48
49 function irc_localregisteruser(nickname, ident, hostname, realname, account, usermodes, handler_function)
50 return irc_localregisteruserid(nickname, ident, hostname, realname, account, 0, usermodes, handler_function)
51 end