Added /j /p /w and ctcpreply hook for TIME.

master
Tomatix 4 years ago
parent 856b18d60c
commit bdc2f56593
  1. 93
      Essentials.iis

@ -3,6 +3,58 @@
# (Map) Used if we try to ban someone but we haven't registered their hostname yet. # (Map) Used if we try to ban someone but we haven't registered their hostname yet.
global banqueue, kickqueue; global banqueue, kickqueue;
command j(channel, key)
{
if (channel == void) {
/echo Usage: /j channel
return;
}
if (channel[0] != "#")
channel = "#" + channel;
if (key == void)
/join %channel
else
/join %channel %key
}
command p(channel, message)
{
if (channel == void) {
if (subwintype() == "Channel") {
channel = subwinname();
}
else {
/echo -G /p: Not in a channel. Try /p channel
return;
}
}
if (channel[0] != "#")
channel = "#" + channel;
if (message == void)
/part %channel
else
/part %channel %message
}
command w(nickname) /whois %nickname
hook ctcprequest(sender, target, command, message)
{
# For simplicity, set following to "false" if this is undesirable:
response_CTCP_TIME = true;
/echo ctcp: %sender %target %command %message
if (command == "TIME" && response_CTCP_TIME) {
t = now("yyyy/MM/dd hh:mm:ss t");
/ctcpreply %sender TIME %t
}
}
hook start() hook start()
{ {
# Queue for host lookup if a ban is issued, but hostname is unknown. # Queue for host lookup if a ban is issued, but hostname is unknown.
@ -244,6 +296,10 @@ menu memberlist {
} }
} }
#
# Used as a callback when trying to ban someone we don't know the hostname of,
# and this numeric responds with a hostname to ban.
#
hook numeric(code, args, msg) hook numeric(code, args, msg)
{ {
if (code == "302") { if (code == "302") {
@ -280,24 +336,23 @@ hook numeric(code, args, msg)
# #
function privilege(channel, action, mode, members) function privilege(channel, action, mode, members)
{ {
maxmodes = toint(isupport("MODES")); maxmodes = toint(isupport("MODES"));
totalmodes = maplen(&members); totalmodes = maplen(&members);
i = 0; i = 0;
while (i < totalmodes) { while (i < totalmodes) {
modelen = maxmodes; modelen = maxmodes;
if ((totalmodes - i) < maxmodes) if ((totalmodes - i) < maxmodes)
modelen = totalmodes - i; modelen = totalmodes - i;
j = i; j = i;
nicks = ""; nicks = "";
while (j < (i + modelen)) { while (j < (i + modelen)) {
nicks = nicks + members[j] + " "; nicks = nicks + members[j] + " ";
j = j + 1; j = j + 1;
} }
modestr = action + strrep(mode, modelen);
/mode %channel %modestr %nicks
i = i + modelen;
}
modestr = action + strrep(mode, modelen);
/mode %channel %modestr %nicks
i = i + modelen;
}
} }

Loading…
Cancel
Save