its only because i couldnt be bothered to write an extra 10 lines ish lol. but yeah but when i say work like bot_raw_ban i mean so you could put it for other services so like bot_raw_ban bans the users host then kicks them but only works for BotServ bots. Whereas if i wanted to do a command like that for ChanServ like /msg ChanServ KICKBAN [nick] [reason] then have anope_cmd_ban rather than something like this for what i did:
static int do_kb_user(User *u, ChannelInfo *ci, char* params, char* reason)
{
Channel *c = ci->c;
User *u2;
int is_same, exists;
char *av[2];
if (!params) {
params = u->nick;
}
is_same = (params == u->nick) ? 1 : (stricmp(params, u->nick) == 0);
if (is_same) {
u2 = u;
exists = 1;
} else
exists = ((u2 = finduser(params)) ? 1 : 0);
if (!is_same ? !check_access(u, ci, CA_BAN) : !check_access(u, ci, CA_BANME)) {
moduleNoticeLang(s_ChanServ, u, LANG_PERMISSION_DENIED, u->nick, ci->name);
} else if (!is_same && exists && (ci->flags & CI_PEACE) && (get_access(u2, ci) >= get_access(u, ci))) {
moduleNoticeLang(s_ChanServ, u, LANG_PERMISSION_DENIED, u->nick, ci->name);
/**
* Dont ban the user on channels where he is excepted
* to prevent services <-> server wars.
**/
} else if (exists && (ircd->except && is_excepted(ci, u2))) {
notice_lang(s_ChanServ, u, CHAN_EXCEPTED, u2->nick, ci->name);
} else if (!exists && (ircd->except && is_excepted_mask(ci, params))) {
notice_lang(s_ChanServ, u, CHAN_EXCEPTED, params, ci->name);
} else if (exists && ((ircd->protectedumode && is_protected(u2)) && !is_founder(u, ci))) {
moduleNoticeLang(s_ChanServ, u, LANG_PERMISSION_DENIED, u->nick, ci->name);
} else if (exists) {
char mask[BUFSIZE];
do_up_down(u2, ci, "down");
av[0] = sstrdup("+b");
get_idealban(ci, u2, mask, sizeof(mask));
av[1] = sstrdup(mask);
anope_cmd_mode(s_ChanServ, c->name, "+b %s", av[1]);
if (!reason && !is_protected(u2))
anope_cmd_kick(s_ChanServ, ci->name, params, "Requested!");
else if (!is_protected(u2))
anope_cmd_kick(s_ChanServ, ci->name, params, reason);
chan_set_modes(s_ChanServ, c, 2, av, 1);
} else {
/* If could be a hostmask.. set whatever we get */
moduleNoticeLang(s_ChanServ, u, LANG_USER_NOT_ON_CHANNEL, params, ci->name);
}
if (av[0]) free(av[0]);
if (av[1]) free(av[1]);
return MOD_CONT;
}
could replace some of that with a simple anope_cmd_ban. and that code is a mess lol.
[Edited on 20-5-2006 by Tom65789]