I cant seem to figure out what to bind to, I tried using:
Code: Select all
BOT
bind bot <flags> <command> <proc>
proc-name <from-bot> <command> <text>
Description: triggered by a message coming from another bot in the botnet. The first word is the command and the rest becomes the text argument; flags are ignored.
Module: core
But the bot didnt return anything with this code:
Code: Select all
bind bot - * randomprocname
proc randomprocname { from cmd text } {
putlog "FROM: $from CMD: $cmd TEXT: $text"
}
Code: Select all
[17:14] BotA: cancel ban *!*@exezic.users.quakenet.org on #dota.no
which I received on another bot in the botnet (BotB), which was running the script...
Any ideas?
Maybe it's something about the bind I'm missing, considering it's not stackable... Maybe it should be bound to something. But I'm not sure what the <command> is...
On a sidenote; I have access to compiling the bot myself. So if you could point out what I would need to do to make the bot detect whenever a ban expire, that would do aswell
Ok, so I figured out it wasn't actually in src/mod/irc.mod/irc.c function. It was actually in src/mod/channels.mod/userchan.c
I also found my way to the code:
Code: Select all
/* Check for expired timed-bans.
*/
static void check_expired_bans(void)
{
maskrec *u, *u2;
struct chanset_t *chan;
masklist *b;
for (u = global_bans; u; u = u2) {
u2 = u->next;
if (!(u->flags & MASKREC_PERM) && (now >= u->expire)) {
putlog(LOG_MISC, "*", "%s %s (%s)", BANS_NOLONGER, u->mask, MISC_EXPIRED);
for (chan = chanset; chan; chan = chan->next)
for (b = chan->channel.ban; b->mask[0]; b = b->next)
if (!rfc_casecmp(b->mask, u->mask) &&
expired_mask(chan, b->who) && b->timer != now) {
add_mode(chan, '-', 'b', u->mask);
b->timer = now;
}
u_delban(NULL, u->mask, 1);
}
}
/* Check for specific channel-domain bans expiring */
for (chan = chanset; chan; chan = chan->next) {
for (u = chan->bans; u; u = u2) {
u2 = u->next;
if (!(u->flags & MASKREC_PERM) && (now >= u->expire)) {
putlog(LOG_MISC, "*", "%s %s %s %s (%s)", BANS_NOLONGER,
u->mask, MISC_ONLOCALE, chan->dname, MISC_EXPIRED);
for (b = chan->channel.ban; b->mask[0]; b = b->next)
if (!rfc_casecmp(b->mask, u->mask) &&
expired_mask(chan, b->who) && b->timer != now) {
add_mode(chan, '-', 'b', u->mask);
b->timer = now;
}
u_delban(chan, u->mask, 1);
}
}
}
}
I hope someone here can speak in c
Basically, I think I need some sort of bind which will react whenever a function is run. For instance, if I had put a function named event_expireban underneath
Code: Select all
putlog(LOG_MISC, "*", "%s %s %s %s (%s)", BANS_NOLONGER,
u->mask, MISC_ONLOCALE, chan->dname, MISC_EXPIRED);
like so:
Code: Select all
/* Check for specific channel-domain bans expiring */
for (chan = chanset; chan; chan = chan->next) {
for (u = chan->bans; u; u = u2) {
u2 = u->next;
if (!(u->flags & MASKREC_PERM) && (now >= u->expire)) {
putlog(LOG_MISC, "*", "%s %s %s %s (%s)", BANS_NOLONGER,
u->mask, MISC_ONLOCALE, chan->dname, MISC_EXPIRED);
-->event_expireban();<--
for (b = chan->channel.ban; b->mask[0]; b = b->next)
if (!rfc_casecmp(b->mask, u->mask) &&
expired_mask(chan, b->who) && b->timer != now) {
add_mode(chan, '-', 'b', u->mask);
b->timer = now;
}
u_delban(chan, u->mask, 1);
}
}
and if the event_expireban() function would somehow be detected by
Code: Select all
bind evnt - expireban procedurename
in the same way rehash is detected by
Then that would solve my problem, only problem is... I don't know how to do this :\
Any help will be greatly appreciated!