Message handlers should return void.

Also fix up some return values and stuff to use bool (or void if
nothing). I just did it whilst I was here.

According to jilles, the return value used to signify whether or not the
client had exited. This was error-prone and was fixed a long, long time
ago, but the return value was left int for historical reasons.

Since the return type is not used (and has no clear use case anyway),
it's safe to just get rid of it.
This commit is contained in:
Elizabeth Myers 2016-03-09 01:37:03 -06:00
parent eeabf33a7c
commit 3c7d6fcce7
99 changed files with 1339 additions and 1691 deletions

View file

@ -42,11 +42,11 @@ static const char example_desc[] = "This is an example Charybdis module.";
* parv == an array of the parameters * parv == an array of the parameters
*/ */
static int munreg_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void munreg_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int mclient_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void mclient_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int mserver_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void mserver_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int mrclient_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void mrclient_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int moper_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void moper_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
/* Show the commands this module can handle in a msgtab /* Show the commands this module can handle in a msgtab
* and give the msgtab a name, here its test_msgtab * and give the msgtab a name, here its test_msgtab
@ -179,7 +179,7 @@ DECLARE_MODULE_AV2(
/* Here we have the functions themselves that we declared above, /* Here we have the functions themselves that we declared above,
* and the fairly normal C coding * and the fairly normal C coding
*/ */
static int static void
munreg_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) munreg_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(parc < 2) if(parc < 2)
@ -193,15 +193,13 @@ munreg_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
/* illustration of how to call a hook function */ /* illustration of how to call a hook function */
call_hook(doing_example_hook, NULL); call_hook(doing_example_hook, NULL);
return 0;
} }
/* /*
* mclient_test * mclient_test
* parv[1] = parameter * parv[1] = parameter
*/ */
static int static void
mclient_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mclient_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(parc < 2) if(parc < 2)
@ -215,15 +213,13 @@ mclient_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
/* illustration of how to call a hook function */ /* illustration of how to call a hook function */
call_hook(doing_example_hook, NULL); call_hook(doing_example_hook, NULL);
return 0;
} }
/* /*
* mrclient_test * mrclient_test
* parv[1] = parameter * parv[1] = parameter
*/ */
static int static void
mrclient_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mrclient_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(parc < 2) if(parc < 2)
@ -234,14 +230,13 @@ mrclient_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *s
{ {
sendto_one_notice(source_p, ":You are a remote client, and sent parameters: %s", parv[1]); sendto_one_notice(source_p, ":You are a remote client, and sent parameters: %s", parv[1]);
} }
return 0;
} }
/* /*
* mserver_test * mserver_test
* parv[1] = parameter * parv[1] = parameter
*/ */
static int static void
mserver_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mserver_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(parc < 2) if(parc < 2)
@ -252,14 +247,13 @@ mserver_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
{ {
sendto_one_notice(source_p, ":You are a server, and sent parameters: %s", parv[1]); sendto_one_notice(source_p, ":You are a server, and sent parameters: %s", parv[1]);
} }
return 0;
} }
/* /*
* moper_test * moper_test
* parv[1] = parameter * parv[1] = parameter
*/ */
static int static void
moper_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) moper_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(parc < 2) if(parc < 2)
@ -270,7 +264,6 @@ moper_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
{ {
sendto_one_notice(source_p, ":You are an operator, and sent parameters: %s", parv[1]); sendto_one_notice(source_p, ":You are an operator, and sent parameters: %s", parv[1]);
} }
return 0;
} }
static void static void

View file

@ -22,9 +22,9 @@ static void h_hdl_new_remote_user(struct Client *client_p);
static void h_hdl_client_exit(hook_data_client_exit *hdata); static void h_hdl_client_exit(hook_data_client_exit *hdata);
static void h_hdl_umode_changed(hook_data_umode_changed *hdata); static void h_hdl_umode_changed(hook_data_umode_changed *hdata);
static void h_hdl_whois(hook_data_client *hdata); static void h_hdl_whois(hook_data_client *hdata);
static int mo_dehelper(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_dehelper(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_dehelper(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_dehelper(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int do_dehelper(struct Client *source_p, struct Client *target_p); static void do_dehelper(struct Client *source_p, struct Client *target_p);
mapi_hfn_list_av1 helpops_hfnlist[] = { mapi_hfn_list_av1 helpops_hfnlist[] = {
{ "doing_stats", (hookfn) h_hdl_stats_request }, { "doing_stats", (hookfn) h_hdl_stats_request },
@ -45,20 +45,21 @@ struct Message dehelper_msgtab = {
mapi_clist_av1 helpops_clist[] = { &dehelper_msgtab, NULL }; mapi_clist_av1 helpops_clist[] = { &dehelper_msgtab, NULL };
static int mo_dehelper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv) static void
mo_dehelper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{ {
struct Client *target_p; struct Client *target_p;
if (!IsOperAdmin(source_p)) if (!IsOperAdmin(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin"); sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0; return;
} }
if(!(target_p = find_named_person(parv[1]))) if(!(target_p = find_named_person(parv[1])))
{ {
sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), parv[1]); sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), parv[1]);
return 0; return;
} }
if(MyClient(target_p)) if(MyClient(target_p))
@ -66,31 +67,30 @@ static int mo_dehelper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct
else else
sendto_one(target_p, ":%s ENCAP %s DEHELPER %s", sendto_one(target_p, ":%s ENCAP %s DEHELPER %s",
use_id(source_p), target_p->servptr->name, use_id(target_p)); use_id(source_p), target_p->servptr->name, use_id(target_p));
return 0;
} }
static int me_dehelper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv) static void
me_dehelper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{ {
struct Client *target_p = find_person(parv[1]); struct Client *target_p = find_person(parv[1]);
if(!target_p) if(!target_p)
{ {
sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), parv[1]); sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), parv[1]);
return 0; return;
} }
if(!MyClient(target_p)) if(!MyClient(target_p))
return 0; return;
do_dehelper(source_p, target_p); do_dehelper(source_p, target_p);
return 0;
} }
static int do_dehelper(struct Client *source_p, struct Client *target_p) static void
do_dehelper(struct Client *source_p, struct Client *target_p)
{ {
const char *fakeparv[4]; const char *fakeparv[4];
if(!(target_p->umodes & UMODE_HELPOPS)) if(!(target_p->umodes & UMODE_HELPOPS))
return 0; return;
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is using DEHELPER on %s", sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is using DEHELPER on %s",
source_p->name, target_p->name); source_p->name, target_p->name);
@ -100,7 +100,6 @@ static int do_dehelper(struct Client *source_p, struct Client *target_p)
fakeparv[2] = "-H"; fakeparv[2] = "-H";
fakeparv[3] = NULL; fakeparv[3] = NULL;
user_mode(target_p, target_p, 3, fakeparv); user_mode(target_p, target_p, 3, fakeparv);
return 0;
} }
static int static int

View file

@ -47,10 +47,10 @@ typedef struct _hurt {
/* }}} */ /* }}} */
/* {{{ Prototypes */ /* {{{ Prototypes */
static int mo_hurt(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **); static void mo_hurt(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **);
static int me_hurt(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **); static void me_hurt(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **);
static int mo_heal(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **); static void mo_heal(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **);
static int me_heal(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **); static void me_heal(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **);
static int modinit(void); static int modinit(void);
static void modfini(void); static void modfini(void);
@ -70,7 +70,7 @@ static hurt_t *hurt_find_exact(const char *ip);
static void hurt_remove(const char *ip); static void hurt_remove(const char *ip);
static void hurt_destroy(void *hurt); static void hurt_destroy(void *hurt);
static int heal_nick(struct Client *, struct Client *); static void heal_nick(struct Client *, struct Client *);
/* }}} */ /* }}} */
@ -173,7 +173,7 @@ modfini(void)
* Message handlers. * Message handlers.
*/ */
/* {{{ static int mo_hurt() /* {{{ static void mo_hurt()
* *
* HURT [<expire>] <ip> <reason> * HURT [<expire>] <ip> <reason>
* *
@ -181,7 +181,7 @@ modfini(void)
* parv[2] - ip or reason * parv[2] - ip or reason
* parv[3] - reason or NULL * parv[3] - reason or NULL
*/ */
static int static void
mo_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, mo_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char **parv) int parc, const char **parv)
{ {
@ -193,7 +193,7 @@ mo_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if (!IsOperK(source_p)) { if (!IsOperK(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, sendto_one(source_p, form_str(ERR_NOPRIVS), me.name,
source_p->name, "kline"); source_p->name, "kline");
return 0; return;
} }
if (parc == 3) if (parc == 3)
@ -205,11 +205,11 @@ mo_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
expire_time = HURT_DEFAULT_EXPIRE; expire_time = HURT_DEFAULT_EXPIRE;
if (expire && (expire_time = valid_temp_time(expire)) < 1) { if (expire && (expire_time = valid_temp_time(expire)) < 1) {
sendto_one_notice(source_p, ":Permanent HURTs are not supported"); sendto_one_notice(source_p, ":Permanent HURTs are not supported");
return 0; return;
} }
if (EmptyString(reason)) { if (EmptyString(reason)) {
sendto_one_notice(source_p, ":Empty HURT reasons are bad for business"); sendto_one_notice(source_p, ":Empty HURT reasons are bad for business");
return 0; return;
} }
/* Is this a client? */ /* Is this a client? */
@ -220,7 +220,7 @@ mo_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one_numeric(source_p, ERR_NOSUCHNICK, sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), ip); form_str(ERR_NOSUCHNICK), ip);
return 0; return;
} }
ip = target_p->orighost; ip = target_p->orighost;
} }
@ -232,13 +232,13 @@ mo_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one_notice(source_p, ":Invalid HURT mask [%s]", sendto_one_notice(source_p, ":Invalid HURT mask [%s]",
ip); ip);
return 0; return;
} }
} }
if (hurt_find(ip) != NULL) { if (hurt_find(ip) != NULL) {
sendto_one(source_p, ":[%s] already HURT", ip); sendto_one(source_p, ":[%s] already HURT", ip);
return 0; return;
} }
/* /*
@ -252,12 +252,10 @@ mo_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
hurt = hurt_new(expire_time, ip, reason); hurt = hurt_new(expire_time, ip, reason);
hurt_add(hurt); hurt_add(hurt);
hurt_propagate(NULL, source_p, hurt); hurt_propagate(NULL, source_p, hurt);
return 0;
} }
/* }}} */ /* }}} */
/* {{{ static int me_hurt() /* {{{ static void me_hurt()
* *
* [ENCAP mask] HURT <target> <expire> <ip> <reason> * [ENCAP mask] HURT <target> <expire> <ip> <reason>
* *
@ -265,7 +263,7 @@ mo_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
* parv[2] - ip * parv[2] - ip
* parv[3] - reason * parv[3] - reason
*/ */
static int static void
me_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, me_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char **parv) int parc, const char **parv)
{ {
@ -278,31 +276,29 @@ me_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
* dropping a server over. * dropping a server over.
*/ */
if (parc < 4 || !IsPerson(source_p)) if (parc < 4 || !IsPerson(source_p))
return 0; return;
if ((expire_time = atoi(parv[1])) < 1) if ((expire_time = atoi(parv[1])) < 1)
return 0; return;
if (hurt_find(parv[2]) != NULL) if (hurt_find(parv[2]) != NULL)
return 0; return;
if (EmptyString(parv[3])) if (EmptyString(parv[3]))
return 0; return;
sendto_realops_snomask(SNO_GENERAL, L_ALL, sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s added HURT on [%s] for %ld minutes with reason [%s]", "%s added HURT on [%s] for %ld minutes with reason [%s]",
get_oper_name(source_p), parv[2], (long) expire_time / 60, parv[3]); get_oper_name(source_p), parv[2], (long) expire_time / 60, parv[3]);
hurt = hurt_new(expire_time, parv[2], parv[3]); hurt = hurt_new(expire_time, parv[2], parv[3]);
hurt_add(hurt); hurt_add(hurt);
return 0;
} }
/* }}} */ /* }}} */
/* {{{ static int mo_heal() /* {{{ static void mo_heal()
* *
* HURT <nick>|<ip> * HURT <nick>|<ip>
* *
* parv[1] - nick or ip * parv[1] - nick or ip
*/ */
static int static void
mo_heal(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, mo_heal(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char **parv) int parc, const char **parv)
{ {
@ -312,7 +308,7 @@ mo_heal(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "unkline"); me.name, source_p->name, "unkline");
return 0; return;
} }
if (clean_nick(parv[1], 0)) if (clean_nick(parv[1], 0))
@ -322,7 +318,7 @@ mo_heal(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one_numeric(source_p, ERR_NOSUCHNICK, sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), parv[1]); form_str(ERR_NOSUCHNICK), parv[1]);
return 0; return;
} }
if (MyConnect(target_p)) if (MyConnect(target_p))
heal_nick(source_p, target_p); heal_nick(source_p, target_p);
@ -337,7 +333,7 @@ mo_heal(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if (hurt_find_exact(parv[1]) == NULL) if (hurt_find_exact(parv[1]) == NULL)
{ {
sendto_one_notice(source_p, ":Mask [%s] is not HURT", parv[1]); sendto_one_notice(source_p, ":Mask [%s] is not HURT", parv[1]);
return 0; return;
} }
hurt_remove(parv[1]); hurt_remove(parv[1]);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s removed HURT on %s", sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s removed HURT on %s",
@ -348,14 +344,12 @@ mo_heal(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
else else
{ {
sendto_one(source_p, ":[%s] is not a valid IP address/nick", parv[1]); sendto_one(source_p, ":[%s] is not a valid IP address/nick", parv[1]);
return 0; return;
} }
return 0;
} }
/* }}} */ /* }}} */
static int static void
me_heal(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, me_heal(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char **parv) int parc, const char **parv)
{ {
@ -365,7 +359,7 @@ me_heal(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
* *poof*, it's dropped... * *poof*, it's dropped...
*/ */
if (parc < 2) if (parc < 2)
return 0; return;
if (clean_nick(parv[1], 0)) if (clean_nick(parv[1], 0))
{ {
@ -376,16 +370,12 @@ me_heal(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
else if (strchr(parv[1], '.')) /* host or mask to remove ban for */ else if (strchr(parv[1], '.')) /* host or mask to remove ban for */
{ {
if (hurt_find_exact(parv[1]) == NULL) if (hurt_find_exact(parv[1]) == NULL)
return 0; return;
hurt_remove(parv[1]); hurt_remove(parv[1]);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s removed HURT on %s", sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s removed HURT on %s",
get_oper_name(source_p), parv[1]); get_oper_name(source_p), parv[1]);
} }
else
return 0;
return 0;
} }
/* /*
@ -499,7 +489,6 @@ doing_stats_hook(hook_data_int *hdata)
sendto_one_numeric(source_p, RPL_STATSKLINE, sendto_one_numeric(source_p, RPL_STATSKLINE,
form_str(RPL_STATSKLINE), 's', form_str(RPL_STATSKLINE), 's',
"*", hurt->ip, hurt->reason, "", ""); "*", hurt->ip, hurt->reason, "", "");
return;
} }
return; return;
} }
@ -620,8 +609,8 @@ hurt_remove(const char *ip)
hurt_destroy(hurt); hurt_destroy(hurt);
} }
/* {{{ static int heal_nick() */ /* {{{ static void heal_nick() */
static int static void
heal_nick(struct Client *source_p, struct Client *target_p) heal_nick(struct Client *source_p, struct Client *target_p)
{ {
if (rb_dlinkFindDestroy(target_p, &hurt_state.hurt_clients)) if (rb_dlinkFindDestroy(target_p, &hurt_state.hurt_clients))
@ -631,12 +620,10 @@ heal_nick(struct Client *source_p, struct Client *target_p)
sendto_one_notice(target_p, ":HURT restriction temporarily removed by operator"); sendto_one_notice(target_p, ":HURT restriction temporarily removed by operator");
sendto_one_notice(source_p, ":HURT restriction on %s temporarily removed", target_p->name); sendto_one_notice(source_p, ":HURT restriction on %s temporarily removed", target_p->name);
target_p->localClient->target_last = rb_current_time(); /* don't ask --nenolod */ target_p->localClient->target_last = rb_current_time(); /* don't ask --nenolod */
return 1;
} }
else else
{ {
sendto_one_notice(source_p, ":%s was not hurt", target_p->name); sendto_one_notice(source_p, ":%s was not hurt", target_p->name);
return 0;
} }
} }
/* }}} */ /* }}} */

View file

@ -40,8 +40,8 @@
static const char adminwall_desc[] = static const char adminwall_desc[] =
"Provides the ADMINWALL command to send a message to all administrators"; "Provides the ADMINWALL command to send a message to all administrators";
static int mo_adminwall(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_adminwall(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_adminwall(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_adminwall(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message adminwall_msgtab = { struct Message adminwall_msgtab = {
"ADMINWALL", 0, 0, 0, 0, "ADMINWALL", 0, 0, 0, 0,
@ -57,23 +57,21 @@ DECLARE_MODULE_AV2(adminwall, NULL, NULL, adminwall_clist, NULL, NULL, NULL, NUL
* parv[1] = message text * parv[1] = message text
*/ */
static int static void
mo_adminwall(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_adminwall(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(!IsAdmin(source_p)) if(!IsAdmin(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "adminwall"); me.name, source_p->name, "adminwall");
return 0; return;
} }
sendto_wallops_flags(UMODE_ADMIN, source_p, "ADMINWALL - %s", parv[1]); sendto_wallops_flags(UMODE_ADMIN, source_p, "ADMINWALL - %s", parv[1]);
sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ADMINWALL :%s", parv[1]); sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ADMINWALL :%s", parv[1]);
return 0;
} }
static int static void
me_adminwall(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) me_adminwall(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
sendto_wallops_flags(UMODE_ADMIN, source_p, "ADMINWALL - %s", parv[1]); sendto_wallops_flags(UMODE_ADMIN, source_p, "ADMINWALL - %s", parv[1]);
return 0;
} }

View file

@ -4,7 +4,7 @@
#include "ircd.h" #include "ircd.h"
#include "send.h" #include "send.h"
static int m_echotags(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void m_echotags(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message echotags_msgtab = { struct Message echotags_msgtab = {
"ECHOTAGS", 0, 0, 0, 0, "ECHOTAGS", 0, 0, 0, 0,
@ -17,7 +17,7 @@ static const char echotags_desc[] = "A test module for tags";
DECLARE_MODULE_AV2(echotags, NULL, NULL, echotags_clist, NULL, NULL, NULL, NULL, echotags_desc); DECLARE_MODULE_AV2(echotags, NULL, NULL, echotags_clist, NULL, NULL, NULL, NULL, echotags_desc);
static int static void
m_echotags(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_echotags(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
int i; int i;
@ -33,8 +33,6 @@ m_echotags(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
else else
sendto_one_notice(source_p, ":*** %d: %s", i, tag->key); sendto_one_notice(source_p, ":*** %d: %s", i, tag->key);
} }
return 0;
} }

View file

@ -34,8 +34,8 @@
static const char extendchans_desc[] = static const char extendchans_desc[] =
"Allow an oper or service to let a given user join more channels"; "Allow an oper or service to let a given user join more channels";
static int mo_extendchans(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_extendchans(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_extendchans(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_extendchans(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message extendchans_msgtab = { struct Message extendchans_msgtab = {
"EXTENDCHANS", 0, 0, 0, 0, "EXTENDCHANS", 0, 0, 0, 0,
@ -46,7 +46,7 @@ mapi_clist_av1 extendchans_clist[] = { &extendchans_msgtab, NULL };
DECLARE_MODULE_AV2(extendchans, NULL, NULL, extendchans_clist, NULL, NULL, NULL, NULL, extendchans_desc); DECLARE_MODULE_AV2(extendchans, NULL, NULL, extendchans_clist, NULL, NULL, NULL, NULL, extendchans_desc);
static int static void
mo_extendchans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_extendchans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -54,17 +54,17 @@ mo_extendchans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
if(!HasPrivilege(source_p, "oper:extendchans")) if(!HasPrivilege(source_p, "oper:extendchans"))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "extendchans"); sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "extendchans");
return 0; return;
} }
if(EmptyString(parv[1])) if(EmptyString(parv[1]))
{ {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "EXTENDCHANS"); sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "EXTENDCHANS");
return 0; return;
} }
if((target_p = find_chasing(source_p, parv[1], NULL)) == NULL) if((target_p = find_chasing(source_p, parv[1], NULL)) == NULL)
return 0; return;
/* Is the target user local? */ /* Is the target user local? */
if(MyClient(target_p)) if(MyClient(target_p))
@ -82,11 +82,9 @@ mo_extendchans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
sendto_one_notice(source_p, ":You have extended the channel limit on: %s (%s@%s)", sendto_one_notice(source_p, ":You have extended the channel limit on: %s (%s@%s)",
target_p->name, target_p->username, target_p->orighost); target_p->name, target_p->username, target_p->orighost);
return 0;
} }
static int static void
me_extendchans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) me_extendchans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -95,7 +93,7 @@ me_extendchans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
if(target_p == NULL) if(target_p == NULL)
{ {
sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), parv[1]); sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), parv[1]);
return 0; return;
} }
/* Is the target user local? If not, pass it on. */ /* Is the target user local? If not, pass it on. */
@ -104,12 +102,10 @@ me_extendchans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
struct Client *cptr = target_p->servptr; struct Client *cptr = target_p->servptr;
sendto_one(cptr, ":%s ENCAP %s EXTENDCHANS %s", sendto_one(cptr, ":%s ENCAP %s EXTENDCHANS %s",
get_id(source_p, cptr), cptr->name, get_id(target_p, cptr)); get_id(source_p, cptr), cptr->name, get_id(target_p, cptr));
return 0; return;
} }
sendto_one_notice(target_p, ":*** %s (%s@%s) is extending your channel limit", sendto_one_notice(target_p, ":*** %s (%s@%s) is extending your channel limit",
source_p->name, source_p->username, source_p->host); source_p->name, source_p->username, source_p->host);
SetExtendChans(target_p); SetExtendChans(target_p);
return 0;
} }

View file

@ -36,7 +36,7 @@
static const char findfowards_desc[] = "Allows operators to find forwards to a given channel"; static const char findfowards_desc[] = "Allows operators to find forwards to a given channel";
static int m_findforwards(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, static void m_findforwards(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]); int parc, const char *parv[]);
struct Message findforwards_msgtab = { struct Message findforwards_msgtab = {
@ -52,7 +52,7 @@ DECLARE_MODULE_AV2(findforwards, NULL, NULL, findforwards_clist, NULL, NULL, NUL
** mo_findforwards ** mo_findforwards
** parv[1] = channel ** parv[1] = channel
*/ */
static int static void
m_findforwards(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_findforwards(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
static time_t last_used = 0; static time_t last_used = 0;
@ -70,21 +70,21 @@ m_findforwards(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
{ {
sendto_one_numeric(source_p, ERR_NOTONCHANNEL, sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), parv[1]); form_str(ERR_NOTONCHANNEL), parv[1]);
return 0; return;
} }
if(!is_chanop(msptr)) if(!is_chanop(msptr))
{ {
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, parv[1]); me.name, source_p->name, parv[1]);
return 0; return;
} }
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
{ {
sendto_one(source_p, form_str(RPL_LOAD2HI), sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "FINDFORWARDS"); me.name, source_p->name, "FINDFORWARDS");
return 0; return;
} }
else else
last_used = rb_current_time(); last_used = rb_current_time();
@ -111,6 +111,4 @@ m_findforwards(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
*(--p) = '\0'; *(--p) = '\0';
sendto_one_notice(source_p, ":Forwards for %s: %s", parv[1], buf); sendto_one_notice(source_p, ":Forwards for %s: %s", parv[1], buf);
return 0;
} }

View file

@ -49,7 +49,7 @@
static const char identify_desc[] = "Adds the IDENTIFY alias that forwards to NickServ or ChanServ"; static const char identify_desc[] = "Adds the IDENTIFY alias that forwards to NickServ or ChanServ";
static int m_identify(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void m_identify(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message identify_msgtab = { struct Message identify_msgtab = {
"IDENTIFY", 0, 0, 0, 0, "IDENTIFY", 0, 0, 0, 0,
@ -61,11 +61,10 @@ mapi_clist_av1 identify_clist[] = {
NULL NULL
}; };
static const char identify_desc[] = "Adds the IDENTIFY alias that forwards to NickServ or ChanServ";
DECLARE_MODULE_AV2(identify, NULL, NULL, identify_clist, NULL, NULL, NULL, NULL, identify_desc); DECLARE_MODULE_AV2(identify, NULL, NULL, identify_clist, NULL, NULL, NULL, NULL, identify_desc);
static int m_identify(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) static void
m_identify(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
const char *nick; const char *nick;
struct Client *target_p; struct Client *target_p;
@ -73,7 +72,7 @@ static int m_identify(struct MsgBuf *msgbuf_p, struct Client *client_p, struct C
if (parc < 2 || EmptyString(parv[1])) if (parc < 2 || EmptyString(parv[1]))
{ {
sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name); sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name);
return 0; return;
} }
nick = parv[1][0] == '#' ? SVS_chanserv_NICK : SVS_nickserv_NICK; nick = parv[1][0] == '#' ? SVS_chanserv_NICK : SVS_nickserv_NICK;
@ -85,5 +84,4 @@ static int m_identify(struct MsgBuf *msgbuf_p, struct Client *client_p, struct C
{ {
sendto_one_numeric(source_p, ERR_SERVICESDOWN, form_str(ERR_SERVICESDOWN), nick); sendto_one_numeric(source_p, ERR_SERVICESDOWN, form_str(ERR_SERVICESDOWN), nick);
} }
return 0;
} }

View file

@ -17,9 +17,9 @@
const char mkpasswd_desc[] = "Hash a password for use in ircd.conf"; const char mkpasswd_desc[] = "Hash a password for use in ircd.conf";
static int m_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, static void m_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]); int parc, const char *parv[]);
static int mo_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, static void mo_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]); int parc, const char *parv[]);
static char *make_md5_salt(int); static char *make_md5_salt(int);
@ -45,7 +45,7 @@ DECLARE_MODULE_AV2(mkpasswd, NULL, NULL, mkpasswd_clist, NULL, NULL, NULL, NULL,
* parv[1] = password * parv[1] = password
* parv[2] = type * parv[2] = type
*/ */
static int static void
m_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
static time_t last_used = 0; static time_t last_used = 0;
@ -57,7 +57,7 @@ m_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
if(EmptyString(parv[1])) if(EmptyString(parv[1]))
{ {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD"); sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD");
return 0; return;
} }
if(parc < 3) if(parc < 3)
@ -69,7 +69,7 @@ m_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
{ {
/* safe enough to give this on a local connect only */ /* safe enough to give this on a local connect only */
sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "MKPASSWD"); sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "MKPASSWD");
return 0; return;
} }
else else
last_used = rb_current_time(); last_used = rb_current_time();
@ -84,19 +84,18 @@ m_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
{ {
sendto_one_notice(source_p, sendto_one_notice(source_p,
":MKPASSWD syntax error: MKPASSWD pass [SHA256|SHA512|MD5]"); ":MKPASSWD syntax error: MKPASSWD pass [SHA256|SHA512|MD5]");
return 0; return;
} }
crypted = rb_crypt(parv[1], salt); crypted = rb_crypt(parv[1], salt);
sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], crypted ? crypted : "???"); sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], crypted ? crypted : "???");
return 0;
} }
/* mo_mkpasswd - mkpasswd message handler /* mo_mkpasswd - mkpasswd message handler
* parv[1] = password * parv[1] = password
* parv[2] = type * parv[2] = type
*/ */
static int static void
mo_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
char *salt; char *salt;
@ -107,7 +106,7 @@ mo_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
if(EmptyString(parv[1])) if(EmptyString(parv[1]))
{ {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD"); sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD");
return 0; return;
} }
if(parc < 3) if(parc < 3)
@ -125,12 +124,11 @@ mo_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
{ {
sendto_one_notice(source_p, sendto_one_notice(source_p,
":MKPASSWD syntax error: MKPASSWD pass [SHA256|SHA512|MD5]"); ":MKPASSWD syntax error: MKPASSWD pass [SHA256|SHA512|MD5]");
return 0; return;
} }
crypted = rb_crypt(parv[1], salt); crypted = rb_crypt(parv[1], salt);
sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], crypted ? crypted : "???"); sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], crypted ? crypted : "???");
return 0;
} }
char * char *

View file

@ -37,7 +37,7 @@
static const char ojoin_desc[] = "Allow admins to forcibly join channels with the OJOIN command"; static const char ojoin_desc[] = "Allow admins to forcibly join channels with the OJOIN command";
static int mo_ojoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void mo_ojoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message ojoin_msgtab = { struct Message ojoin_msgtab = {
"OJOIN", 0, 0, 0, 0, "OJOIN", 0, 0, 0, 0,
@ -52,7 +52,7 @@ DECLARE_MODULE_AV2(ojoin, NULL, NULL, ojoin_clist, NULL, NULL, NULL, NULL, ojoin
** mo_ojoin ** mo_ojoin
** parv[1] = channel ** parv[1] = channel
*/ */
static int static void
mo_ojoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_ojoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Channel *chptr; struct Channel *chptr;
@ -62,7 +62,7 @@ mo_ojoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(!IsOperAdmin(source_p)) if(!IsOperAdmin(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin"); sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0; return;
} }
if(*parv[1] == '@' || *parv[1] == '+') if(*parv[1] == '@' || *parv[1] == '+')
@ -75,13 +75,13 @@ mo_ojoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]); form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0; return;
} }
if(IsMember(source_p, chptr)) if(IsMember(source_p, chptr))
{ {
sendto_one_notice(source_p, ":Please part %s before using OJOIN", parv[1]); sendto_one_notice(source_p, ":Please part %s before using OJOIN", parv[1]);
return 0; return;
} }
if(move_me == 1) if(move_me == 1)
@ -139,6 +139,4 @@ mo_ojoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
source_p->localClient->last_join_time = rb_current_time(); source_p->localClient->last_join_time = rb_current_time();
channel_member_names(chptr, source_p, 1); channel_member_names(chptr, source_p, 1);
return 0;
} }

View file

@ -40,7 +40,7 @@
static const char okick_desc[] = "Allow admins to forcibly kick users from channels with the OKICK command"; static const char okick_desc[] = "Allow admins to forcibly kick users from channels with the OKICK command";
static int mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message okick_msgtab = { struct Message okick_msgtab = {
"OKICK", 0, 0, 0, 0, "OKICK", 0, 0, 0, 0,
@ -57,7 +57,7 @@ DECLARE_MODULE_AV2(okick, NULL, NULL, okick_clist, NULL, NULL, NULL, NULL, okick
** parv[2] = client to kick ** parv[2] = client to kick
** parv[3] = kick comment ** parv[3] = kick comment
*/ */
static int static void
mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *who; struct Client *who;
@ -74,7 +74,7 @@ mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(*parv[2] == '\0') if(*parv[2] == '\0')
{ {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "KICK"); sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "KICK");
return 0; return;
} }
if(MyClient(source_p) && !IsFloodDone(source_p)) if(MyClient(source_p) && !IsFloodDone(source_p))
@ -94,7 +94,7 @@ mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(!chptr) if(!chptr)
{ {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name); sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
return 0; return;
} }
@ -103,19 +103,19 @@ mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
user = LOCAL_COPY(parv[2]); // strtoken(&p2, parv[2], ","); user = LOCAL_COPY(parv[2]); // strtoken(&p2, parv[2], ",");
if(!(who = find_chasing(source_p, user, &chasing))) if(!(who = find_chasing(source_p, user, &chasing)))
{ {
return 0; return;
} }
if((target_p = find_client(user)) == NULL) if((target_p = find_client(user)) == NULL)
{ {
sendto_one(source_p, form_str(ERR_NOSUCHNICK), user); sendto_one(source_p, form_str(ERR_NOSUCHNICK), user);
return 0; return;
} }
if((msptr = find_channel_membership(chptr, target_p)) == NULL) if((msptr = find_channel_membership(chptr, target_p)) == NULL)
{ {
sendto_one(source_p, form_str(ERR_USERNOTINCHANNEL), parv[1], parv[2]); sendto_one(source_p, form_str(ERR_USERNOTINCHANNEL), parv[1], parv[2]);
return 0; return;
} }
sendto_wallops_flags(UMODE_WALLOP, &me, sendto_wallops_flags(UMODE_WALLOP, &me,
@ -136,5 +136,4 @@ mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
sendto_server(&me, chptr, CAP_TS6, NOCAPS, sendto_server(&me, chptr, CAP_TS6, NOCAPS,
":%s KICK %s %s :%s", me.id, chptr->chname, who->id, comment); ":%s KICK %s %s :%s", me.id, chptr->chname, who->id, comment);
remove_user_from_channel(msptr); remove_user_from_channel(msptr);
return 0;
} }

View file

@ -44,7 +44,7 @@
static const char omode_desc[] = "Allow admins to forcibly change modes on channels with the OMODE command"; static const char omode_desc[] = "Allow admins to forcibly change modes on channels with the OMODE command";
static int mo_omode(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_omode(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message omode_msgtab = { struct Message omode_msgtab = {
"OMODE", 0, 0, 0, 0, "OMODE", 0, 0, 0, 0,
@ -59,7 +59,7 @@ DECLARE_MODULE_AV2(omode, NULL, NULL, omode_clist, NULL, NULL, NULL, NULL, omode
* mo_omode - MODE command handler * mo_omode - MODE command handler
* parv[1] - channel * parv[1] - channel
*/ */
static int static void
mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Channel *chptr = NULL; struct Channel *chptr = NULL;
@ -72,7 +72,7 @@ mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(!IsOperAdmin(source_p)) if(!IsOperAdmin(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin"); sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0; return;
} }
/* Now, try to find the channel in question */ /* Now, try to find the channel in question */
@ -80,7 +80,7 @@ mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one_numeric(source_p, ERR_BADCHANNAME, sendto_one_numeric(source_p, ERR_BADCHANNAME,
form_str(ERR_BADCHANNAME), parv[1]); form_str(ERR_BADCHANNAME), parv[1]);
return 0; return;
} }
chptr = find_channel(parv[1]); chptr = find_channel(parv[1]);
@ -89,7 +89,7 @@ mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]); form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0; return;
} }
/* Now know the channel exists */ /* Now know the channel exists */
@ -99,7 +99,7 @@ mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if (is_chanop(msptr)) if (is_chanop(msptr))
{ {
sendto_one_notice(source_p, ":Use a normal MODE you idiot"); sendto_one_notice(source_p, ":Use a normal MODE you idiot");
return 0; return;
} }
params[0] = '\0'; params[0] = '\0';
@ -133,7 +133,7 @@ mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL, sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname); form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
return 0; return;
} }
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s", sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s",
me.name, parv[1], source_p->name); me.name, parv[1], source_p->name);
@ -164,5 +164,4 @@ mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
remove_user_from_channel(msptr); remove_user_from_channel(msptr);
} }
#endif #endif
return 0;
} }

View file

@ -36,7 +36,7 @@
static const char opme_desc[] = "Allow admins to op themselves on opless channels"; static const char opme_desc[] = "Allow admins to op themselves on opless channels";
static int mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message opme_msgtab = { struct Message opme_msgtab = {
"OPME", 0, 0, 0, 0, "OPME", 0, 0, 0, 0,
@ -51,7 +51,7 @@ DECLARE_MODULE_AV2(opme, NULL, NULL, opme_clist, NULL, NULL, NULL, NULL, opme_de
** mo_opme ** mo_opme
** parv[1] = channel ** parv[1] = channel
*/ */
static int static void
mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Channel *chptr; struct Channel *chptr;
@ -62,14 +62,14 @@ mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if(!IsOperAdmin(source_p)) if(!IsOperAdmin(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin"); sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0; return;
} }
if((chptr = find_channel(parv[1])) == NULL) if((chptr = find_channel(parv[1])) == NULL)
{ {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]); form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0; return;
} }
RB_DLINK_FOREACH(ptr, chptr->members.head) RB_DLINK_FOREACH(ptr, chptr->members.head)
@ -79,14 +79,14 @@ mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if(is_chanop(msptr)) if(is_chanop(msptr))
{ {
sendto_one_notice(source_p, ":%s Channel is not opless", parv[1]); sendto_one_notice(source_p, ":%s Channel is not opless", parv[1]);
return 0; return;
} }
} }
msptr = find_channel_membership(chptr, source_p); msptr = find_channel_membership(chptr, source_p);
if(msptr == NULL) if(msptr == NULL)
return 0; return;
msptr->flags |= CHFL_CHANOP; msptr->flags |= CHFL_CHANOP;
@ -110,6 +110,4 @@ mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
sendto_channel_local(ALL_MEMBERS, chptr, sendto_channel_local(ALL_MEMBERS, chptr,
":%s MODE %s +o %s", me.name, parv[1], source_p->name); ":%s MODE %s +o %s", me.name, parv[1], source_p->name);
return 0;
} }

View file

@ -41,7 +41,7 @@
static const char description[] = "Provides the REMOVE command, an alternative to KICK"; static const char description[] = "Provides the REMOVE command, an alternative to KICK";
static int m_remove(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_remove(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void remove_quote_part(hook_data_privmsg_channel *); static void remove_quote_part(hook_data_privmsg_channel *);
unsigned int CAP_REMOVE; unsigned int CAP_REMOVE;
@ -64,7 +64,7 @@ mapi_cap_list_av2 remove_cap_list[] = {
DECLARE_MODULE_AV2(remove, NULL, NULL, remove_clist, NULL, remove_hfnlist, remove_cap_list, NULL, description); DECLARE_MODULE_AV2(remove, NULL, NULL, remove_clist, NULL, remove_hfnlist, remove_cap_list, NULL, description);
static int static void
m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct membership *msptr; struct membership *msptr;
@ -90,7 +90,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(chptr == NULL) if(chptr == NULL)
{ {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name); sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
return 0; return;
} }
if(!IsServer(source_p)) if(!IsServer(source_p))
@ -101,7 +101,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one_numeric(source_p, ERR_NOTONCHANNEL, sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), name); form_str(ERR_NOTONCHANNEL), name);
return 0; return;
} }
if(get_channel_access(source_p, chptr, msptr, MODE_ADD, NULL) < CHFL_CHANOP) if(get_channel_access(source_p, chptr, msptr, MODE_ADD, NULL) < CHFL_CHANOP)
@ -110,7 +110,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, name); me.name, source_p->name, name);
return 0; return;
} }
/* If its a TS 0 channel, do it the old way */ /* If its a TS 0 channel, do it the old way */
@ -118,7 +118,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
get_id(&me, source_p), get_id(source_p, source_p), name); get_id(&me, source_p), get_id(source_p, source_p), name);
return 0; return;
} }
} }
@ -151,7 +151,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(!(who = find_chasing(source_p, user, &chasing))) if(!(who = find_chasing(source_p, user, &chasing)))
{ {
return 0; return;
} }
msptr = find_channel_membership(chptr, who); msptr = find_channel_membership(chptr, who);
@ -162,7 +162,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one(source_p, form_str(ERR_ISCHANSERVICE), sendto_one(source_p, form_str(ERR_ISCHANSERVICE),
me.name, source_p->name, who->name, chptr->chname); me.name, source_p->name, who->name, chptr->chname);
return 0; return;
} }
if(MyClient(source_p)) if(MyClient(source_p))
@ -179,7 +179,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
call_hook(h_can_kick, &hookdata); call_hook(h_can_kick, &hookdata);
if (!hookdata.approved) if (!hookdata.approved)
return 0; return;
} }
comment = LOCAL_COPY((EmptyString(parv[3])) ? who->name : parv[3]); comment = LOCAL_COPY((EmptyString(parv[3])) ? who->name : parv[3]);
@ -210,8 +210,6 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
else if (MyClient(source_p)) else if (MyClient(source_p))
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL, sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), user, name); form_str(ERR_USERNOTINCHANNEL), user, name);
return 0;
} }
static void static void

View file

@ -32,13 +32,13 @@
static const char roleplay_desc[] = static const char roleplay_desc[] =
"Adds a roleplaying system that allows faked nicknames to talk in a channel set +N"; "Adds a roleplaying system that allows faked nicknames to talk in a channel set +N";
static int m_scene(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void m_scene(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int m_fsay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void m_fsay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int m_faction(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void m_faction(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int m_npc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void m_npc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int m_npca(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void m_npca(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *channel, int underline, int action, const char *nick, const char *text); static void m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *channel, int underline, int action, const char *nick, const char *text);
static int me_roleplay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void me_roleplay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static unsigned int mymode; static unsigned int mymode;
static int static int
@ -100,42 +100,37 @@ mapi_clist_av1 roleplay_clist[] = { &scene_msgtab, &ambiance_msgtab, &fsay_msgta
DECLARE_MODULE_AV2(roleplay, _modinit, _moddeinit, roleplay_clist, NULL, NULL, NULL, NULL, roleplay_desc); DECLARE_MODULE_AV2(roleplay, _modinit, _moddeinit, roleplay_clist, NULL, NULL, NULL, NULL, roleplay_desc);
static int static void
m_scene(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_scene(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
m_displaymsg(msgbuf_p, source_p, parv[1], 0, 0, "=Scene=", parv[2]); m_displaymsg(msgbuf_p, source_p, parv[1], 0, 0, "=Scene=", parv[2]);
return 0;
} }
static int static void
m_fsay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_fsay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
m_displaymsg(msgbuf_p, source_p, parv[1], 0, 0, parv[2], parv[3]); m_displaymsg(msgbuf_p, source_p, parv[1], 0, 0, parv[2], parv[3]);
return 0;
} }
static int static void
m_faction(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_faction(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
m_displaymsg(msgbuf_p, source_p, parv[1], 0, 1, parv[2], parv[3]); m_displaymsg(msgbuf_p, source_p, parv[1], 0, 1, parv[2], parv[3]);
return 0;
} }
static int static void
m_npc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_npc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
m_displaymsg(msgbuf_p, source_p, parv[1], 1, 0, parv[2], parv[3]); m_displaymsg(msgbuf_p, source_p, parv[1], 1, 0, parv[2], parv[3]);
return 0;
} }
static int static void
m_npca(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_npca(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
m_displaymsg(msgbuf_p, source_p, parv[1], 1, 1, parv[2], parv[3]); m_displaymsg(msgbuf_p, source_p, parv[1], 1, 1, parv[2], parv[3]);
return 0;
} }
static int static void
m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *channel, int underline, int action, const char *nick, const char *text) m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *channel, int underline, int action, const char *nick, const char *text)
{ {
struct Channel *chptr; struct Channel *chptr;
@ -154,38 +149,38 @@ m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *chann
{ {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), channel); form_str(ERR_NOSUCHCHANNEL), channel);
return 0; return;
} }
if(!(msptr = find_channel_membership(chptr, source_p))) if(!(msptr = find_channel_membership(chptr, source_p)))
{ {
sendto_one_numeric(source_p, ERR_NOTONCHANNEL, sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), chptr->chname); form_str(ERR_NOTONCHANNEL), chptr->chname);
return 0; return;
} }
if(!(chptr->mode.mode & chmode_flags['N'])) if(!(chptr->mode.mode & chmode_flags['N']))
{ {
sendto_one_numeric(source_p, 573, "%s :Roleplay commands are not enabled on this channel.", chptr->chname); sendto_one_numeric(source_p, 573, "%s :Roleplay commands are not enabled on this channel.", chptr->chname);
return 0; return;
} }
if(!can_send(chptr, source_p, msptr)) if(!can_send(chptr, source_p, msptr))
{ {
sendto_one_numeric(source_p, 573, "%s :Cannot send to channel.", chptr->chname); sendto_one_numeric(source_p, 573, "%s :Cannot send to channel.", chptr->chname);
return 0; return;
} }
/* enforce flood stuff on roleplay commands */ /* enforce flood stuff on roleplay commands */
if(flood_attack_channel(0, source_p, chptr, chptr->chname)) if(flood_attack_channel(0, source_p, chptr, chptr->chname))
return 0; return;
/* enforce target change on roleplay commands */ /* enforce target change on roleplay commands */
if(!is_chanop_voiced(msptr) && !IsOper(source_p) && !add_channel_target(source_p, chptr)) if(!is_chanop_voiced(msptr) && !IsOper(source_p) && !add_channel_target(source_p, chptr))
{ {
sendto_one(source_p, form_str(ERR_TARGCHANGE), sendto_one(source_p, form_str(ERR_TARGCHANGE),
me.name, source_p->name, chptr->chname); me.name, source_p->name, chptr->chname);
return 0; return;
} }
if(underline) if(underline)
@ -198,7 +193,7 @@ m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *chann
if(EmptyString(nick3)) if(EmptyString(nick3))
{ {
sendto_one_numeric(source_p, 573, "%s :No visible non-stripped characters in nick.", chptr->chname); sendto_one_numeric(source_p, 573, "%s :No visible non-stripped characters in nick.", chptr->chname);
return 0; return;
} }
snprintf(text3, sizeof(text3), "%s (%s)", text, source_p->name); snprintf(text3, sizeof(text3), "%s (%s)", text, source_p->name);
@ -211,10 +206,9 @@ m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *chann
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s", nick2, source_p->name, channel, text2); sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s", nick2, source_p->name, channel, text2);
sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ROLEPLAY %s %s :%s", sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ROLEPLAY %s %s :%s",
channel, nick2, text2); channel, nick2, text2);
return 0;
} }
static int static void
me_roleplay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) me_roleplay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Channel *chptr; struct Channel *chptr;
@ -222,8 +216,7 @@ me_roleplay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
/* Don't segfault if we get ROLEPLAY with an invalid channel. /* Don't segfault if we get ROLEPLAY with an invalid channel.
* This shouldn't happen but it's best to be on the safe side. */ * This shouldn't happen but it's best to be on the safe side. */
if((chptr = find_channel(parv[1])) == NULL) if((chptr = find_channel(parv[1])) == NULL)
return 0; return;
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s", parv[2], source_p->name, parv[1], parv[3]); sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s", parv[2], source_p->name, parv[1], parv[3]);
return 0;
} }

View file

@ -48,7 +48,7 @@
static const char sendbands_desc[] = static const char sendbands_desc[] =
"Adds the ability to send all permanent RESVs and XLINEs to given server"; "Adds the ability to send all permanent RESVs and XLINEs to given server";
static int mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message sendbans_msgtab = { struct Message sendbans_msgtab = {
"SENDBANS", 0, 0, 0, 0, "SENDBANS", 0, 0, 0, 0,
@ -86,7 +86,8 @@ static const char *expand_xline(const char *mask)
return buf; return buf;
} }
static int mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) static void
mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct ConfItem *aconf; struct ConfItem *aconf;
rb_dlink_node *ptr; rb_dlink_node *ptr;
@ -99,19 +100,19 @@ static int mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "remoteban"); me.name, source_p->name, "remoteban");
return 0; return;
} }
if (!IsOperXline(source_p)) if (!IsOperXline(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "xline"); me.name, source_p->name, "xline");
return 0; return;
} }
if (!IsOperResv(source_p)) if (!IsOperResv(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "resv"); me.name, source_p->name, "resv");
return 0; return;
} }
target = parv[1]; target = parv[1];
@ -128,7 +129,7 @@ static int mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct
{ {
sendto_one_numeric(source_p, ERR_NOSUCHSERVER, sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
form_str(ERR_NOSUCHSERVER), target); form_str(ERR_NOSUCHSERVER), target);
return 0; return;
} }
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
@ -174,6 +175,4 @@ static int mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct
"ENCAP %s XLINE 0 %s 2 :%s", "ENCAP %s XLINE 0 %s 2 :%s",
target, mask2, aconf->passwd); target, mask2, aconf->passwd);
} }
return 0;
} }

View file

@ -55,7 +55,7 @@
static const char webirc_desc[] = "Adds support for the WebIRC system"; static const char webirc_desc[] = "Adds support for the WebIRC system";
static int mr_webirc(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **); static void mr_webirc(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **);
struct Message webirc_msgtab = { struct Message webirc_msgtab = {
"WEBIRC", 0, 0, 0, 0, "WEBIRC", 0, 0, 0, 0,
@ -73,7 +73,7 @@ DECLARE_MODULE_AV2(webirc, NULL, NULL, webirc_clist, NULL, NULL, NULL, NULL, web
* parv[3] = fake hostname * parv[3] = fake hostname
* parv[4] = fake ip * parv[4] = fake ip
*/ */
static int static void
mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct ConfItem *aconf; struct ConfItem *aconf;
@ -85,7 +85,7 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
sizeof(source_p->sockhost)) sizeof(source_p->sockhost))
{ {
sendto_one(source_p, "NOTICE * :Invalid IP"); sendto_one(source_p, "NOTICE * :Invalid IP");
return 0; return;
} }
aconf = find_address_conf(client_p->host, client_p->sockhost, aconf = find_address_conf(client_p->host, client_p->sockhost,
@ -94,17 +94,17 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
(struct sockaddr *) &client_p->localClient->ip, (struct sockaddr *) &client_p->localClient->ip,
client_p->localClient->ip.ss_family, NULL); client_p->localClient->ip.ss_family, NULL);
if (aconf == NULL || !(aconf->status & CONF_CLIENT)) if (aconf == NULL || !(aconf->status & CONF_CLIENT))
return 0; return;
if (!IsConfDoSpoofIp(aconf) || irccmp(aconf->info.name, "webirc.")) if (!IsConfDoSpoofIp(aconf) || irccmp(aconf->info.name, "webirc."))
{ {
/* XXX */ /* XXX */
sendto_one(source_p, "NOTICE * :Not a CGI:IRC auth block"); sendto_one(source_p, "NOTICE * :Not a CGI:IRC auth block");
return 0; return;
} }
if (EmptyString(aconf->passwd)) if (EmptyString(aconf->passwd))
{ {
sendto_one(source_p, "NOTICE * :CGI:IRC auth blocks must have a password"); sendto_one(source_p, "NOTICE * :CGI:IRC auth blocks must have a password");
return 0; return;
} }
if (EmptyString(parv[1])) if (EmptyString(parv[1]))
@ -117,13 +117,13 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
if (encr == NULL || strcmp(encr, aconf->passwd)) if (encr == NULL || strcmp(encr, aconf->passwd))
{ {
sendto_one(source_p, "NOTICE * :CGI:IRC password incorrect"); sendto_one(source_p, "NOTICE * :CGI:IRC password incorrect");
return 0; return;
} }
if (rb_inet_pton_sock(parv[4], (struct sockaddr *)&addr) <= 0) if (rb_inet_pton_sock(parv[4], (struct sockaddr *)&addr) <= 0)
{ {
sendto_one(source_p, "NOTICE * :Invalid IP"); sendto_one(source_p, "NOTICE * :Invalid IP");
return 0; return;
} }
if (*parv[4] == ':') if (*parv[4] == ':')
@ -150,10 +150,9 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
if(!(aconf->status & CONF_EXEMPTDLINE)) if(!(aconf->status & CONF_EXEMPTDLINE))
{ {
exit_client(client_p, source_p, &me, "D-lined"); exit_client(client_p, source_p, &me, "D-lined");
return 0; return;
} }
} }
sendto_one(source_p, "NOTICE * :CGI:IRC host/IP set to %s %s", parv[3], parv[4]); sendto_one(source_p, "NOTICE * :CGI:IRC host/IP set to %s %s", parv[3], parv[4]);
return 0;
} }

View file

@ -49,7 +49,7 @@ HandlerType;
* int parc - parameter count (from msgbuf_p) * int parc - parameter count (from msgbuf_p)
* char* parv[] - parameter vector (from msgbuf_p) * char* parv[] - parameter vector (from msgbuf_p)
*/ */
typedef int (*MessageHandler) (struct MsgBuf *, struct Client *, struct Client *, int, const char *[]); typedef void (*MessageHandler) (struct MsgBuf *, struct Client *, struct Client *, int, const char *[]);
struct MessageEntry struct MessageEntry
{ {
@ -73,10 +73,10 @@ struct Message
}; };
/* generic handlers */ /* generic handlers */
extern int m_ignore(struct MsgBuf *, struct Client *, struct Client *, int, const char **); extern void m_ignore(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
extern int m_not_oper(struct MsgBuf *, struct Client *, struct Client *, int, const char **); extern void m_not_oper(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
extern int m_registered(struct MsgBuf *, struct Client *, struct Client *, int, const char **); extern void m_registered(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
extern int m_unregistered(struct MsgBuf *, struct Client *, struct Client *, int, const char **); extern void m_unregistered(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
#define mg_ignore { m_ignore, 0 } #define mg_ignore { m_ignore, 0 }
#define mg_not_oper { m_not_oper, 0 } #define mg_not_oper { m_not_oper, 0 }
@ -85,7 +85,7 @@ extern int m_unregistered(struct MsgBuf *, struct Client *, struct Client *, int
/* /*
* m_functions execute protocol messages on this server: * m_functions execute protocol messages on this server:
* int m_func(struct Client* client_p, struct Client* source_p, int parc, char* parv[]); * void m_func(struct Client* client_p, struct Client* source_p, int parc, char* parv[]);
* *
* client_p is always NON-NULL, pointing to a *LOCAL* client * client_p is always NON-NULL, pointing to a *LOCAL* client
* structure (with an open socket connected!). This * structure (with an open socket connected!). This

View file

@ -54,7 +54,7 @@ extern struct CapabilityIndex *cli_capindex;
#define CLICAP_FLAGS_REQACK 0x002 #define CLICAP_FLAGS_REQACK 0x002
struct ClientCapability { struct ClientCapability {
int (*visible)(struct Client *); /* whether or not to display the capability. set to NULL or true return value = displayed */ bool (*visible)(struct Client *); /* whether or not to display the capability. set to NULL or true return value = displayed */
const char *(*data)(struct Client *); /* any custom data for the capability. set to NULL or return NULL = no data */ const char *(*data)(struct Client *); /* any custom data for the capability. set to NULL or return NULL = no data */
unsigned int flags; unsigned int flags;
}; };

View file

@ -66,23 +66,23 @@ int max_mods = MODS_INCREMENT;
static rb_dlink_list mod_paths; static rb_dlink_list mod_paths;
static int mo_modload(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_modload(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_modlist(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_modlist(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_modreload(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_modreload(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_modunload(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_modunload(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_modrestart(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_modrestart(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_modload(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_modload(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_modlist(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_modlist(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_modreload(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_modreload(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_modunload(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_modunload(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_modrestart(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_modrestart(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int do_modload(struct Client *, const char *); static void do_modload(struct Client *, const char *);
static int do_modunload(struct Client *, const char *); static void do_modunload(struct Client *, const char *);
static int do_modreload(struct Client *, const char *); static void do_modreload(struct Client *, const char *);
static int do_modlist(struct Client *, const char *); static void do_modlist(struct Client *, const char *);
static int do_modrestart(struct Client *); static void do_modrestart(struct Client *);
struct Message modload_msgtab = { struct Message modload_msgtab = {
"MODLOAD", 0, 0, 0, 0, "MODLOAD", 0, 0, 0, 0,
@ -329,14 +329,14 @@ load_one_module(const char *path, int origin, int coremodule)
/* load a module .. */ /* load a module .. */
static int static void
mo_modload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv) mo_modload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{ {
if(!IsOperAdmin(source_p)) if(!IsOperAdmin(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "admin"); me.name, source_p->name, "admin");
return 0; return;
} }
if(parc > 2) if(parc > 2)
@ -344,26 +344,167 @@ mo_modload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
sendto_match_servs(source_p, parv[2], CAP_ENCAP, NOCAPS, sendto_match_servs(source_p, parv[2], CAP_ENCAP, NOCAPS,
"ENCAP %s MODLOAD %s", parv[2], parv[1]); "ENCAP %s MODLOAD %s", parv[2], parv[1]);
if (match(parv[2], me.name) == 0) if (match(parv[2], me.name) == 0)
return 0; return;
} }
return do_modload(source_p, parv[1]); do_modload(source_p, parv[1]);
} }
static int static void
me_modload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv) me_modload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{ {
if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_MODULE)) if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_MODULE))
{ {
sendto_one_notice(source_p, ":*** You do not have an appropriate shared block " sendto_one_notice(source_p, ":*** You do not have an appropriate shared block "
"to load modules on this server."); "to load modules on this server.");
return 0; return;
} }
return do_modload(source_p, parv[1]); do_modload(source_p, parv[1]);
} }
static int
/* unload a module .. */
static void
mo_modunload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!IsOperAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "admin");
return;
}
if(parc > 2)
{
sendto_match_servs(source_p, parv[2], CAP_ENCAP, NOCAPS,
"ENCAP %s MODUNLOAD %s", parv[2], parv[1]);
if (match(parv[2], me.name) == 0)
return;
}
do_modunload(source_p, parv[1]);
}
static void
me_modunload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_MODULE))
{
sendto_one_notice(source_p, ":*** You do not have an appropriate shared block "
"to load modules on this server.");
return;
}
do_modunload(source_p, parv[1]);
}
/* unload and load in one! */
static void
mo_modreload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!IsOperAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "admin");
return;
}
if(parc > 2)
{
sendto_match_servs(source_p, parv[2], CAP_ENCAP, NOCAPS,
"ENCAP %s MODRELOAD %s", parv[2], parv[1]);
if (match(parv[2], me.name) == 0)
return;
}
do_modreload(source_p, parv[1]);
}
static void
me_modreload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_MODULE))
{
sendto_one_notice(source_p, ":*** You do not have an appropriate shared block "
"to load modules on this server.");
return;
}
do_modreload(source_p, parv[1]);
}
/* list modules .. */
static void
mo_modlist(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!IsOperAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "admin");
return;
}
if(parc > 2)
{
sendto_match_servs(source_p, parv[2], CAP_ENCAP, NOCAPS,
"ENCAP %s MODLIST %s", parv[2], parv[1]);
if (match(parv[2], me.name) == 0)
return;
}
do_modlist(source_p, parc > 1 ? parv[1] : 0);
}
static void
me_modlist(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_MODULE))
{
sendto_one_notice(source_p, ":*** You do not have an appropriate shared block "
"to load modules on this server.");
return;
}
do_modlist(source_p, parv[1]);
}
/* unload and reload all modules */
static void
mo_modrestart(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!IsOperAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "admin");
return;
}
if(parc > 1)
{
sendto_match_servs(source_p, parv[1], CAP_ENCAP, NOCAPS,
"ENCAP %s MODRESTART", parv[1]);
if (match(parv[1], me.name) == 0)
return;
}
do_modrestart(source_p);
}
static void
me_modrestart(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_MODULE))
{
sendto_one_notice(source_p, ":*** You do not have an appropriate shared block "
"to load modules on this server.");
return;
}
do_modrestart(source_p);
}
static void
do_modload(struct Client *source_p, const char *module) do_modload(struct Client *source_p, const char *module)
{ {
char *m_bn = rb_basename(module); char *m_bn = rb_basename(module);
@ -373,54 +514,16 @@ do_modload(struct Client *source_p, const char *module)
{ {
sendto_one_notice(source_p, ":Module %s is already loaded", m_bn); sendto_one_notice(source_p, ":Module %s is already loaded", m_bn);
rb_free(m_bn); rb_free(m_bn);
return 0; return;
} }
origin = strcmp(module, m_bn) == 0 ? MAPI_ORIGIN_CORE : MAPI_ORIGIN_EXTENSION; origin = strcmp(module, m_bn) == 0 ? MAPI_ORIGIN_CORE : MAPI_ORIGIN_EXTENSION;
load_one_module(module, origin, 0); load_one_module(module, origin, 0);
rb_free(m_bn); rb_free(m_bn);
return 0;
} }
static void
/* unload a module .. */
static int
mo_modunload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!IsOperAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "admin");
return 0;
}
if(parc > 2)
{
sendto_match_servs(source_p, parv[2], CAP_ENCAP, NOCAPS,
"ENCAP %s MODUNLOAD %s", parv[2], parv[1]);
if (match(parv[2], me.name) == 0)
return 0;
}
return do_modunload(source_p, parv[1]);
}
static int
me_modunload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_MODULE))
{
sendto_one_notice(source_p, ":*** You do not have an appropriate shared block "
"to load modules on this server.");
return 0;
}
return do_modunload(source_p, parv[1]);
}
static int
do_modunload(struct Client *source_p, const char *module) do_modunload(struct Client *source_p, const char *module)
{ {
int modindex; int modindex;
@ -430,14 +533,14 @@ do_modunload(struct Client *source_p, const char *module)
{ {
sendto_one_notice(source_p, ":Module %s is not loaded", m_bn); sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
rb_free(m_bn); rb_free(m_bn);
return 0; return;
} }
if(modlist[modindex]->core == 1) if(modlist[modindex]->core == 1)
{ {
sendto_one_notice(source_p, ":Module %s is a core module and may not be unloaded", m_bn); sendto_one_notice(source_p, ":Module %s is a core module and may not be unloaded", m_bn);
rb_free(m_bn); rb_free(m_bn);
return 0; return;
} }
if(unload_one_module(m_bn, 1) == -1) if(unload_one_module(m_bn, 1) == -1)
@ -446,45 +549,9 @@ do_modunload(struct Client *source_p, const char *module)
} }
rb_free(m_bn); rb_free(m_bn);
return 0;
} }
/* unload and load in one! */ static void
static int
mo_modreload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!IsOperAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "admin");
return 0;
}
if(parc > 2)
{
sendto_match_servs(source_p, parv[2], CAP_ENCAP, NOCAPS,
"ENCAP %s MODRELOAD %s", parv[2], parv[1]);
if (match(parv[2], me.name) == 0)
return 0;
}
return do_modreload(source_p, parv[1]);
}
static int
me_modreload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_MODULE))
{
sendto_one_notice(source_p, ":*** You do not have an appropriate shared block "
"to load modules on this server.");
return 0;
}
return do_modreload(source_p, parv[1]);
}
static int
do_modreload(struct Client *source_p, const char *module) do_modreload(struct Client *source_p, const char *module)
{ {
int modindex; int modindex;
@ -495,7 +562,7 @@ do_modreload(struct Client *source_p, const char *module)
{ {
sendto_one_notice(source_p, ":Module %s is not loaded", m_bn); sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
rb_free(m_bn); rb_free(m_bn);
return 0; return;
} }
check_core = modlist[modindex]->core; check_core = modlist[modindex]->core;
@ -504,7 +571,7 @@ do_modreload(struct Client *source_p, const char *module)
{ {
sendto_one_notice(source_p, ":Module %s is not loaded", m_bn); sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
rb_free(m_bn); rb_free(m_bn);
return 0; return;
} }
if((load_one_module(m_bn, modlist[modindex]->origin, check_core) == -1) && check_core) if((load_one_module(m_bn, modlist[modindex]->origin, check_core) == -1) && check_core)
@ -516,45 +583,30 @@ do_modreload(struct Client *source_p, const char *module)
} }
rb_free(m_bn); rb_free(m_bn);
return 0;
} }
/* list modules .. */ static void
static int do_modrestart(struct Client *source_p)
mo_modlist(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{ {
if(!IsOperAdmin(source_p)) int modnum;
{
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one_notice(source_p, ":Reloading all modules");
me.name, source_p->name, "admin");
return 0; modnum = num_mods;
while (num_mods)
unload_one_module(modlist[0]->name, 0);
load_all_modules(0);
load_core_modules(0);
rehash(0);
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
"Module Restart: %d modules unloaded, %d modules loaded",
modnum, num_mods);
ilog(L_MAIN, "Module Restart: %d modules unloaded, %d modules loaded", modnum, num_mods);
} }
if(parc > 2) static void
{
sendto_match_servs(source_p, parv[2], CAP_ENCAP, NOCAPS,
"ENCAP %s MODLIST %s", parv[2], parv[1]);
if (match(parv[2], me.name) == 0)
return 0;
}
return do_modlist(source_p, parc > 1 ? parv[1] : 0);
}
static int
me_modlist(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_MODULE))
{
sendto_one_notice(source_p, ":*** You do not have an appropriate shared block "
"to load modules on this server.");
return 0;
}
return do_modlist(source_p, parv[1]);
}
static int
do_modlist(struct Client *source_p, const char *pattern) do_modlist(struct Client *source_p, const char *pattern)
{ {
int i; int i;
@ -596,67 +648,8 @@ do_modlist(struct Client *source_p, const char *pattern)
} }
sendto_one(source_p, form_str(RPL_ENDOFMODLIST), me.name, source_p->name); sendto_one(source_p, form_str(RPL_ENDOFMODLIST), me.name, source_p->name);
return 0;
} }
/* unload and reload all modules */
static int
mo_modrestart(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!IsOperAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "admin");
return 0;
}
if(parc > 1)
{
sendto_match_servs(source_p, parv[1], CAP_ENCAP, NOCAPS,
"ENCAP %s MODRESTART", parv[1]);
if (match(parv[1], me.name) == 0)
return 0;
}
return do_modrestart(source_p);
}
static int
me_modrestart(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_MODULE))
{
sendto_one_notice(source_p, ":*** You do not have an appropriate shared block "
"to load modules on this server.");
return 0;
}
return do_modrestart(source_p);
}
static int
do_modrestart(struct Client *source_p)
{
int modnum;
sendto_one_notice(source_p, ":Reloading all modules");
modnum = num_mods;
while (num_mods)
unload_one_module(modlist[0]->name, 0);
load_all_modules(0);
load_core_modules(0);
rehash(0);
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
"Module Restart: %d modules unloaded, %d modules loaded",
modnum, num_mods);
ilog(L_MAIN, "Module Restart: %d modules unloaded, %d modules loaded", modnum, num_mods);
return 0;
}
static void increase_modlist(void); static void increase_modlist(void);
#define MODS_INCREMENT 10 #define MODS_INCREMENT 10

View file

@ -567,14 +567,13 @@ static void do_alias(struct alias_entry *aptr, struct Client *source_p, char *te
text); text);
} }
int void
m_not_oper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_not_oper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str(ERR_NOPRIVILEGES)); sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str(ERR_NOPRIVILEGES));
return 0;
} }
int void
m_unregistered(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_unregistered(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
/* bit of a hack. /* bit of a hack.
@ -587,19 +586,16 @@ m_unregistered(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
sendto_one(client_p, form_str(ERR_NOTREGISTERED), me.name); sendto_one(client_p, form_str(ERR_NOTREGISTERED), me.name);
client_p->localClient->number_of_nick_changes++; client_p->localClient->number_of_nick_changes++;
} }
return 0;
} }
int void
m_registered(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_registered(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
sendto_one(client_p, form_str(ERR_ALREADYREGISTRED), me.name, source_p->name); sendto_one(client_p, form_str(ERR_ALREADYREGISTRED), me.name, source_p->name);
return 0;
} }
int void
m_ignore(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_ignore(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
return 0; /* Does nothing */
} }

View file

@ -48,8 +48,8 @@
static const char ban_desc[] = "Provides the TS6 BAN command for propagating network-wide bans"; static const char ban_desc[] = "Provides the TS6 BAN command for propagating network-wide bans";
static int m_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void m_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message ban_msgtab = { struct Message ban_msgtab = {
"BAN", 0, 0, 0, 0, "BAN", 0, 0, 0, 0,
@ -60,14 +60,13 @@ mapi_clist_av1 ban_clist[] = { &ban_msgtab, NULL };
DECLARE_MODULE_AV2(ban, NULL, NULL, ban_clist, NULL, NULL, NULL, NULL, ban_desc); DECLARE_MODULE_AV2(ban, NULL, NULL, ban_clist, NULL, NULL, NULL, NULL, ban_desc);
static int static void
m_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
sendto_one_notice(source_p, ":The BAN command is not user-accessible."); sendto_one_notice(source_p, ":The BAN command is not user-accessible.");
sendto_one_notice(source_p, ":To ban a user from a channel, see /QUOTE HELP CMODE"); sendto_one_notice(source_p, ":To ban a user from a channel, see /QUOTE HELP CMODE");
if (IsOper(source_p)) if (IsOper(source_p))
sendto_one_notice(source_p, ":To ban a user from a server or from the network, see /QUOTE HELP KLINE"); sendto_one_notice(source_p, ":To ban a user from a server or from the network, see /QUOTE HELP KLINE");
return 0;
} }
/* ms_ban() /* ms_ban()
@ -81,7 +80,7 @@ m_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
* parv[7] - oper or * * parv[7] - oper or *
* parv[8] - reason (possibly with |operreason) * parv[8] - reason (possibly with |operreason)
*/ */
static int static void
ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
rb_dlink_node *ptr; rb_dlink_node *ptr;
@ -99,7 +98,7 @@ ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
"Unknown BAN type %s from %s", "Unknown BAN type %s from %s",
parv[1], source_p->name); parv[1], source_p->name);
return 0; return;
} }
switch (parv[1][0]) switch (parv[1][0])
{ {
@ -120,7 +119,7 @@ ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
"Unknown BAN type %s from %s", "Unknown BAN type %s from %s",
parv[1], source_p->name); parv[1], source_p->name);
return 0; return;
} }
created = atol(parv[4]); created = atol(parv[4]);
hold = created + atoi(parv[5]); hold = created + atoi(parv[5]);
@ -145,7 +144,7 @@ ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
aconf->user ? aconf->user : "", aconf->user ? aconf->user : "",
aconf->user ? "@" : "", aconf->user ? "@" : "",
aconf->host); aconf->host);
return 0; return;
} }
/* act indicates if something happened (from the oper's /* act indicates if something happened (from the oper's
* point of view). This is the case if the ban was * point of view). This is the case if the ban was
@ -158,7 +157,7 @@ ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
aconf->lifetime = lifetime; aconf->lifetime = lifetime;
/* already expired, hmm */ /* already expired, hmm */
if (aconf->lifetime <= now) if (aconf->lifetime <= now)
return 0; return;
/* Deactivate, it will be reactivated later if appropriate. */ /* Deactivate, it will be reactivated later if appropriate. */
deactivate_conf(aconf, ptr, now); deactivate_conf(aconf, ptr, now);
rb_free(aconf->user); rb_free(aconf->user);
@ -336,5 +335,4 @@ ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
parv[6], parv[6],
parv[7], parv[7],
parv[parc - 1]); parv[parc - 1]);
return 0;
} }

View file

@ -38,9 +38,9 @@
static const char die_desc[] = "Provides the DIE command to allow an operator to shutdown a server"; static const char die_desc[] = "Provides the DIE command to allow an operator to shutdown a server";
static int mo_die(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_die(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_die(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_die(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int do_die(struct Client *, const char *); static void do_die(struct Client *, const char *);
static struct Message die_msgtab = { static struct Message die_msgtab = {
"DIE", 0, 0, 0, 0, "DIE", 0, 0, 0, 0,
@ -54,19 +54,19 @@ DECLARE_MODULE_AV2(die, NULL, NULL, die_clist, NULL, NULL, NULL, NULL, die_desc)
/* /*
* mo_die - DIE command handler * mo_die - DIE command handler
*/ */
static int static void
mo_die(struct MsgBuf *msgbuf_p __unused, struct Client *client_p __unused, struct Client *source_p, int parc, const char *parv[]) mo_die(struct MsgBuf *msgbuf_p __unused, struct Client *client_p __unused, struct Client *source_p, int parc, const char *parv[])
{ {
if(!IsOperDie(source_p)) if(!IsOperDie(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "die"); sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "die");
return 0; return;
} }
if(parc < 2 || EmptyString(parv[1])) if(parc < 2 || EmptyString(parv[1]))
{ {
sendto_one_notice(source_p, ":Need server name /die %s", me.name); sendto_one_notice(source_p, ":Need server name /die %s", me.name);
return 0; return;
} }
if(parc > 2) if(parc > 2)
@ -76,42 +76,40 @@ mo_die(struct MsgBuf *msgbuf_p __unused, struct Client *client_p __unused, struc
if (!server_p) if (!server_p)
{ {
sendto_one_numeric(source_p, ERR_NOSUCHSERVER, form_str(ERR_NOSUCHSERVER), parv[2]); sendto_one_numeric(source_p, ERR_NOSUCHSERVER, form_str(ERR_NOSUCHSERVER), parv[2]);
return 0; return;
} }
if (!IsMe(server_p)) if (!IsMe(server_p))
{ {
sendto_one(server_p, ":%s ENCAP %s DIE %s", source_p->name, parv[2], parv[1]); sendto_one(server_p, ":%s ENCAP %s DIE %s", source_p->name, parv[2], parv[1]);
return 0; return;
} }
} }
return do_die(source_p, parv[1]); do_die(source_p, parv[1]);
} }
static int static void
me_die(struct MsgBuf *msgbuf_p __unused, struct Client *client_p __unused, struct Client *source_p, int parc, const char *parv[]) me_die(struct MsgBuf *msgbuf_p __unused, struct Client *client_p __unused, struct Client *source_p, int parc, const char *parv[])
{ {
if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_DIE)) if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_DIE))
{ {
sendto_one_notice(source_p, ":*** You do not have an appropriate shared block to " sendto_one_notice(source_p, ":*** You do not have an appropriate shared block to "
"remotely shut down this server."); "remotely shut down this server.");
return 0; return;
} }
return do_die(source_p, parv[1]); do_die(source_p, parv[1]);
} }
static int static void
do_die(struct Client *source_p, const char *servername) do_die(struct Client *source_p, const char *servername)
{ {
if(irccmp(servername, me.name)) if(irccmp(servername, me.name))
{ {
sendto_one_notice(source_p, ":Mismatch on /die %s", me.name); sendto_one_notice(source_p, ":Mismatch on /die %s", me.name);
return 0; return;
} }
ircd_shutdown(get_client_name(source_p, HIDE_IP)); ircd_shutdown(get_client_name(source_p, HIDE_IP));
return 0;
} }

View file

@ -36,8 +36,8 @@
static const char error_desc[] = static const char error_desc[] =
"Provides the ERROR command for clients and servers"; "Provides the ERROR command for clients and servers";
static int m_error(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_error(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_error(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_error(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message error_msgtab = { struct Message error_msgtab = {
"ERROR", 0, 0, 0, 0, "ERROR", 0, 0, 0, 0,
@ -51,34 +51,34 @@ mapi_clist_av1 error_clist[] = {
DECLARE_MODULE_AV2(error, NULL, NULL, error_clist, NULL, NULL, NULL, NULL, error_desc); DECLARE_MODULE_AV2(error, NULL, NULL, error_clist, NULL, NULL, NULL, NULL, error_desc);
/* Determine whether an ERROR message is safe to show (no IP address in it) */ /* Determine whether an ERROR message is safe to show (no IP address in it) */
static int static bool
is_safe_error(const char *message) is_safe_error(const char *message)
{ {
char prefix2[100]; char prefix2[100];
const char *p; const char *p;
if (!strncmp(message, "Closing Link: 127.0.0.1 (", 25)) if (!strncmp(message, "Closing Link: 127.0.0.1 (", 25))
return 1; return true;
snprintf(prefix2, sizeof prefix2, snprintf(prefix2, sizeof prefix2,
"Closing Link: 127.0.0.1 %s (", me.name); "Closing Link: 127.0.0.1 %s (", me.name);
if (!strncmp(message, prefix2, strlen(prefix2))) if (!strncmp(message, prefix2, strlen(prefix2)))
return 1; return true;
if (!strncmp(message, "Restart by ", 11)) if (!strncmp(message, "Restart by ", 11))
return 1; return true;
if (!strncmp(message, "Terminated by ", 14)) if (!strncmp(message, "Terminated by ", 14))
return 1; return true;
if (!ircncmp(message, "Closing Link", 12)) if (!ircncmp(message, "Closing Link", 12))
return 0; return false;
if (strchr(message, '[')) if (strchr(message, '['))
return 0; return false;
p = strchr(message, '.'); p = strchr(message, '.');
if (p != NULL && p[1] != '\0') if (p != NULL && p[1] != '\0')
return 0; return false;
if (strchr(message, ':')) if (strchr(message, ':'))
return 0; return false;
return 1; return true;
} }
/* /*
@ -88,7 +88,7 @@ is_safe_error(const char *message)
* *
* parv[*] = parameters * parv[*] = parameters
*/ */
int static void
m_error(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_error(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
const char *para; const char *para;
@ -117,11 +117,9 @@ m_error(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
} }
exit_client(client_p, source_p, source_p, "ERROR"); exit_client(client_p, source_p, source_p, "ERROR");
return 0;
} }
static int static void
ms_error(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_error(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
const char *para; const char *para;
@ -135,7 +133,7 @@ ms_error(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(is_safe_error(para)) if(is_safe_error(para))
hideit = 0; hideit = 0;
if(hideit == 2) if(hideit == 2)
return 0; return;
if(client_p == source_p) if(client_p == source_p)
{ {
@ -147,6 +145,4 @@ ms_error(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
sendto_realops_snomask(SNO_GENERAL, hideit ? L_ADMIN : L_ALL, "ERROR :from %s via %s -- %s", sendto_realops_snomask(SNO_GENERAL, hideit ? L_ADMIN : L_ALL, "ERROR :from %s via %s -- %s",
source_p->name, client_p->name, para); source_p->name, client_p->name, para);
} }
return 0;
} }

View file

@ -44,9 +44,9 @@
static const char join_desc[] = "Provides the JOIN and TS6 SJOIN commands to facilitate joining and creating channels"; static const char join_desc[] = "Provides the JOIN and TS6 SJOIN commands to facilitate joining and creating channels";
static int m_join(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_join(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_join(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_join(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_sjoin(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_sjoin(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int h_can_create_channel; static int h_can_create_channel;
static int h_channel_join; static int h_channel_join;
@ -72,7 +72,7 @@ mapi_hlist_av1 join_hlist[] = {
DECLARE_MODULE_AV2(join, NULL, NULL, join_clist, join_hlist, NULL, NULL, NULL, join_desc); DECLARE_MODULE_AV2(join, NULL, NULL, join_clist, join_hlist, NULL, NULL, NULL, join_desc);
static void do_join_0(struct Client *client_p, struct Client *source_p); static void do_join_0(struct Client *client_p, struct Client *source_p);
static int check_channel_name_loc(struct Client *source_p, const char *name); static bool check_channel_name_loc(struct Client *source_p, const char *name);
static void send_join_error(struct Client *source_p, int numeric, const char *name); static void send_join_error(struct Client *source_p, int numeric, const char *name);
static void set_final_mode(struct Mode *mode, struct Mode *oldmode); static void set_final_mode(struct Mode *mode, struct Mode *oldmode);
@ -138,7 +138,7 @@ check_forward(struct Client *source_p, struct Channel *chptr,
* parv[1] = channel * parv[1] = channel
* parv[2] = channel password (key) * parv[2] = channel password (key)
*/ */
static int static void
m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
static char jbuf[BUFSIZE]; static char jbuf[BUFSIZE];
@ -380,8 +380,6 @@ m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
hook_info.key = key; hook_info.key = key;
call_hook(h_channel_join, &hook_info); call_hook(h_channel_join, &hook_info);
} }
return 0;
} }
/* /*
@ -391,7 +389,7 @@ m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
* parv[3] = "+", formerly channel modes but now unused * parv[3] = "+", formerly channel modes but now unused
* alternatively, a single "0" parameter parts all channels * alternatively, a single "0" parameter parts all channels
*/ */
static int static void
ms_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Channel *chptr; struct Channel *chptr;
@ -399,32 +397,32 @@ ms_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
time_t oldts; time_t oldts;
time_t newts; time_t newts;
int isnew; int isnew;
int keep_our_modes = YES; bool keep_our_modes = true;
rb_dlink_node *ptr, *next_ptr; rb_dlink_node *ptr, *next_ptr;
/* special case for join 0 */ /* special case for join 0 */
if((parv[1][0] == '0') && (parv[1][1] == '\0') && parc == 2) if((parv[1][0] == '0') && (parv[1][1] == '\0') && parc == 2)
{ {
do_join_0(client_p, source_p); do_join_0(client_p, source_p);
return 0; return;
} }
if(parc < 4) if(parc < 4)
return 0; return;
if(!IsChannelName(parv[2]) || !check_channel_name(parv[2])) if(!IsChannelName(parv[2]) || !check_channel_name(parv[2]))
return 0; return;
/* joins for local channels cant happen. */ /* joins for local channels cant happen. */
if(parv[2][0] == '&') if(parv[2][0] == '&')
return 0; return;
mbuf = modebuf; mbuf = modebuf;
mode.key[0] = mode.forward[0] = '\0'; mode.key[0] = mode.forward[0] = '\0';
mode.mode = mode.limit = mode.join_num = mode.join_time = 0; mode.mode = mode.limit = mode.join_num = mode.join_time = 0;
if((chptr = get_or_create_channel(source_p, parv[2], &isnew)) == NULL) if((chptr = get_or_create_channel(source_p, parv[2], &isnew)) == NULL)
return 0; return;
newts = atol(parv[1]); newts = atol(parv[1]);
oldts = chptr->channelts; oldts = chptr->channelts;
@ -458,7 +456,7 @@ ms_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
; ;
else if(newts < oldts) else if(newts < oldts)
{ {
keep_our_modes = NO; keep_our_modes = false;
chptr->channelts = newts; chptr->channelts = newts;
} }
@ -508,10 +506,9 @@ ms_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
sendto_server(client_p, chptr, CAP_TS6, NOCAPS, sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s JOIN %ld %s +", ":%s JOIN %ld %s +",
source_p->id, (long) chptr->channelts, chptr->chname); source_p->id, (long) chptr->channelts, chptr->chname);
return 0;
} }
static int static void
ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
static char buf_uid[BUFSIZE]; static char buf_uid[BUFSIZE];
@ -523,8 +520,8 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
static struct Mode mode, *oldmode; static struct Mode mode, *oldmode;
const char *modes; const char *modes;
int args = 0; int args = 0;
int keep_our_modes = 1; bool keep_our_modes = true;
int keep_new_modes = 1; bool keep_new_modes = true;
int fl; int fl;
int isnew; int isnew;
int mlen_uid; int mlen_uid;
@ -539,14 +536,14 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
rb_dlink_node *ptr, *next_ptr; rb_dlink_node *ptr, *next_ptr;
if(parc < 5) if(parc < 5)
return 0; return;
if(!IsChannelName(parv[2]) || !check_channel_name(parv[2])) if(!IsChannelName(parv[2]) || !check_channel_name(parv[2]))
return 0; return;
/* SJOIN's for local channels can't happen. */ /* SJOIN's for local channels can't happen. */
if(*parv[2] == '&') if(*parv[2] == '&')
return 0; return;
modebuf[0] = parabuf[0] = mode.key[0] = mode.forward[0] = '\0'; modebuf[0] = parabuf[0] = mode.key[0] = mode.forward[0] = '\0';
pargs = mode.mode = mode.limit = mode.join_num = mode.join_time = 0; pargs = mode.mode = mode.limit = mode.join_num = mode.join_time = 0;
@ -569,7 +566,7 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
rb_strlcpy(mode.forward, parv[4 + args], sizeof(mode.forward)); rb_strlcpy(mode.forward, parv[4 + args], sizeof(mode.forward));
args++; args++;
if(parc < 5 + args) if(parc < 5 + args)
return 0; return;
break; break;
case 'j': case 'j':
sscanf(parv[4 + args], "%d:%d", &joinc, &timeslice); sscanf(parv[4 + args], "%d:%d", &joinc, &timeslice);
@ -577,19 +574,19 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
mode.join_num = joinc; mode.join_num = joinc;
mode.join_time = timeslice; mode.join_time = timeslice;
if(parc < 5 + args) if(parc < 5 + args)
return 0; return;
break; break;
case 'k': case 'k':
rb_strlcpy(mode.key, parv[4 + args], sizeof(mode.key)); rb_strlcpy(mode.key, parv[4 + args], sizeof(mode.key));
args++; args++;
if(parc < 5 + args) if(parc < 5 + args)
return 0; return;
break; break;
case 'l': case 'l':
mode.limit = atoi(parv[4 + args]); mode.limit = atoi(parv[4 + args]);
args++; args++;
if(parc < 5 + args) if(parc < 5 + args)
return 0; return;
break; break;
default: default:
if(chmode_flags[(int) *s] != 0) if(chmode_flags[(int) *s] != 0)
@ -611,7 +608,7 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
s = ""; s = "";
if((chptr = get_or_create_channel(source_p, parv[2], &isnew)) == NULL) if((chptr = get_or_create_channel(source_p, parv[2], &isnew)) == NULL)
return 0; /* channel name too long? */ return; /* channel name too long? */
oldts = chptr->channelts; oldts = chptr->channelts;
@ -684,16 +681,16 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
/* Channel was emptied, create a new one */ /* Channel was emptied, create a new one */
if((chptr = get_or_create_channel(source_p, parv[2], &isnew)) == NULL) if((chptr = get_or_create_channel(source_p, parv[2], &isnew)) == NULL)
return 0; /* oops! */ return; /* oops! */
oldmode = &chptr->mode; oldmode = &chptr->mode;
} }
} }
keep_our_modes = NO; keep_our_modes = false;
chptr->channelts = newts; chptr->channelts = newts;
} }
else else
keep_new_modes = NO; keep_new_modes = false;
if(!keep_new_modes) if(!keep_new_modes)
mode = *oldmode; mode = *oldmode;
@ -936,7 +933,7 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
destroy_channel(chptr); destroy_channel(chptr);
return 0; return;
} }
/* Keep the colon if we're sending an SJOIN without nicks -- jilles */ /* Keep the colon if we're sending an SJOIN without nicks -- jilles */
@ -946,8 +943,6 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
} }
sendto_server(client_p->from, NULL, CAP_TS6, NOCAPS, "%s", buf_uid); sendto_server(client_p->from, NULL, CAP_TS6, NOCAPS, "%s", buf_uid);
return 0;
} }
/* /*
@ -986,21 +981,21 @@ do_join_0(struct Client *client_p, struct Client *source_p)
} }
} }
static int static bool
check_channel_name_loc(struct Client *source_p, const char *name) check_channel_name_loc(struct Client *source_p, const char *name)
{ {
const char *p; const char *p;
s_assert(name != NULL); s_assert(name != NULL);
if(EmptyString(name)) if(EmptyString(name))
return 0; return false;
if(ConfigFileEntry.disable_fake_channels && !IsOper(source_p)) if(ConfigFileEntry.disable_fake_channels && !IsOper(source_p))
{ {
for(p = name; *p; ++p) for(p = name; *p; ++p)
{ {
if(!IsChanChar(*p) || IsFakeChanChar(*p)) if(!IsChanChar(*p) || IsFakeChanChar(*p))
return 0; return false;
} }
} }
else else
@ -1008,7 +1003,7 @@ check_channel_name_loc(struct Client *source_p, const char *name)
for(p = name; *p; ++p) for(p = name; *p; ++p)
{ {
if(!IsChanChar(*p)) if(!IsChanChar(*p))
return 0; return false;
} }
} }
@ -1016,10 +1011,10 @@ check_channel_name_loc(struct Client *source_p, const char *name)
{ {
for(p = name; *p; ++p) for(p = name; *p; ++p)
if(*p < 33 || *p > 126) if(*p < 33 || *p > 126)
return 0; return false;
} }
return 1; return true;
} }
/* send_join_error() /* send_join_error()

View file

@ -39,7 +39,7 @@
static const char kick_desc[] = "Provides the KICK command to remove a user from a channel"; static const char kick_desc[] = "Provides the KICK command to remove a user from a channel";
static int m_kick(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_kick(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
#define mg_kick { m_kick, 3 } #define mg_kick { m_kick, 3 }
struct Message kick_msgtab = { struct Message kick_msgtab = {
@ -57,7 +57,7 @@ DECLARE_MODULE_AV2(kick, NULL, NULL, kick_clist, NULL, NULL, NULL, NULL, kick_de
** parv[2] = client to kick ** parv[2] = client to kick
** parv[3] = kick comment ** parv[3] = kick comment
*/ */
static int static void
m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct membership *msptr; struct membership *msptr;
@ -83,7 +83,7 @@ m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
if(chptr == NULL) if(chptr == NULL)
{ {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name); sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
return 0; return;
} }
if(!IsServer(source_p)) if(!IsServer(source_p))
@ -94,7 +94,7 @@ m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
{ {
sendto_one_numeric(source_p, ERR_NOTONCHANNEL, sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), name); form_str(ERR_NOTONCHANNEL), name);
return 0; return;
} }
if(get_channel_access(source_p, chptr, msptr, MODE_ADD, NULL) < CHFL_CHANOP) if(get_channel_access(source_p, chptr, msptr, MODE_ADD, NULL) < CHFL_CHANOP)
@ -103,7 +103,7 @@ m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
{ {
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, name); me.name, source_p->name, name);
return 0; return;
} }
/* If its a TS 0 channel, do it the old way */ /* If its a TS 0 channel, do it the old way */
@ -124,7 +124,7 @@ m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
if(!(who = find_chasing(source_p, user, &chasing))) if(!(who = find_chasing(source_p, user, &chasing)))
{ {
return 0; return;
} }
msptr = find_channel_membership(chptr, who); msptr = find_channel_membership(chptr, who);
@ -135,7 +135,7 @@ m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
{ {
sendto_one(source_p, form_str(ERR_ISCHANSERVICE), sendto_one(source_p, form_str(ERR_ISCHANSERVICE),
me.name, source_p->name, who->name, chptr->chname); me.name, source_p->name, who->name, chptr->chname);
return 0; return;
} }
if(MyClient(source_p)) if(MyClient(source_p))
@ -152,7 +152,7 @@ m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
call_hook(h_can_kick, &hookdata); call_hook(h_can_kick, &hookdata);
if (!hookdata.approved) if (!hookdata.approved)
return 0; return;
} }
comment = LOCAL_COPY((EmptyString(parv[3])) ? who->name : parv[3]); comment = LOCAL_COPY((EmptyString(parv[3])) ? who->name : parv[3]);
@ -183,6 +183,4 @@ m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
else if (MyClient(source_p)) else if (MyClient(source_p))
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL, sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), user, name); form_str(ERR_USERNOTINCHANNEL), user, name);
return 0;
} }

View file

@ -43,8 +43,8 @@ static const char kill_desc[] = "Provides the KILL command to remove a user from
static int h_can_kill; static int h_can_kill;
static char buf[BUFSIZE]; static char buf[BUFSIZE];
static int ms_kill(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_kill(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_kill(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_kill(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void relay_kill(struct Client *, struct Client *, struct Client *, static void relay_kill(struct Client *, struct Client *, struct Client *,
const char *, const char *); const char *, const char *);
@ -67,7 +67,7 @@ DECLARE_MODULE_AV2(kill, NULL, NULL, kill_clist, kill_hlist, NULL, NULL, NULL, k
** parv[1] = kill victim ** parv[1] = kill victim
** parv[2] = kill path ** parv[2] = kill path
*/ */
static int static void
mo_kill(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_kill(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -81,7 +81,7 @@ mo_kill(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if(!IsOperLocalKill(source_p)) if(!IsOperLocalKill(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "local_kill"); sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "local_kill");
return 0; return;
} }
if(!EmptyString(parv[2])) if(!EmptyString(parv[2]))
@ -109,7 +109,7 @@ mo_kill(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
else else
sendto_one_numeric(source_p, ERR_NOSUCHNICK, sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), user); form_str(ERR_NOSUCHNICK), user);
return 0; return;
} }
sendto_one_notice(source_p, ":KILL changed from %s to %s", user, target_p->name); sendto_one_notice(source_p, ":KILL changed from %s to %s", user, target_p->name);
} }
@ -119,7 +119,7 @@ mo_kill(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
sendto_one_notice(source_p, ":Nick %s is not on your server " sendto_one_notice(source_p, ":Nick %s is not on your server "
"and you do not have the global_kill flag", "and you do not have the global_kill flag",
target_p->name); target_p->name);
return 0; return;
} }
/* Last chance to stop the kill */ /* Last chance to stop the kill */
@ -130,7 +130,7 @@ mo_kill(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if (moduledata.approved == 0) if (moduledata.approved == 0)
/* The callee should have sent a message. */ /* The callee should have sent a message. */
return 0; return;
if(MyConnect(target_p)) if(MyConnect(target_p))
sendto_one(target_p, ":%s!%s@%s KILL %s :%s", sendto_one(target_p, ":%s!%s@%s KILL %s :%s",
@ -168,8 +168,6 @@ mo_kill(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
sprintf(buf, "Killed (%s (%s))", source_p->name, reason); sprintf(buf, "Killed (%s (%s))", source_p->name, reason);
exit_client(client_p, target_p, source_p, buf); exit_client(client_p, target_p, source_p, buf);
return 0;
} }
/* /*
@ -177,7 +175,7 @@ mo_kill(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
* parv[1] = kill victim * parv[1] = kill victim
* parv[2] = kill path and reason * parv[2] = kill path and reason
*/ */
static int static void
ms_kill(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_kill(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -225,7 +223,7 @@ ms_kill(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one_numeric(source_p, ERR_NOSUCHNICK, sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), IsDigit(*user) ? "*" : user); form_str(ERR_NOSUCHNICK), IsDigit(*user) ? "*" : user);
return 0; return;
} }
sendto_one_notice(source_p, ":KILL changed from %s to %s", user, target_p->name); sendto_one_notice(source_p, ":KILL changed from %s to %s", user, target_p->name);
} }
@ -233,7 +231,7 @@ ms_kill(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if(IsServer(target_p) || IsMe(target_p)) if(IsServer(target_p) || IsMe(target_p))
{ {
sendto_one_numeric(source_p, ERR_CANTKILLSERVER, form_str(ERR_CANTKILLSERVER)); sendto_one_numeric(source_p, ERR_CANTKILLSERVER, form_str(ERR_CANTKILLSERVER));
return 0; return;
} }
if(MyConnect(target_p)) if(MyConnect(target_p))
@ -287,8 +285,6 @@ ms_kill(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
sprintf(buf, "Killed (%s %s)", source_p->name, reason); sprintf(buf, "Killed (%s %s)", source_p->name, reason);
exit_client(client_p, target_p, source_p, buf); exit_client(client_p, target_p, source_p, buf);
return 0;
} }
static void static void

View file

@ -47,9 +47,9 @@
static const char message_desc[] = static const char message_desc[] =
"Provides the PRIVMSG and NOTICE commands to send messages to users and channels"; "Provides the PRIVMSG and NOTICE commands to send messages to users and channels";
static int m_message(enum message_type, struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_message(enum message_type, struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int m_privmsg(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_privmsg(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int m_notice(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_notice(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void expire_tgchange(void *unused); static void expire_tgchange(void *unused);
static struct ev_entry *expire_tgchange_event; static struct ev_entry *expire_tgchange_event;
@ -92,7 +92,7 @@ static int build_target_list(enum message_type msgtype,
struct Client *client_p, struct Client *client_p,
struct Client *source_p, const char *nicks_channels, const char *text); struct Client *source_p, const char *nicks_channels, const char *text);
static int flood_attack_client(enum message_type msgtype, struct Client *source_p, struct Client *target_p); static bool flood_attack_client(enum message_type msgtype, struct Client *source_p, struct Client *target_p);
/* Fifteen seconds should be plenty for a client to reply a ctcp */ /* Fifteen seconds should be plenty for a client to reply a ctcp */
#define LARGE_CTCP_TIME 15 #define LARGE_CTCP_TIME 15
@ -106,7 +106,7 @@ static int flood_attack_client(enum message_type msgtype, struct Client *source_
static struct entity targets[512]; static struct entity targets[512];
static int ntargets = 0; static int ntargets = 0;
static int duplicate_ptr(void *); static bool duplicate_ptr(void *);
static void msg_channel(enum message_type msgtype, static void msg_channel(enum message_type msgtype,
struct Client *client_p, struct Client *client_p,
@ -152,16 +152,16 @@ const char *cmdname[MESSAGE_TYPE_COUNT] = {
[MESSAGE_TYPE_NOTICE] = "NOTICE", [MESSAGE_TYPE_NOTICE] = "NOTICE",
}; };
static int static void
m_privmsg(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_privmsg(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
return m_message(MESSAGE_TYPE_PRIVMSG, msgbuf_p, client_p, source_p, parc, parv); m_message(MESSAGE_TYPE_PRIVMSG, msgbuf_p, client_p, source_p, parc, parv);
} }
static int static void
m_notice(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_notice(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
return m_message(MESSAGE_TYPE_NOTICE, msgbuf_p, client_p, source_p, parc, parv); m_message(MESSAGE_TYPE_NOTICE, msgbuf_p, client_p, source_p, parc, parv);
} }
/* /*
@ -170,7 +170,7 @@ m_notice(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
* - pointer to source_p * - pointer to source_p
* - pointer to channel * - pointer to channel
*/ */
static int static void
m_message(enum message_type msgtype, struct MsgBuf *msgbuf_p, m_message(enum message_type msgtype, struct MsgBuf *msgbuf_p,
struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
@ -181,14 +181,14 @@ m_message(enum message_type msgtype, struct MsgBuf *msgbuf_p,
if(msgtype != MESSAGE_TYPE_NOTICE) if(msgtype != MESSAGE_TYPE_NOTICE)
sendto_one(source_p, form_str(ERR_NORECIPIENT), me.name, sendto_one(source_p, form_str(ERR_NORECIPIENT), me.name,
source_p->name, cmdname[msgtype]); source_p->name, cmdname[msgtype]);
return 0; return;
} }
if(parc < 3 || EmptyString(parv[2])) if(parc < 3 || EmptyString(parv[2]))
{ {
if(msgtype != MESSAGE_TYPE_NOTICE) if(msgtype != MESSAGE_TYPE_NOTICE)
sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name); sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name);
return 0; return;
} }
/* Finish the flood grace period if theyre not messaging themselves /* Finish the flood grace period if theyre not messaging themselves
@ -199,7 +199,7 @@ m_message(enum message_type msgtype, struct MsgBuf *msgbuf_p,
if(build_target_list(msgtype, client_p, source_p, parv[1], parv[2]) < 0) if(build_target_list(msgtype, client_p, source_p, parv[1], parv[2]) < 0)
{ {
return 0; return;
} }
for(i = 0; i < ntargets; i++) for(i = 0; i < ntargets; i++)
@ -228,8 +228,6 @@ m_message(enum message_type msgtype, struct MsgBuf *msgbuf_p,
break; break;
} }
} }
return 0;
} }
/* /*
@ -447,18 +445,18 @@ build_target_list(enum message_type msgtype, struct Client *client_p,
* inputs - pointer to check * inputs - pointer to check
* - pointer to table of entities * - pointer to table of entities
* - number of valid entities so far * - number of valid entities so far
* output - YES if duplicate pointer in table, NO if not. * output - true if duplicate pointer in table, false if not.
* note, this does the canonize using pointers * note, this does the canonize using pointers
* side effects - NONE * side effects - NONE
*/ */
static int static bool
duplicate_ptr(void *ptr) duplicate_ptr(void *ptr)
{ {
int i; int i;
for(i = 0; i < ntargets; i++) for(i = 0; i < ntargets; i++)
if(targets[i].ptr == ptr) if(targets[i].ptr == ptr)
return YES; return true;
return NO; return false;
} }
/* /*
@ -879,13 +877,13 @@ msg_client(enum message_type msgtype,
/* /*
* flood_attack_client * flood_attack_client
* inputs - flag 0 if PRIVMSG 1 if NOTICE. RFC * inputs - flag 0 if PRIVMSG 1 if NOTICE. RFC
* say NOTICE must not auto reply * says NOTICE must not auto reply
* - pointer to source Client * - pointer to source Client
* - pointer to target Client * - pointer to target Client
* output - 1 if target is under flood attack * output - true if target is under flood attack
* side effects - check for flood attack on target target_p * side effects - check for flood attack on target target_p
*/ */
static int static bool
flood_attack_client(enum message_type msgtype, struct Client *source_p, struct Client *target_p) flood_attack_client(enum message_type msgtype, struct Client *source_p, struct Client *target_p)
{ {
int delta; int delta;
@ -927,13 +925,13 @@ flood_attack_client(enum message_type msgtype, struct Client *source_p, struct C
sendto_one(source_p, sendto_one(source_p,
":%s NOTICE %s :*** Message to %s throttled due to flooding", ":%s NOTICE %s :*** Message to %s throttled due to flooding",
me.name, source_p->name, target_p->name); me.name, source_p->name, target_p->name);
return 1; return true;
} }
else else
target_p->received_number_of_privmsgs++; target_p->received_number_of_privmsgs++;
} }
return 0; return false;
} }
/* /*

View file

@ -43,11 +43,11 @@
static const char mode_desc[] = static const char mode_desc[] =
"Provides the MODE and MLOCK client and server commands, and TS6 server-to-server TMODE and BMASK commands"; "Provides the MODE and MLOCK client and server commands, and TS6 server-to-server TMODE and BMASK commands";
static int m_mode(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_mode(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_mode(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_mode(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_tmode(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_tmode(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_mlock(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_mlock(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_bmask(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_bmask(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message mode_msgtab = { struct Message mode_msgtab = {
"MODE", 0, 0, 0, 0, "MODE", 0, 0, 0, 0,
@ -74,7 +74,7 @@ DECLARE_MODULE_AV2(mode, NULL, NULL, mode_clist, NULL, NULL, NULL, NULL, mode_de
* m_mode - MODE command handler * m_mode - MODE command handler
* parv[1] - channel * parv[1] - channel
*/ */
static int static void
m_mode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_mode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Channel *chptr = NULL; struct Channel *chptr = NULL;
@ -94,7 +94,7 @@ m_mode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
{ {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
me.name, source_p->name, "MODE"); me.name, source_p->name, "MODE");
return 0; return;
} }
} }
@ -103,13 +103,13 @@ m_mode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
{ {
/* if here, it has to be a non-channel name */ /* if here, it has to be a non-channel name */
user_mode(client_p, source_p, parc, parv); user_mode(client_p, source_p, parc, parv);
return 0; return;
} }
if(!check_channel_name(dest)) if(!check_channel_name(dest))
{ {
sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), parv[1]); sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), parv[1]);
return 0; return;
} }
chptr = find_channel(dest); chptr = find_channel(dest);
@ -118,7 +118,7 @@ m_mode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
{ {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]); form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0; return;
} }
/* Now know the channel exists */ /* Now know the channel exists */
@ -147,11 +147,9 @@ m_mode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
set_channel_mode(client_p, source_p, chptr, msptr, parc - n, parv + n); set_channel_mode(client_p, source_p, chptr, msptr, parc - n, parv + n);
} }
return 0;
} }
static int static void
ms_mode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_mode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Channel *chptr; struct Channel *chptr;
@ -162,15 +160,13 @@ ms_mode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]); form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0; return;
} }
set_channel_mode(client_p, source_p, chptr, NULL, parc - 2, parv + 2); set_channel_mode(client_p, source_p, chptr, NULL, parc - 2, parv + 2);
return 0;
} }
static int static void
ms_tmode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_tmode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Channel *chptr = NULL; struct Channel *chptr = NULL;
@ -180,7 +176,7 @@ ms_tmode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(!IsChanPrefix(parv[2][0]) || !check_channel_name(parv[2])) if(!IsChanPrefix(parv[2][0]) || !check_channel_name(parv[2]))
{ {
sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), parv[2]); sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), parv[2]);
return 0; return;
} }
chptr = find_channel(parv[2]); chptr = find_channel(parv[2]);
@ -189,12 +185,12 @@ ms_tmode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[2]); form_str(ERR_NOSUCHCHANNEL), parv[2]);
return 0; return;
} }
/* TS is higher, drop it. */ /* TS is higher, drop it. */
if(atol(parv[1]) > chptr->channelts) if(atol(parv[1]) > chptr->channelts)
return 0; return;
if(IsServer(source_p)) if(IsServer(source_p))
{ {
@ -206,11 +202,9 @@ ms_tmode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
set_channel_mode(client_p, source_p, chptr, msptr, parc - 3, parv + 3); set_channel_mode(client_p, source_p, chptr, msptr, parc - 3, parv + 3);
} }
return 0;
} }
static int static void
ms_mlock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_mlock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Channel *chptr = NULL; struct Channel *chptr = NULL;
@ -219,7 +213,7 @@ ms_mlock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(!IsChanPrefix(parv[2][0]) || !check_channel_name(parv[2])) if(!IsChanPrefix(parv[2][0]) || !check_channel_name(parv[2]))
{ {
sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), parv[2]); sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), parv[2]);
return 0; return;
} }
chptr = find_channel(parv[2]); chptr = find_channel(parv[2]);
@ -228,17 +222,15 @@ ms_mlock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[2]); form_str(ERR_NOSUCHCHANNEL), parv[2]);
return 0; return;
} }
/* TS is higher, drop it. */ /* TS is higher, drop it. */
if(atol(parv[1]) > chptr->channelts) if(atol(parv[1]) > chptr->channelts)
return 0; return;
if(IsServer(source_p)) if(IsServer(source_p))
set_channel_mlock(client_p, source_p, chptr, parv[3], true); set_channel_mlock(client_p, source_p, chptr, parv[3], true);
return 0;
} }
static void static void
@ -270,7 +262,7 @@ possibly_remove_lower_forward(struct Client *fakesource_p, int mems,
} }
} }
static int static void
ms_bmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_bmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
static char modebuf[BUFSIZE]; static char modebuf[BUFSIZE];
@ -292,14 +284,14 @@ ms_bmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
struct Client *fakesource_p; struct Client *fakesource_p;
if(!IsChanPrefix(parv[2][0]) || !check_channel_name(parv[2])) if(!IsChanPrefix(parv[2][0]) || !check_channel_name(parv[2]))
return 0; return;
if((chptr = find_channel(parv[2])) == NULL) if((chptr = find_channel(parv[2])) == NULL)
return 0; return;
/* TS is higher, drop it. */ /* TS is higher, drop it. */
if(atol(parv[1]) > chptr->channelts) if(atol(parv[1]) > chptr->channelts)
return 0; return;
switch (parv[3][0]) switch (parv[3][0])
{ {
@ -331,7 +323,7 @@ ms_bmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
/* maybe we should just blindly propagate this? */ /* maybe we should just blindly propagate this? */
default: default:
return 0; return;
} }
parabuf[0] = '\0'; parabuf[0] = '\0';
@ -432,5 +424,4 @@ ms_bmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
sendto_server(client_p, chptr, CAP_TS6 | needcap, NOCAPS, ":%s BMASK %ld %s %s :%s", sendto_server(client_p, chptr, CAP_TS6 | needcap, NOCAPS, ":%s BMASK %ld %s %s :%s",
source_p->id, (long) chptr->channelts, chptr->chname, parv[3], parv[4]); source_p->id, (long) chptr->channelts, chptr->chname, parv[3], parv[4]);
return 0;
} }

View file

@ -54,16 +54,31 @@
*/ */
#define SAVE_NICKTS 100 #define SAVE_NICKTS 100
static int mr_nick(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mr_nick(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int m_nick(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_nick(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mc_nick(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mc_nick(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_nick(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_nick(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_uid(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_uid(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_euid(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_euid(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_save(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_save(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int can_save(struct Client *); static bool can_save(struct Client *);
static void save_user(struct Client *, struct Client *, struct Client *); static void save_user(struct Client *, struct Client *, struct Client *);
static void bad_nickname(struct Client *, const char *); static void bad_nickname(struct Client *, const char *);
static void change_remote_nick(struct Client *, struct Client *, time_t,
const char *, int);
static bool clean_username(const char *);
static bool clean_host(const char *);
static bool clean_uid(const char *uid, const char *sid);
static void set_initial_nick(struct Client *client_p, struct Client *source_p, char *nick);
static void change_local_nick(struct Client *client_p, struct Client *source_p, char *nick, int);
static void register_client(struct Client *client_p, struct Client *server,
const char *nick, time_t newts, int parc, const char *parv[]);
static void perform_nick_collides(struct Client *, struct Client *,
struct Client *, int, const char **,
time_t, const char *, const char *);
static void perform_nickchange_collides(struct Client *, struct Client *,
struct Client *, int, const char **, time_t, const char *);
struct Message nick_msgtab = { struct Message nick_msgtab = {
"NICK", 0, 0, 0, 0, "NICK", 0, 0, 0, 0,
@ -90,28 +105,10 @@ static const char nick_desc[] =
DECLARE_MODULE_AV2(nick, NULL, NULL, nick_clist, NULL, NULL, NULL, NULL, nick_desc); DECLARE_MODULE_AV2(nick, NULL, NULL, nick_clist, NULL, NULL, NULL, NULL, nick_desc);
static int change_remote_nick(struct Client *, struct Client *, time_t,
const char *, int);
static int clean_username(const char *);
static int clean_host(const char *);
static int clean_uid(const char *uid, const char *sid);
static void set_initial_nick(struct Client *client_p, struct Client *source_p, char *nick);
static void change_local_nick(struct Client *client_p, struct Client *source_p, char *nick, int);
static int register_client(struct Client *client_p, struct Client *server,
const char *nick, time_t newts, int parc, const char *parv[]);
static int perform_nick_collides(struct Client *, struct Client *,
struct Client *, int, const char **,
time_t, const char *, const char *);
static int perform_nickchange_collides(struct Client *, struct Client *,
struct Client *, int, const char **, time_t, const char *);
/* mr_nick() /* mr_nick()
* parv[1] = nickname * parv[1] = nickname
*/ */
static int static void
mr_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mr_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -120,14 +117,14 @@ mr_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if (strlen(client_p->id) == 3) if (strlen(client_p->id) == 3)
{ {
exit_client(client_p, client_p, client_p, "Mixing client and server protocol"); exit_client(client_p, client_p, client_p, "Mixing client and server protocol");
return 0; return;
} }
if(parc < 2 || EmptyString(parv[1])) if(parc < 2 || EmptyString(parv[1]))
{ {
sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN), sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN),
me.name, EmptyString(source_p->name) ? "*" : source_p->name); me.name, EmptyString(source_p->name) ? "*" : source_p->name);
return 0; return;
} }
/* copy the nick and terminate it */ /* copy the nick and terminate it */
@ -138,7 +135,7 @@ mr_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one(source_p, form_str(ERR_ERRONEUSNICKNAME), sendto_one(source_p, form_str(ERR_ERRONEUSNICKNAME),
me.name, EmptyString(source_p->name) ? "*" : source_p->name, parv[1]); me.name, EmptyString(source_p->name) ? "*" : source_p->name, parv[1]);
return 0; return;
} }
/* check if the nick is resv'd */ /* check if the nick is resv'd */
@ -146,14 +143,14 @@ mr_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one(source_p, form_str(ERR_ERRONEUSNICKNAME), sendto_one(source_p, form_str(ERR_ERRONEUSNICKNAME),
me.name, EmptyString(source_p->name) ? "*" : source_p->name, nick); me.name, EmptyString(source_p->name) ? "*" : source_p->name, nick);
return 0; return;
} }
if(rb_dictionary_find(nd_dict, nick)) if(rb_dictionary_find(nd_dict, nick))
{ {
sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE), sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE),
me.name, EmptyString(source_p->name) ? "*" : source_p->name, nick); me.name, EmptyString(source_p->name) ? "*" : source_p->name, nick);
return 0; return;
} }
if((target_p = find_named_client(nick)) == NULL) if((target_p = find_named_client(nick)) == NULL)
@ -162,14 +159,12 @@ mr_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
strcpy(source_p->name, nick); strcpy(source_p->name, nick);
else else
sendto_one(source_p, form_str(ERR_NICKNAMEINUSE), me.name, "*", nick); sendto_one(source_p, form_str(ERR_NICKNAMEINUSE), me.name, "*", nick);
return 0;
} }
/* m_nick() /* m_nick()
* parv[1] = nickname * parv[1] = nickname
*/ */
static int static void
m_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -178,7 +173,7 @@ m_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
if(parc < 2 || EmptyString(parv[1])) if(parc < 2 || EmptyString(parv[1]))
{ {
sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN), me.name, source_p->name); sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN), me.name, source_p->name);
return 0; return;
} }
/* mark end of grace period, to prevent nickflooding */ /* mark end of grace period, to prevent nickflooding */
@ -192,20 +187,20 @@ m_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
if(!clean_nick(nick, 1)) if(!clean_nick(nick, 1))
{ {
sendto_one(source_p, form_str(ERR_ERRONEUSNICKNAME), me.name, source_p->name, nick); sendto_one(source_p, form_str(ERR_ERRONEUSNICKNAME), me.name, source_p->name, nick);
return 0; return;
} }
if(!IsExemptResv(source_p) && find_nick_resv(nick)) if(!IsExemptResv(source_p) && find_nick_resv(nick))
{ {
sendto_one(source_p, form_str(ERR_ERRONEUSNICKNAME), me.name, source_p->name, nick); sendto_one(source_p, form_str(ERR_ERRONEUSNICKNAME), me.name, source_p->name, nick);
return 0; return;
} }
if(rb_dictionary_find(nd_dict, nick)) if(rb_dictionary_find(nd_dict, nick))
{ {
sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE), sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE),
me.name, EmptyString(source_p->name) ? "*" : source_p->name, nick); me.name, EmptyString(source_p->name) ? "*" : source_p->name, nick);
return 0; return;
} }
if((target_p = find_named_client(nick))) if((target_p = find_named_client(nick)))
@ -230,12 +225,10 @@ m_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
else else
sendto_one(source_p, form_str(ERR_NICKNAMEINUSE), me.name, source_p->name, nick); sendto_one(source_p, form_str(ERR_NICKNAMEINUSE), me.name, source_p->name, nick);
return 0; return;
} }
else else
change_local_nick(client_p, source_p, nick, 1); change_local_nick(client_p, source_p, nick, 1);
return 0;
} }
/* mc_nick() /* mc_nick()
@ -244,7 +237,7 @@ m_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
* parv[1] = nickname * parv[1] = nickname
* parv[2] = TS when nick change * parv[2] = TS when nick change
*/ */
static int static void
mc_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mc_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -254,7 +247,7 @@ mc_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if(!clean_nick(parv[1], 0)) if(!clean_nick(parv[1], 0))
{ {
bad_nickname(client_p, parv[1]); bad_nickname(client_p, parv[1]);
return 0; return;
} }
newts = atol(parv[2]); newts = atol(parv[2]);
@ -280,11 +273,9 @@ mc_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
else else
perform_nickchange_collides(source_p, client_p, target_p, perform_nickchange_collides(source_p, client_p, target_p,
parc, parv, newts, parv[1]); parc, parv, newts, parv[1]);
return 0;
} }
static int static void
ms_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
const char *nick, *server; const char *nick, *server;
@ -302,8 +293,6 @@ ms_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
client_p->name, nick, server); client_p->name, nick, server);
exit_client(client_p, client_p, &me, "TS5 nickname introduced"); exit_client(client_p, client_p, &me, "TS5 nickname introduced");
return 0;
} }
/* ms_uid() /* ms_uid()
@ -317,7 +306,7 @@ ms_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
* parv[8] - UID * parv[8] - UID
* parv[9] - gecos * parv[9] - gecos
*/ */
static int static void
ms_uid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_uid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -337,14 +326,14 @@ ms_uid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
"Excess parameters (%d) to %s command, expecting %d", "Excess parameters (%d) to %s command, expecting %d",
parc, "UID", 10); parc, "UID", 10);
exit_client(client_p, client_p, client_p, squitreason); exit_client(client_p, client_p, client_p, squitreason);
return 0; return;
} }
/* if nicks erroneous, or too long, kill */ /* if nicks erroneous, or too long, kill */
if(!clean_nick(parv[1], 0)) if(!clean_nick(parv[1], 0))
{ {
bad_nickname(client_p, parv[1]); bad_nickname(client_p, parv[1]);
return 0; return;
} }
if(!clean_uid(parv[8], source_p->id)) if(!clean_uid(parv[8], source_p->id))
@ -353,7 +342,7 @@ ms_uid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
"Invalid UID %s for nick %s on %s/%s", "Invalid UID %s for nick %s on %s/%s",
parv[8], parv[1], source_p->name, source_p->id); parv[8], parv[1], source_p->name, source_p->id);
exit_client(client_p, client_p, client_p, squitreason); exit_client(client_p, client_p, client_p, squitreason);
return 0; return;
} }
if(!clean_username(parv[5]) || !clean_host(parv[6])) if(!clean_username(parv[5]) || !clean_host(parv[6]))
@ -363,7 +352,7 @@ ms_uid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
"Bad user@host: %s@%s From: %s(via %s)", "Bad user@host: %s@%s From: %s(via %s)",
parv[5], parv[6], source_p->name, client_p->name); parv[5], parv[6], source_p->name, client_p->name);
sendto_one(client_p, ":%s KILL %s :%s (Bad user@host)", me.id, parv[8], me.name); sendto_one(client_p, ":%s KILL %s :%s (Bad user@host)", me.id, parv[8], me.name);
return 0; return;
} }
/* check length of clients gecos */ /* check length of clients gecos */
@ -391,8 +380,6 @@ ms_uid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
else else
perform_nick_collides(source_p, client_p, target_p, parc, parv, perform_nick_collides(source_p, client_p, target_p, parc, parv,
newts, parv[1], parv[8]); newts, parv[1], parv[8]);
return 0;
} }
/* ms_euid() /* ms_euid()
@ -408,7 +395,7 @@ ms_uid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
* parv[10] - account * parv[10] - account
* parv[11] - gecos * parv[11] - gecos
*/ */
static int static void
ms_euid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_euid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -428,14 +415,14 @@ ms_euid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
"Excess parameters (%d) to %s command, expecting %d", "Excess parameters (%d) to %s command, expecting %d",
parc, "EUID", 12); parc, "EUID", 12);
exit_client(client_p, client_p, client_p, squitreason); exit_client(client_p, client_p, client_p, squitreason);
return 0; return;
} }
/* if nicks erroneous, or too long, kill */ /* if nicks erroneous, or too long, kill */
if(!clean_nick(parv[1], 0)) if(!clean_nick(parv[1], 0))
{ {
bad_nickname(client_p, parv[1]); bad_nickname(client_p, parv[1]);
return 0; return;
} }
if(!clean_uid(parv[8], source_p->id)) if(!clean_uid(parv[8], source_p->id))
@ -444,7 +431,7 @@ ms_euid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
"Invalid UID %s for nick %s on %s/%s", "Invalid UID %s for nick %s on %s/%s",
parv[8], parv[1], source_p->name, source_p->id); parv[8], parv[1], source_p->name, source_p->id);
exit_client(client_p, client_p, client_p, squitreason); exit_client(client_p, client_p, client_p, squitreason);
return 0; return;
} }
if(!clean_username(parv[5]) || !clean_host(parv[6])) if(!clean_username(parv[5]) || !clean_host(parv[6]))
@ -454,7 +441,7 @@ ms_euid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
"Bad user@host: %s@%s From: %s(via %s)", "Bad user@host: %s@%s From: %s(via %s)",
parv[5], parv[6], source_p->name, client_p->name); parv[5], parv[6], source_p->name, client_p->name);
sendto_one(client_p, ":%s KILL %s :%s (Bad user@host)", me.id, parv[8], me.name); sendto_one(client_p, ":%s KILL %s :%s (Bad user@host)", me.id, parv[8], me.name);
return 0; return;
} }
if(strcmp(parv[9], "*") && !clean_host(parv[9])) if(strcmp(parv[9], "*") && !clean_host(parv[9]))
@ -464,7 +451,7 @@ ms_euid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
"Bad realhost: %s From: %s(via %s)", "Bad realhost: %s From: %s(via %s)",
parv[9], source_p->name, client_p->name); parv[9], source_p->name, client_p->name);
sendto_one(client_p, ":%s KILL %s :%s (Bad user@host)", me.id, parv[8], me.name); sendto_one(client_p, ":%s KILL %s :%s (Bad user@host)", me.id, parv[8], me.name);
return 0; return;
} }
/* check length of clients gecos */ /* check length of clients gecos */
@ -492,22 +479,20 @@ ms_euid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
else else
perform_nick_collides(source_p, client_p, target_p, parc, parv, perform_nick_collides(source_p, client_p, target_p, parc, parv,
newts, parv[1], parv[8]); newts, parv[1], parv[8]);
return 0;
} }
/* ms_save() /* ms_save()
* parv[1] - UID * parv[1] - UID
* parv[2] - TS * parv[2] - TS
*/ */
static int static void
ms_save(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_save(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
target_p = find_id(parv[1]); target_p = find_id(parv[1]);
if (target_p == NULL) if (target_p == NULL)
return 0; return;
if (!IsPerson(target_p)) if (!IsPerson(target_p))
sendto_realops_snomask(SNO_GENERAL, L_ALL, sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Ignored SAVE message for non-person %s from %s", "Ignored SAVE message for non-person %s from %s",
@ -522,16 +507,15 @@ ms_save(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
sendto_realops_snomask(SNO_SKILL, L_ALL, sendto_realops_snomask(SNO_SKILL, L_ALL,
"Ignored SAVE message for %s from %s", "Ignored SAVE message for %s from %s",
target_p->name, source_p->name); target_p->name, source_p->name);
return 0;
} }
/* clean_username() /* clean_username()
* *
* input - username to check * input - username to check
* output - 0 if erroneous, else 0 * output - false if erroneous, else true
* side effects - * side effects -
*/ */
static int static bool
clean_username(const char *username) clean_username(const char *username)
{ {
int len = 0; int len = 0;
@ -541,22 +525,22 @@ clean_username(const char *username)
len++; len++;
if(!IsUserChar(*username)) if(!IsUserChar(*username))
return 0; return false;
} }
if(len > USERLEN) if(len > USERLEN)
return 0; return false;
return 1; return true;
} }
/* clean_host() /* clean_host()
* *
* input - host to check * input - host to check
* output - 0 if erroneous, else 0 * output - false if erroneous, else true
* side effects - * side effects -
*/ */
static int static bool
clean_host(const char *host) clean_host(const char *host)
{ {
int len = 0; int len = 0;
@ -566,38 +550,38 @@ clean_host(const char *host)
len++; len++;
if(!IsHostChar(*host)) if(!IsHostChar(*host))
return 0; return false;
} }
if(len > HOSTLEN) if(len > HOSTLEN)
return 0; return false;
return 1; return true;
} }
static int static bool
clean_uid(const char *uid, const char *sid) clean_uid(const char *uid, const char *sid)
{ {
int len = 1; int len = 1;
if(strncmp(uid, sid, strlen(sid))) if(strncmp(uid, sid, strlen(sid)))
return 0; return false;
if(!IsDigit(*uid++)) if(!IsDigit(*uid++))
return 0; return false;
for(; *uid; uid++) for(; *uid; uid++)
{ {
len++; len++;
if(!IsIdChar(*uid)) if(!IsIdChar(*uid))
return 0; return false;
} }
if(len != IDLEN - 1) if(len != IDLEN - 1)
return 0; return false;
return 1; return true;
} }
static void static void
@ -727,7 +711,7 @@ change_local_nick(struct Client *client_p, struct Client *source_p,
/* /*
* change_remote_nick() * change_remote_nick()
*/ */
static int static void
change_remote_nick(struct Client *client_p, struct Client *source_p, change_remote_nick(struct Client *client_p, struct Client *source_p,
time_t newts, const char *nick, int dosend) time_t newts, const char *nick, int dosend)
{ {
@ -768,11 +752,9 @@ change_remote_nick(struct Client *client_p, struct Client *source_p,
/* remove all accepts pointing to the client */ /* remove all accepts pointing to the client */
del_all_accepts(source_p); del_all_accepts(source_p);
return 0;
} }
static int static void
perform_nick_collides(struct Client *source_p, struct Client *client_p, perform_nick_collides(struct Client *source_p, struct Client *client_p,
struct Client *target_p, int parc, const char *parv[], struct Client *target_p, int parc, const char *parv[],
time_t newts, const char *nick, const char *uid) time_t newts, const char *nick, const char *uid)
@ -820,7 +802,7 @@ perform_nick_collides(struct Client *source_p, struct Client *client_p,
target_p->flags |= FLAGS_KILLED; target_p->flags |= FLAGS_KILLED;
exit_client(client_p, target_p, &me, "Nick collision (new)"); exit_client(client_p, target_p, &me, "Nick collision (new)");
} }
return 0; return;
} }
/* the timestamps are different */ /* the timestamps are different */
else else
@ -846,7 +828,7 @@ perform_nick_collides(struct Client *source_p, struct Client *client_p,
sendto_one(client_p, sendto_one(client_p,
":%s KILL %s :%s (Nick collision (new))", ":%s KILL %s :%s (Nick collision (new))",
me.id, uid, me.name); me.id, uid, me.name);
return 0; return;
} }
else else
{ {
@ -882,14 +864,12 @@ perform_nick_collides(struct Client *source_p, struct Client *client_p,
register_client(client_p, source_p, register_client(client_p, source_p,
nick, newts, parc, parv); nick, newts, parc, parv);
return 0;
} }
} }
} }
static int static void
perform_nickchange_collides(struct Client *source_p, struct Client *client_p, perform_nickchange_collides(struct Client *source_p, struct Client *client_p,
struct Client *target_p, int parc, struct Client *target_p, int parc,
const char *parv[], time_t newts, const char *nick) const char *parv[], time_t newts, const char *nick)
@ -937,7 +917,7 @@ perform_nickchange_collides(struct Client *source_p, struct Client *client_p,
source_p->flags |= FLAGS_KILLED; source_p->flags |= FLAGS_KILLED;
exit_client(client_p, source_p, &me, "Nick collision(old)"); exit_client(client_p, source_p, &me, "Nick collision(old)");
} }
return 0; return;
} }
else else
{ {
@ -988,7 +968,7 @@ perform_nickchange_collides(struct Client *source_p, struct Client *client_p,
else else
exit_client(client_p, source_p, &me, "Nick collision(new)"); exit_client(client_p, source_p, &me, "Nick collision(new)");
} }
return 0; return;
} }
else else
{ {
@ -1025,11 +1005,9 @@ perform_nickchange_collides(struct Client *source_p, struct Client *client_p,
} }
change_remote_nick(client_p, source_p, newts, nick, 1); change_remote_nick(client_p, source_p, newts, nick, 1);
return 0;
} }
static int static void
register_client(struct Client *client_p, struct Client *server, register_client(struct Client *client_p, struct Client *server,
const char *nick, time_t newts, int parc, const char *parv[]) const char *nick, time_t newts, int parc, const char *parv[])
{ {
@ -1139,25 +1117,24 @@ register_client(struct Client *client_p, struct Client *server,
call_hook(h_new_remote_user, source_p); call_hook(h_new_remote_user, source_p);
introduce_client(client_p, source_p, user, nick, parc == 12); introduce_client(client_p, source_p, user, nick, parc == 12);
return 0;
} }
/* Check if we can do SAVE. target_p can be a client to save or a /* Check if we can do SAVE. target_p can be a client to save or a
* server introducing a client -- jilles */ * server introducing a client -- jilles */
static int static bool
can_save(struct Client *target_p) can_save(struct Client *target_p)
{ {
struct Client *serv_p; struct Client *serv_p;
if (MyClient(target_p)) if (MyClient(target_p))
return 1; return true;
if (!has_id(target_p)) if (!has_id(target_p))
return 0; return false;
serv_p = IsServer(target_p) ? target_p : target_p->servptr; serv_p = IsServer(target_p) ? target_p : target_p->servptr;
while (serv_p != NULL && serv_p != &me) while (serv_p != NULL && serv_p != &me)
{ {
if (!(serv_p->serv->caps & CAP_SAVE)) if (!(serv_p->serv->caps & CAP_SAVE))
return 0; return false;
serv_p = serv_p->servptr; serv_p = serv_p->servptr;
} }
return serv_p == &me; return serv_p == &me;

View file

@ -42,7 +42,7 @@
static const char part_desc[] = "Provides the PART command to leave a channel"; static const char part_desc[] = "Provides the PART command to leave a channel";
static int m_part(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_part(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message part_msgtab = { struct Message part_msgtab = {
"PART", 0, 0, 0, 0, "PART", 0, 0, 0, 0,
@ -56,8 +56,8 @@ DECLARE_MODULE_AV2(part, NULL, NULL, part_clist, NULL, NULL, NULL, NULL, part_de
static void part_one_client(struct Client *client_p, static void part_one_client(struct Client *client_p,
struct Client *source_p, char *name, struct Client *source_p, char *name,
const char *reason); const char *reason);
static int can_send_part(struct Client *source_p, struct Channel *chptr, struct membership *msptr); static bool can_send_part(struct Client *source_p, struct Channel *chptr, struct membership *msptr);
static int do_message_hook(struct Client *source_p, struct Channel *chptr, const char **reason); static bool do_message_hook(struct Client *source_p, struct Channel *chptr, const char **reason);
/* /*
@ -65,7 +65,7 @@ static int do_message_hook(struct Client *source_p, struct Channel *chptr, const
** parv[1] = channel ** parv[1] = channel
** parv[2] = reason ** parv[2] = reason
*/ */
static int static void
m_part(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_part(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
char *p, *name; char *p, *name;
@ -88,7 +88,6 @@ m_part(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
part_one_client(client_p, source_p, name, reason); part_one_client(client_p, source_p, name, reason);
name = rb_strtok_r(NULL, ",", &p); name = rb_strtok_r(NULL, ",", &p);
} }
return 0;
} }
/* /*
@ -158,19 +157,19 @@ part_one_client(struct Client *client_p, struct Client *source_p, char *name, co
* - channel being parted * - channel being parted
* - membership pointer * - membership pointer
* outputs: * outputs:
* - 1 if message allowed * - true if message allowed
* - 0 if message denied * - false if message denied
* side effects: * side effects:
* - none. * - none.
*/ */
static int static bool
can_send_part(struct Client *source_p, struct Channel *chptr, struct membership *msptr) can_send_part(struct Client *source_p, struct Channel *chptr, struct membership *msptr)
{ {
if (!can_send(chptr, source_p, msptr)) if (!can_send(chptr, source_p, msptr))
return 0; return false;
/* Allow chanops to bypass anti_spam_exit_message_time for part messages. */ /* Allow chanops to bypass anti_spam_exit_message_time for part messages. */
if (is_chanop(msptr)) if (is_chanop(msptr))
return 1; return true;
return (source_p->localClient->firsttime + ConfigFileEntry.anti_spam_exit_message_time) < rb_current_time(); return (source_p->localClient->firsttime + ConfigFileEntry.anti_spam_exit_message_time) < rb_current_time();
} }
@ -182,12 +181,12 @@ can_send_part(struct Client *source_p, struct Channel *chptr, struct membership
* - channel being parted * - channel being parted
* - pointer to reason * - pointer to reason
* outputs: * outputs:
* - 1 if message is allowed * - true if message is allowed
* - 0 if message is denied or message is now empty * - false if message is denied or message is now empty
* side effects: * side effects:
* - reason may be modified. * - reason may be modified.
*/ */
static int static bool
do_message_hook(struct Client *source_p, struct Channel *chptr, const char **reason) do_message_hook(struct Client *source_p, struct Channel *chptr, const char **reason)
{ {
hook_data_privmsg_channel hdata; hook_data_privmsg_channel hdata;

View file

@ -36,8 +36,8 @@
static const char quit_desc[] = "Provides the QUIT command to allow a user to leave the network"; static const char quit_desc[] = "Provides the QUIT command to allow a user to leave the network";
static int m_quit(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_quit(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_quit(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_quit(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message quit_msgtab = { struct Message quit_msgtab = {
"QUIT", 0, 0, 0, 0, "QUIT", 0, 0, 0, 0,
@ -52,7 +52,7 @@ DECLARE_MODULE_AV2(quit, NULL, NULL, quit_clist, NULL, NULL, NULL, NULL, quit_de
** m_quit ** m_quit
** parv[1] = comment ** parv[1] = comment
*/ */
static int static void
m_quit(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_quit(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
char *comment = LOCAL_COPY((parc > 1 && parv[1]) ? parv[1] : client_p->name); char *comment = LOCAL_COPY((parc > 1 && parv[1]) ? parv[1] : client_p->name);
@ -76,19 +76,17 @@ m_quit(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
rb_current_time()) rb_current_time())
{ {
exit_client(client_p, source_p, source_p, "Client Quit"); exit_client(client_p, source_p, source_p, "Client Quit");
return 0; return;
} }
exit_client(client_p, source_p, source_p, comment); exit_client(client_p, source_p, source_p, comment);
return 0;
} }
/* /*
** ms_quit ** ms_quit
** parv[1] = comment ** parv[1] = comment
*/ */
static int static void
ms_quit(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_quit(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
char *comment = LOCAL_COPY((parc > 1 && parv[1]) ? parv[1] : client_p->name); char *comment = LOCAL_COPY((parc > 1 && parv[1]) ? parv[1] : client_p->name);
@ -98,6 +96,4 @@ ms_quit(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
comment[REASONLEN] = '\0'; comment[REASONLEN] = '\0';
exit_client(client_p, source_p, source_p, comment); exit_client(client_p, source_p, source_p, comment);
return 0;
} }

View file

@ -43,9 +43,13 @@
static const char server_desc[] = static const char server_desc[] =
"Provides the TS6 commands to introduce a new server to the network"; "Provides the TS6 commands to introduce a new server to the network";
static int mr_server(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mr_server(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_server(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_server(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_sid(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_sid(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static bool bogus_host(const char *host);
static void set_server_gecos(struct Client *, const char *);
struct Message server_msgtab = { struct Message server_msgtab = {
"SERVER", 0, 0, 0, 0, "SERVER", 0, 0, 0, 0,
{{mr_server, 4}, mg_reg, mg_ignore, {ms_server, 4}, mg_ignore, mg_reg} {{mr_server, 4}, mg_reg, mg_ignore, {ms_server, 4}, mg_ignore, mg_reg}
@ -59,16 +63,13 @@ mapi_clist_av1 server_clist[] = { &server_msgtab, &sid_msgtab, NULL };
DECLARE_MODULE_AV2(server, NULL, NULL, server_clist, NULL, NULL, NULL, NULL, server_desc); DECLARE_MODULE_AV2(server, NULL, NULL, server_clist, NULL, NULL, NULL, NULL, server_desc);
int bogus_host(const char *host);
static int set_server_gecos(struct Client *, const char *);
/* /*
* mr_server - SERVER message handler * mr_server - SERVER message handler
* parv[1] = servername * parv[1] = servername
* parv[2] = serverinfo/hopcount * parv[2] = serverinfo/hopcount
* parv[3] = serverinfo * parv[3] = serverinfo
*/ */
static int static void
mr_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mr_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
char info[REALLEN + 1]; char info[REALLEN + 1];
@ -90,7 +91,7 @@ mr_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
ilog(L_SERVER, "Server %s has unexpected name %s", ilog(L_SERVER, "Server %s has unexpected name %s",
log_client_name(client_p, SHOW_IP), name); log_client_name(client_p, SHOW_IP), name);
exit_client(client_p, client_p, client_p, "Server name mismatch"); exit_client(client_p, client_p, client_p, "Server name mismatch");
return 0; return;
} }
/* /*
@ -101,13 +102,13 @@ mr_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
sendto_realops_snomask(SNO_GENERAL, L_ALL, "Link %s dropped, non-TS server", sendto_realops_snomask(SNO_GENERAL, L_ALL, "Link %s dropped, non-TS server",
client_p->name); client_p->name);
exit_client(client_p, client_p, client_p, "Non-TS server"); exit_client(client_p, client_p, client_p, "Non-TS server");
return 0; return;
} }
if(bogus_host(name)) if(bogus_host(name))
{ {
exit_client(client_p, client_p, client_p, "Bogus server name"); exit_client(client_p, client_p, client_p, "Bogus server name");
return 0; return;
} }
/* Now we just have to call check_server and everything should be /* Now we just have to call check_server and everything should be
@ -128,7 +129,7 @@ mr_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
} }
exit_client(client_p, client_p, client_p, "Invalid servername."); exit_client(client_p, client_p, client_p, "Invalid servername.");
return 0; return;
/* NOT REACHED */ /* NOT REACHED */
break; break;
@ -143,7 +144,7 @@ mr_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
log_client_name(client_p, SHOW_IP)); log_client_name(client_p, SHOW_IP));
exit_client(client_p, client_p, client_p, "Invalid credentials."); exit_client(client_p, client_p, client_p, "Invalid credentials.");
return 0; return;
/* NOT REACHED */ /* NOT REACHED */
break; break;
@ -158,7 +159,7 @@ mr_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
log_client_name(client_p, SHOW_IP)); log_client_name(client_p, SHOW_IP));
exit_client(client_p, client_p, client_p, "Invalid host."); exit_client(client_p, client_p, client_p, "Invalid host.");
return 0; return;
/* NOT REACHED */ /* NOT REACHED */
break; break;
@ -171,7 +172,7 @@ mr_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
log_client_name(client_p, SHOW_IP)); log_client_name(client_p, SHOW_IP));
exit_client(client_p, client_p, client_p, "Invalid servername."); exit_client(client_p, client_p, client_p, "Invalid servername.");
return 0; return;
/* NOT REACHED */ /* NOT REACHED */
break; break;
case -5: case -5:
@ -182,7 +183,7 @@ mr_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
log_client_name(client_p, SHOW_IP)); log_client_name(client_p, SHOW_IP));
exit_client(client_p, client_p, client_p, "Access denied, requires SSL/TLS but is plaintext"); exit_client(client_p, client_p, client_p, "Access denied, requires SSL/TLS but is plaintext");
return 0; return;
} }
/* require TS6 for direct links */ /* require TS6 for direct links */
@ -191,7 +192,7 @@ mr_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
sendto_realops_snomask(SNO_GENERAL, is_remote_connect(client_p) ? L_NETWIDE : L_ALL, sendto_realops_snomask(SNO_GENERAL, is_remote_connect(client_p) ? L_NETWIDE : L_ALL,
"Link %s dropped, TS6 protocol is required", name); "Link %s dropped, TS6 protocol is required", name);
exit_client(client_p, client_p, client_p, "Incompatible TS version"); exit_client(client_p, client_p, client_p, "Incompatible TS version");
return 0; return;
} }
/* check to ensure any "required" caps are set. --nenolod */ /* check to ensure any "required" caps are set. --nenolod */
@ -213,7 +214,7 @@ mr_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
sendto_one(client_p, "ERROR :Missing required CAPABs (%s)", missing); sendto_one(client_p, "ERROR :Missing required CAPABs (%s)", missing);
exit_client(client_p, client_p, client_p, "Missing required CAPABs"); exit_client(client_p, client_p, client_p, "Missing required CAPABs");
return 0; return;
} }
if((target_p = find_server(NULL, name))) if((target_p = find_server(NULL, name)))
@ -248,7 +249,7 @@ mr_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
sendto_one(client_p, "ERROR :Server already exists."); sendto_one(client_p, "ERROR :Server already exists.");
} }
exit_client(client_p, client_p, client_p, "Server Exists"); exit_client(client_p, client_p, client_p, "Server Exists");
return 0; return;
} }
if(has_id(client_p) && (target_p = find_id(client_p->id)) != NULL) if(has_id(client_p) && (target_p = find_id(client_p->id)) != NULL)
@ -266,7 +267,7 @@ mr_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
sendto_one(client_p, "ERROR :SID already exists."); sendto_one(client_p, "ERROR :SID already exists.");
exit_client(client_p, client_p, client_p, "SID Exists"); exit_client(client_p, client_p, client_p, "SID Exists");
return 0; return;
} }
/* /*
@ -278,8 +279,6 @@ mr_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
set_server_gecos(client_p, info); set_server_gecos(client_p, info);
client_p->hopcount = hop; client_p->hopcount = hop;
server_estab(client_p); server_estab(client_p);
return 0;
} }
/* /*
@ -288,7 +287,7 @@ mr_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
* parv[2] = serverinfo/hopcount * parv[2] = serverinfo/hopcount
* parv[3] = serverinfo * parv[3] = serverinfo
*/ */
static int static void
ms_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
char info[REALLEN + 1]; char info[REALLEN + 1];
@ -334,7 +333,7 @@ ms_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
"Server %s already exists", "Server %s already exists",
name); name);
exit_client(client_p, client_p, &me, squitreason); exit_client(client_p, client_p, &me, squitreason);
return 0; return;
} }
/* /*
@ -356,7 +355,7 @@ ms_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
client_p->name, name); client_p->name, name);
exit_client(client_p, client_p, client_p, "Nick as Server"); exit_client(client_p, client_p, client_p, "Nick as Server");
return 0; return;
} }
/* /*
@ -420,7 +419,7 @@ ms_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
"No matching hub_mask for %s", "No matching hub_mask for %s",
name); name);
exit_client(NULL, client_p, &me, squitreason); exit_client(NULL, client_p, &me, squitreason);
return 0; return;
} }
/* Check for the new server being leafed behind this HUB */ /* Check for the new server being leafed behind this HUB */
@ -437,7 +436,7 @@ ms_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
"Matching leaf_mask for %s", "Matching leaf_mask for %s",
name); name);
exit_client(NULL, client_p, &me, squitreason); exit_client(NULL, client_p, &me, squitreason);
return 0; return;
} }
@ -451,7 +450,7 @@ ms_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
client_p->name, name); client_p->name, name);
exit_client(NULL, client_p, &me, "Invalid servername introduced."); exit_client(NULL, client_p, &me, "Invalid servername introduced.");
return 0; return;
} }
target_p = make_client(client_p); target_p = make_client(client_p);
@ -487,11 +486,9 @@ ms_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
hdata.client = source_p; hdata.client = source_p;
hdata.target = target_p; hdata.target = target_p;
call_hook(h_server_introduced, &hdata); call_hook(h_server_introduced, &hdata);
return 0;
} }
static int static void
ms_sid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_sid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -512,7 +509,7 @@ ms_sid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
"Server %s already exists", "Server %s already exists",
parv[1]); parv[1]);
exit_client(NULL, client_p, &me, squitreason); exit_client(NULL, client_p, &me, squitreason);
return 0; return;
} }
/* collision on the SID? */ /* collision on the SID? */
@ -531,7 +528,7 @@ ms_sid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
"SID %s for %s already in use by %s", "SID %s for %s already in use by %s",
parv[3], parv[1], target_p->name); parv[3], parv[1], target_p->name);
exit_client(NULL, client_p, &me, squitreason); exit_client(NULL, client_p, &me, squitreason);
return 0; return;
} }
if(bogus_host(parv[1]) || strlen(parv[1]) > HOSTLEN) if(bogus_host(parv[1]) || strlen(parv[1]) > HOSTLEN)
@ -544,7 +541,7 @@ ms_sid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
client_p->name, parv[1]); client_p->name, parv[1]);
exit_client(NULL, client_p, &me, "Bogus server name"); exit_client(NULL, client_p, &me, "Bogus server name");
return 0; return;
} }
if(!IsDigit(parv[3][0]) || !IsIdChar(parv[3][1]) || if(!IsDigit(parv[3][0]) || !IsIdChar(parv[3][1]) ||
@ -558,7 +555,7 @@ ms_sid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
client_p->name, parv[3]); client_p->name, parv[3]);
exit_client(NULL, client_p, &me, "Bogus SID"); exit_client(NULL, client_p, &me, "Bogus SID");
return 0; return;
} }
/* for the directly connected server: /* for the directly connected server:
@ -591,7 +588,7 @@ ms_sid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
"No matching hub_mask for %s", "No matching hub_mask for %s",
parv[1]); parv[1]);
exit_client(NULL, client_p, &me, squitreason); exit_client(NULL, client_p, &me, squitreason);
return 0; return;
} }
/* matching leaf_mask */ /* matching leaf_mask */
@ -607,7 +604,7 @@ ms_sid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
"Matching leaf_mask for %s", "Matching leaf_mask for %s",
parv[1]); parv[1]);
exit_client(NULL, client_p, &me, squitreason); exit_client(NULL, client_p, &me, squitreason);
return 0; return;
} }
/* ok, alls good */ /* ok, alls good */
@ -645,8 +642,6 @@ ms_sid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
hdata.client = source_p; hdata.client = source_p;
hdata.target = target_p; hdata.target = target_p;
call_hook(h_server_introduced, &hdata); call_hook(h_server_introduced, &hdata);
return 0;
} }
/* set_server_gecos() /* set_server_gecos()
@ -655,7 +650,7 @@ ms_sid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
* output - none * output - none
* side effects - servers gecos field is set * side effects - servers gecos field is set
*/ */
static int static void
set_server_gecos(struct Client *client_p, const char *info) set_server_gecos(struct Client *client_p, const char *info)
{ {
/* check the info for [IP] */ /* check the info for [IP] */
@ -709,27 +704,25 @@ set_server_gecos(struct Client *client_p, const char *info)
if(s && (*s != '\0')) if(s && (*s != '\0'))
{ {
rb_strlcpy(client_p->info, s, sizeof(client_p->info)); rb_strlcpy(client_p->info, s, sizeof(client_p->info));
return 1; return;
} }
} }
} }
rb_strlcpy(client_p->info, "(Unknown Location)", sizeof(client_p->info)); rb_strlcpy(client_p->info, "(Unknown Location)", sizeof(client_p->info));
return 1;
} }
/* /*
* bogus_host * bogus_host
* *
* inputs - hostname * inputs - hostname
* output - 1 if a bogus hostname input, 0 if its valid * output - true if a bogus hostname input, false if its valid
* side effects - none * side effects - none
*/ */
int static bool
bogus_host(const char *host) bogus_host(const char *host)
{ {
int bogus_server = 0; bool bogus_server = false;
const char *s; const char *s;
int dots = 0; int dots = 0;
@ -737,7 +730,7 @@ bogus_host(const char *host)
{ {
if(!IsServChar(*s)) if(!IsServChar(*s))
{ {
bogus_server = 1; bogus_server = true;
break; break;
} }
if('.' == *s) if('.' == *s)
@ -745,7 +738,7 @@ bogus_host(const char *host)
} }
if(!dots || bogus_server) if(!dots || bogus_server)
return 1; return true;
return 0; return false;
} }

View file

@ -40,8 +40,8 @@
static const char squit_desc[] = "Provides the SQUIT command to cause a server to quit"; static const char squit_desc[] = "Provides the SQUIT command to cause a server to quit";
static int ms_squit(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_squit(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_squit(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_squit(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message squit_msgtab = { struct Message squit_msgtab = {
"SQUIT", 0, 0, 0, 0, "SQUIT", 0, 0, 0, 0,
@ -67,7 +67,7 @@ static struct squit_parms *find_squit(struct Client *client_p,
* parv[1] = server name * parv[1] = server name
* parv[2] = comment * parv[2] = comment
*/ */
static int static void
mo_squit(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_squit(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct squit_parms *found_squit; struct squit_parms *found_squit;
@ -89,18 +89,16 @@ mo_squit(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "remote"); me.name, source_p->name, "remote");
return 0; return;
} }
exit_client(client_p, found_squit->target_p, source_p, comment); exit_client(client_p, found_squit->target_p, source_p, comment);
return 0; return;
} }
else else
{ {
sendto_one_numeric(source_p, ERR_NOSUCHSERVER, form_str(ERR_NOSUCHSERVER), parv[1]); sendto_one_numeric(source_p, ERR_NOSUCHSERVER, form_str(ERR_NOSUCHSERVER), parv[1]);
} }
return 0;
} }
/* /*
@ -108,7 +106,7 @@ mo_squit(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
* parv[1] = server name * parv[1] = server name
* parv[2] = comment * parv[2] = comment
*/ */
static int static void
ms_squit(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_squit(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -119,12 +117,12 @@ ms_squit(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
else else
{ {
if((target_p = find_server(NULL, parv[1])) == NULL) if((target_p = find_server(NULL, parv[1])) == NULL)
return 0; return;
if(IsMe(target_p)) if(IsMe(target_p))
target_p = client_p; target_p = client_p;
if(!IsServer(target_p)) if(!IsServer(target_p))
return 0; return;
} }
/* Server is closing its link */ /* Server is closing its link */
@ -149,7 +147,6 @@ ms_squit(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
ilog(L_SERVER, "SQUIT From %s : %s (%s)", source_p->name, target_p->name, comment); ilog(L_SERVER, "SQUIT From %s : %s (%s)", source_p->name, target_p->name, comment);
} }
exit_client(client_p, target_p, source_p, comment); exit_client(client_p, target_p, source_p, comment);
return 0;
} }

View file

@ -37,7 +37,7 @@
static const char accept_desc[] = static const char accept_desc[] =
"Provides the ACCEPT command for use with Caller ID/user mode +g"; "Provides the ACCEPT command for use with Caller ID/user mode +g";
static int m_accept(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_accept(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void build_nicklist(struct Client *, char *, char *, const char *); static void build_nicklist(struct Client *, char *, char *, const char *);
static void add_accept(struct Client *, struct Client *); static void add_accept(struct Client *, struct Client *);
@ -58,7 +58,7 @@ DECLARE_MODULE_AV2(accept, NULL, NULL, accept_clist, NULL, NULL, NULL, NULL, acc
* m_accept - ACCEPT command handler * m_accept - ACCEPT command handler
* parv[1] = servername * parv[1] = servername
*/ */
static int static void
m_accept(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_accept(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
char *nick; char *nick;
@ -71,7 +71,7 @@ m_accept(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(*parv[1] == '*') if(*parv[1] == '*')
{ {
list_accepts(source_p); list_accepts(source_p);
return 0; return;
} }
build_nicklist(source_p, addbuf, delbuf, parv[1]); build_nicklist(source_p, addbuf, delbuf, parv[1]);
@ -124,15 +124,13 @@ m_accept(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(accept_num >= ConfigFileEntry.max_accept) if(accept_num >= ConfigFileEntry.max_accept)
{ {
sendto_one(source_p, form_str(ERR_ACCEPTFULL), me.name, source_p->name); sendto_one(source_p, form_str(ERR_ACCEPTFULL), me.name, source_p->name);
return 0; return;
} }
/* why is this here? */ /* why is this here? */
/* del_from accept(target_p, source_p); */ /* del_from accept(target_p, source_p); */
add_accept(source_p, target_p); add_accept(source_p, target_p);
} }
return 0;
} }
/* /*

View file

@ -37,9 +37,9 @@
const char admin_desc[] = const char admin_desc[] =
"Provides the ADMIN command to show server administrator information"; "Provides the ADMIN command to show server administrator information";
static int m_admin(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_admin(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mr_admin(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mr_admin(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_admin(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_admin(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void do_admin(struct Client *source_p); static void do_admin(struct Client *source_p);
static void admin_spy(struct Client *); static void admin_spy(struct Client *);
@ -63,7 +63,7 @@ DECLARE_MODULE_AV2(admin, NULL, NULL, admin_clist, admin_hlist, NULL, NULL, NULL
* mr_admin - ADMIN command handler * mr_admin - ADMIN command handler
* parv[1] = servername * parv[1] = servername
*/ */
static int static void
mr_admin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mr_admin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
static time_t last_used = 0L; static time_t last_used = 0L;
@ -74,21 +74,19 @@ mr_admin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
me.name, me.name,
EmptyString(source_p->name) ? "*" : source_p->name, EmptyString(source_p->name) ? "*" : source_p->name,
"ADMIN"); "ADMIN");
return 0; return;
} }
else else
last_used = rb_current_time(); last_used = rb_current_time();
do_admin(source_p); do_admin(source_p);
return 0;
} }
/* /*
* m_admin - ADMIN command handler * m_admin - ADMIN command handler
* parv[1] = servername * parv[1] = servername
*/ */
static int static void
m_admin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_admin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
static time_t last_used = 0L; static time_t last_used = 0L;
@ -99,18 +97,16 @@ m_admin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one(source_p, form_str(RPL_LOAD2HI), sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "ADMIN"); me.name, source_p->name, "ADMIN");
return 0; return;
} }
else else
last_used = rb_current_time(); last_used = rb_current_time();
if(hunt_server(client_p, source_p, ":%s ADMIN :%s", 1, parc, parv) != HUNTED_ISME) if(hunt_server(client_p, source_p, ":%s ADMIN :%s", 1, parc, parv) != HUNTED_ISME)
return 0; return;
} }
do_admin(source_p); do_admin(source_p);
return 0;
} }
@ -118,15 +114,13 @@ m_admin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
* ms_admin - ADMIN command handler, used for OPERS as well * ms_admin - ADMIN command handler, used for OPERS as well
* parv[1] = servername * parv[1] = servername
*/ */
static int static void
ms_admin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_admin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(hunt_server(client_p, source_p, ":%s ADMIN :%s", 1, parc, parv) != HUNTED_ISME) if(hunt_server(client_p, source_p, ":%s ADMIN :%s", 1, parc, parv) != HUNTED_ISME)
return 0; return;
do_admin(source_p); do_admin(source_p);
return 0;
} }

View file

@ -37,7 +37,7 @@
static const char away_desc[] = "Provides the AWAY command to set yourself away"; static const char away_desc[] = "Provides the AWAY command to set yourself away";
static int m_away(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_away(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message away_msgtab = { struct Message away_msgtab = {
"AWAY", 0, 0, 0, 0, "AWAY", 0, 0, 0, 0,
@ -66,7 +66,7 @@ DECLARE_MODULE_AV2(away, NULL, NULL, away_clist, NULL, NULL, NULL, NULL, away_de
** m_away ** m_away
** parv[1] = away message ** parv[1] = away message
*/ */
static int static void
m_away(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_away(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(MyClient(source_p) && source_p->localClient->next_away && if(MyClient(source_p) && source_p->localClient->next_away &&
@ -74,7 +74,7 @@ m_away(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
flood_endgrace(source_p); flood_endgrace(source_p);
if(!IsClient(source_p)) if(!IsClient(source_p))
return 0; return;
if(parc < 2 || EmptyString(parv[1])) if(parc < 2 || EmptyString(parv[1]))
{ {
@ -91,7 +91,7 @@ m_away(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
} }
if(MyConnect(source_p)) if(MyConnect(source_p))
sendto_one_numeric(source_p, RPL_UNAWAY, form_str(RPL_UNAWAY)); sendto_one_numeric(source_p, RPL_UNAWAY, form_str(RPL_UNAWAY));
return 0; return;
} }
/* Rate limit this because it is sent to common channels. */ /* Rate limit this because it is sent to common channels. */
@ -102,7 +102,7 @@ m_away(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
{ {
sendto_one(source_p, form_str(RPL_LOAD2HI), sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "AWAY"); me.name, source_p->name, "AWAY");
return 0; return;
} }
if(source_p->localClient->next_away < rb_current_time() - if(source_p->localClient->next_away < rb_current_time() -
ConfigFileEntry.away_interval) ConfigFileEntry.away_interval)
@ -130,6 +130,4 @@ m_away(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
if(MyConnect(source_p)) if(MyConnect(source_p))
sendto_one_numeric(source_p, RPL_NOWAWAY, form_str(RPL_NOWAWAY)); sendto_one_numeric(source_p, RPL_NOWAWAY, form_str(RPL_NOWAWAY));
return 0;
} }

View file

@ -48,7 +48,7 @@ static const char cap_desc[] = "Provides the commands used for client capability
typedef int (*bqcmp)(const void *, const void *); typedef int (*bqcmp)(const void *, const void *);
static int m_cap(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_cap(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message cap_msgtab = { struct Message cap_msgtab = {
"CAP", 0, 0, 0, 0, "CAP", 0, 0, 0, 0,
@ -417,7 +417,7 @@ clicap_cmd_search(const char *command, struct clicap_cmd *entry)
return irccmp(command, entry->cmd); return irccmp(command, entry->cmd);
} }
static int static void
m_cap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_cap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct clicap_cmd *cmd; struct clicap_cmd *cmd;
@ -429,9 +429,8 @@ m_cap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
sendto_one(source_p, form_str(ERR_INVALIDCAPCMD), sendto_one(source_p, form_str(ERR_INVALIDCAPCMD),
me.name, EmptyString(source_p->name) ? "*" : source_p->name, me.name, EmptyString(source_p->name) ? "*" : source_p->name,
parv[1]); parv[1]);
return 0; return;
} }
(cmd->func)(source_p, parv[2]); (cmd->func)(source_p, parv[2]);
return 0;
} }

View file

@ -33,8 +33,8 @@
static const char capab_desc[] = "Provides the commands used for server-to-server capability negotiation"; static const char capab_desc[] = "Provides the commands used for server-to-server capability negotiation";
static int mr_capab(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mr_capab(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_gcap(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_gcap(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message capab_msgtab = { struct Message capab_msgtab = {
"CAPAB", 0, 0, 0, 0, "CAPAB", 0, 0, 0, 0,
@ -53,7 +53,7 @@ DECLARE_MODULE_AV2(capab, NULL, NULL, capab_clist, NULL, NULL, NULL, NULL, capab
* mr_capab - CAPAB message handler * mr_capab - CAPAB message handler
* parv[1] = space-separated list of capabilities * parv[1] = space-separated list of capabilities
*/ */
static int static void
mr_capab(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mr_capab(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
int i; int i;
@ -62,16 +62,16 @@ mr_capab(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
/* ummm, this shouldn't happen. Could argue this should be logged etc. */ /* ummm, this shouldn't happen. Could argue this should be logged etc. */
if(client_p->localClient == NULL) if(client_p->localClient == NULL)
return 0; return;
if(client_p->user) if(client_p->user)
return 0; return;
/* CAP_TS6 is set in PASS, so is valid.. */ /* CAP_TS6 is set in PASS, so is valid.. */
if((client_p->localClient->caps & ~CAP_TS6) != 0) if((client_p->localClient->caps & ~CAP_TS6) != 0)
{ {
exit_client(client_p, client_p, client_p, "CAPAB received twice"); exit_client(client_p, client_p, client_p, "CAPAB received twice");
return 0; return;
} }
else else
client_p->localClient->caps |= CAP_CAP; client_p->localClient->caps |= CAP_CAP;
@ -85,11 +85,9 @@ mr_capab(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
for (s = rb_strtok_r(t, " ", &p); s; s = rb_strtok_r(NULL, " ", &p)) for (s = rb_strtok_r(t, " ", &p); s; s = rb_strtok_r(NULL, " ", &p))
client_p->localClient->caps |= capability_get(serv_capindex, s, NULL); client_p->localClient->caps |= capability_get(serv_capindex, s, NULL);
} }
return 0;
} }
static int static void
me_gcap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, me_gcap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]) int parc, const char *parv[])
{ {
@ -98,7 +96,7 @@ me_gcap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
char *p; char *p;
if(!IsServer(source_p)) if(!IsServer(source_p))
return 0; return;
/* already had GCAPAB?! */ /* already had GCAPAB?! */
if(!EmptyString(source_p->serv->fullcaps)) if(!EmptyString(source_p->serv->fullcaps))
@ -111,6 +109,4 @@ me_gcap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
for (s = rb_strtok_r(t, " ", &p); s; s = rb_strtok_r(NULL, " ", &p)) for (s = rb_strtok_r(t, " ", &p); s; s = rb_strtok_r(NULL, " ", &p))
source_p->serv->caps |= capability_get(serv_capindex, s, NULL); source_p->serv->caps |= capability_get(serv_capindex, s, NULL);
return 0;
} }

View file

@ -41,7 +41,7 @@
static const char certfp_desc[] = static const char certfp_desc[] =
"Provides the CERTFP facility used by servers to set certificate fingerprints"; "Provides the CERTFP facility used by servers to set certificate fingerprints";
static int me_certfp(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_certfp(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message certfp_msgtab = { struct Message certfp_msgtab = {
"CERTFP", 0, 0, 0, 0, "CERTFP", 0, 0, 0, 0,
@ -56,15 +56,14 @@ DECLARE_MODULE_AV2(certfp, NULL, NULL, certfp_clist, NULL, NULL, NULL, NULL, cer
** me_certfp ** me_certfp
** parv[1] = certfp string ** parv[1] = certfp string
*/ */
static int static void
me_certfp(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) me_certfp(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if (!IsPerson(source_p)) if (!IsPerson(source_p))
return 0; return;
rb_free(source_p->certfp); rb_free(source_p->certfp);
source_p->certfp = NULL; source_p->certfp = NULL;
if (!EmptyString(parv[1])) if (!EmptyString(parv[1]))
source_p->certfp = rb_strdup(parv[1]); source_p->certfp = rb_strdup(parv[1]);
return 0;
} }

View file

@ -72,7 +72,7 @@ DECLARE_MODULE_AV2(challenge, challenge_load, NULL, NULL, NULL, NULL, NULL, NULL
static const char challenge_desc[] = static const char challenge_desc[] =
"Provides the challenge-response facility used for becoming an IRC operator"; "Provides the challenge-response facility used for becoming an IRC operator";
static int m_challenge(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_challenge(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
/* We have openssl support, so include /CHALLENGE */ /* We have openssl support, so include /CHALLENGE */
struct Message challenge_msgtab = { struct Message challenge_msgtab = {
@ -84,7 +84,7 @@ mapi_clist_av1 challenge_clist[] = { &challenge_msgtab, NULL };
DECLARE_MODULE_AV2(challenge, NULL, NULL, challenge_clist, NULL, NULL, NULL, NULL, challenge_desc); DECLARE_MODULE_AV2(challenge, NULL, NULL, challenge_clist, NULL, NULL, NULL, NULL, challenge_desc);
static int generate_challenge(char **r_challenge, char **r_response, RSA * key); static bool generate_challenge(char **r_challenge, char **r_response, RSA * key);
static void static void
cleanup_challenge(struct Client *target_p) cleanup_challenge(struct Client *target_p)
@ -103,7 +103,7 @@ cleanup_challenge(struct Client *target_p)
* m_challenge - generate RSA challenge for wouldbe oper * m_challenge - generate RSA challenge for wouldbe oper
* parv[1] = operator to challenge for, or +response * parv[1] = operator to challenge for, or +response
*/ */
static int static void
m_challenge(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_challenge(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct oper_conf *oper_p; struct oper_conf *oper_p;
@ -118,14 +118,14 @@ m_challenge(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
{ {
sendto_one(source_p, form_str(RPL_YOUREOPER), me.name, source_p->name); sendto_one(source_p, form_str(RPL_YOUREOPER), me.name, source_p->name);
send_oper_motd(source_p); send_oper_motd(source_p);
return 0; return;
} }
if(*parv[1] == '+') if(*parv[1] == '+')
{ {
/* Ignore it if we aren't expecting this... -A1kmm */ /* Ignore it if we aren't expecting this... -A1kmm */
if(!source_p->localClient->challenge) if(!source_p->localClient->challenge)
return 0; return;
if((rb_current_time() - source_p->localClient->chal_time) > CHALLENGE_EXPIRES) if((rb_current_time() - source_p->localClient->chal_time) > CHALLENGE_EXPIRES)
{ {
@ -140,7 +140,7 @@ m_challenge(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
source_p->name, source_p->username, source_p->name, source_p->username,
source_p->host); source_p->host);
cleanup_challenge(source_p); cleanup_challenge(source_p);
return 0; return;
} }
parv[1]++; parv[1]++;
@ -162,7 +162,7 @@ m_challenge(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
rb_free(b_response); rb_free(b_response);
cleanup_challenge(source_p); cleanup_challenge(source_p);
return 0; return;
} }
rb_free(b_response); rb_free(b_response);
@ -184,7 +184,7 @@ m_challenge(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
"Failed CHALLENGE attempt - host mismatch by %s (%s@%s)", "Failed CHALLENGE attempt - host mismatch by %s (%s@%s)",
source_p->name, source_p->username, source_p->name, source_p->username,
source_p->host); source_p->host);
return 0; return;
} }
cleanup_challenge(source_p); cleanup_challenge(source_p);
@ -194,7 +194,7 @@ m_challenge(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
ilog(L_OPERED, "OPER %s by %s!%s@%s (%s)", ilog(L_OPERED, "OPER %s by %s!%s@%s (%s)",
source_p->localClient->opername, source_p->name, source_p->localClient->opername, source_p->name,
source_p->username, source_p->host, source_p->sockhost); source_p->username, source_p->host, source_p->sockhost);
return 0; return;
} }
cleanup_challenge(source_p); cleanup_challenge(source_p);
@ -213,13 +213,13 @@ m_challenge(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
"Failed CHALLENGE attempt - host mismatch by %s (%s@%s)", "Failed CHALLENGE attempt - host mismatch by %s (%s@%s)",
source_p->name, source_p->username, source_p->host); source_p->name, source_p->username, source_p->host);
return 0; return;
} }
if(!oper_p->rsa_pubkey) if(!oper_p->rsa_pubkey)
{ {
sendto_one_notice(source_p, ":I'm sorry, PK authentication is not enabled for your oper{} block."); sendto_one_notice(source_p, ":I'm sorry, PK authentication is not enabled for your oper{} block.");
return 0; return;
} }
if(IsOperConfNeedSSL(oper_p) && !IsSSLClient(source_p)) if(IsOperConfNeedSSL(oper_p) && !IsSSLClient(source_p))
@ -235,7 +235,7 @@ m_challenge(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
"Failed CHALLENGE attempt - missing SSL/TLS by %s (%s@%s)", "Failed CHALLENGE attempt - missing SSL/TLS by %s (%s@%s)",
source_p->name, source_p->username, source_p->host); source_p->name, source_p->username, source_p->host);
} }
return 0; return;
} }
if (oper_p->certfp != NULL) if (oper_p->certfp != NULL)
@ -253,11 +253,11 @@ m_challenge(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
"Failed OPER attempt - client certificate fingerprint mismatch by %s (%s@%s)", "Failed OPER attempt - client certificate fingerprint mismatch by %s (%s@%s)",
source_p->name, source_p->username, source_p->host); source_p->name, source_p->username, source_p->host);
} }
return 0; return;
} }
} }
if(!generate_challenge(&challenge, &(source_p->localClient->challenge), oper_p->rsa_pubkey)) if(generate_challenge(&challenge, &(source_p->localClient->challenge), oper_p->rsa_pubkey))
{ {
char *chal = challenge; char *chal = challenge;
source_p->localClient->chal_time = rb_current_time(); source_p->localClient->chal_time = rb_current_time();
@ -278,11 +278,9 @@ m_challenge(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
} }
else else
sendto_one_notice(source_p, ":Failed to generate challenge."); sendto_one_notice(source_p, ":Failed to generate challenge.");
return 0;
} }
static int static bool
generate_challenge(char **r_challenge, char **r_response, RSA * rsa) generate_challenge(char **r_challenge, char **r_response, RSA * rsa)
{ {
SHA_CTX ctx; SHA_CTX ctx;
@ -293,7 +291,7 @@ generate_challenge(char **r_challenge, char **r_response, RSA * rsa)
int ret; int ret;
if(!rsa) if(!rsa)
return -1; return false;
if(rb_get_random(secret, CHALLENGE_SECRET_LENGTH)) if(rb_get_random(secret, CHALLENGE_SECRET_LENGTH))
{ {
SHA1_Init(&ctx); SHA1_Init(&ctx);
@ -309,7 +307,7 @@ generate_challenge(char **r_challenge, char **r_response, RSA * rsa)
{ {
*r_challenge = (char *)rb_base64_encode(tmp, ret); *r_challenge = (char *)rb_base64_encode(tmp, ret);
rb_free(tmp); rb_free(tmp);
return 0; return true;
} }
rb_free(tmp); rb_free(tmp);
@ -324,7 +322,7 @@ generate_challenge(char **r_challenge, char **r_response, RSA * rsa)
cnt++; cnt++;
} }
return (-1); return false;
} }
#endif /* HAVE_LIBCRYPTO */ #endif /* HAVE_LIBCRYPTO */

View file

@ -30,10 +30,10 @@
static const char chghost_desc[] = "Provides commands used to change and retrieve client hostnames"; static const char chghost_desc[] = "Provides commands used to change and retrieve client hostnames";
static int me_realhost(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_realhost(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_chghost(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_chghost(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_chghost(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_chghost(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_chghost(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_chghost(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message realhost_msgtab = { struct Message realhost_msgtab = {
"REALHOST", 0, 0, 0, 0, "REALHOST", 0, 0, 0, 0,
@ -92,12 +92,12 @@ clean_host(const char *host)
* I don't think that's a big problem as the whole thing is a * I don't think that's a big problem as the whole thing is a
* race condition. * race condition.
*/ */
static int static void
me_realhost(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, me_realhost(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]) int parc, const char *parv[])
{ {
if (!IsPerson(source_p)) if (!IsPerson(source_p))
return 0; return;
del_from_hostname_hash(source_p->orighost, source_p); del_from_hostname_hash(source_p->orighost, source_p);
rb_strlcpy(source_p->orighost, parv[1], sizeof source_p->orighost); rb_strlcpy(source_p->orighost, parv[1], sizeof source_p->orighost);
@ -106,7 +106,7 @@ me_realhost(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
else else
ClearDynSpoof(source_p); ClearDynSpoof(source_p);
add_to_hostname_hash(source_p->orighost, source_p); add_to_hostname_hash(source_p->orighost, source_p);
return 0; return;
} }
static int static int
@ -150,14 +150,14 @@ do_chghost(struct Client *source_p, struct Client *target_p,
* parv[1] = target * parv[1] = target
* parv[2] = host * parv[2] = host
*/ */
static int static void
ms_chghost(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, ms_chghost(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]) int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
if (!(target_p = find_person(parv[1]))) if (!(target_p = find_person(parv[1])))
return -1; return;
if (do_chghost(source_p, target_p, parv[2], 0)) if (do_chghost(source_p, target_p, parv[2], 0))
{ {
@ -169,7 +169,7 @@ ms_chghost(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
use_id(source_p), use_id(target_p), parv[2]); use_id(source_p), use_id(target_p), parv[2]);
} }
return 0; return;
} }
/* /*
@ -177,18 +177,18 @@ ms_chghost(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
* parv[1] = target * parv[1] = target
* parv[2] = host * parv[2] = host
*/ */
static int static void
me_chghost(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, me_chghost(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]) int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
if (!(target_p = find_person(parv[1]))) if (!(target_p = find_person(parv[1])))
return -1; return;
do_chghost(source_p, target_p, parv[2], 1); do_chghost(source_p, target_p, parv[2], 1);
return 0; return;
} }
/* /*
@ -199,7 +199,7 @@ me_chghost(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
/* Disable this because of the abuse potential -- jilles /* Disable this because of the abuse potential -- jilles
* No, make it toggleable via ./configure. --nenolod * No, make it toggleable via ./configure. --nenolod
*/ */
static int static void
mo_chghost(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, mo_chghost(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]) int parc, const char *parv[])
{ {
@ -210,20 +210,20 @@ mo_chghost(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "admin"); me.name, source_p->name, "admin");
return 0; return;
} }
if (!(target_p = find_named_person(parv[1]))) if (!(target_p = find_named_person(parv[1])))
{ {
sendto_one_numeric(source_p, ERR_NOSUCHNICK, sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), parv[1]); form_str(ERR_NOSUCHNICK), parv[1]);
return 0; return;
} }
if (!clean_host(parv[2])) if (!clean_host(parv[2]))
{ {
sendto_one_notice(source_p, ":Hostname %s is invalid", parv[2]); sendto_one_notice(source_p, ":Hostname %s is invalid", parv[2]);
return 0; return;
} }
do_chghost(source_p, target_p, parv[2], 0); do_chghost(source_p, target_p, parv[2], 0);
@ -239,6 +239,6 @@ mo_chghost(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
"CHGHOST"); "CHGHOST");
#endif #endif
return 0; return;
} }

View file

@ -33,7 +33,7 @@
static const char close_desc[] = "Provides the CLOSE command to clear all unfinished connections"; static const char close_desc[] = "Provides the CLOSE command to clear all unfinished connections";
static int mo_close(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_close(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message close_msgtab = { struct Message close_msgtab = {
"CLOSE", 0, 0, 0, 0, "CLOSE", 0, 0, 0, 0,
@ -48,7 +48,7 @@ DECLARE_MODULE_AV2(close, NULL, NULL, close_clist, NULL, NULL, NULL, NULL, close
* mo_close - CLOSE message handler * mo_close - CLOSE message handler
* - added by Darren Reed Jul 13 1992. * - added by Darren Reed Jul 13 1992.
*/ */
static int static void
mo_close(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_close(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -68,5 +68,5 @@ mo_close(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
} }
sendto_one(source_p, form_str(RPL_CLOSEEND), me.name, source_p->name, closed); sendto_one(source_p, form_str(RPL_CLOSEEND), me.name, source_p->name, closed);
return 0; return;
} }

View file

@ -45,9 +45,9 @@
static const char cmessage_desc[] = static const char cmessage_desc[] =
"Provides the CPRIVMSG and CNOTICE facilities for bypassing anti-spam measures"; "Provides the CPRIVMSG and CNOTICE facilities for bypassing anti-spam measures";
static int m_cmessage(int, const char *, struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_cmessage(int, const char *, struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int m_cprivmsg(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_cprivmsg(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int m_cnotice(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_cnotice(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int static int
_modinit(void) _modinit(void)
@ -81,19 +81,19 @@ DECLARE_MODULE_AV2(cmessage, _modinit, _moddeinit, cmessage_clist, NULL, NULL, N
#define PRIVMSG 0 #define PRIVMSG 0
#define NOTICE 1 #define NOTICE 1
static int static void
m_cprivmsg(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_cprivmsg(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
return m_cmessage(PRIVMSG, "PRIVMSG", msgbuf_p, client_p, source_p, parc, parv); m_cmessage(PRIVMSG, "PRIVMSG", msgbuf_p, client_p, source_p, parc, parv);
} }
static int static void
m_cnotice(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_cnotice(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
return m_cmessage(NOTICE, "NOTICE", msgbuf_p, client_p, source_p, parc, parv); m_cmessage(NOTICE, "NOTICE", msgbuf_p, client_p, source_p, parc, parv);
} }
static int static void
m_cmessage(int p_or_n, const char *command, struct MsgBuf *msgbuf_p, m_cmessage(int p_or_n, const char *command, struct MsgBuf *msgbuf_p,
struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
@ -109,7 +109,7 @@ m_cmessage(int p_or_n, const char *command, struct MsgBuf *msgbuf_p,
if(p_or_n != NOTICE) if(p_or_n != NOTICE)
sendto_one_numeric(source_p, ERR_NOSUCHNICK, sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), parv[1]); form_str(ERR_NOSUCHNICK), parv[1]);
return 0; return;
} }
if((chptr = find_channel(parv[2])) == NULL) if((chptr = find_channel(parv[2])) == NULL)
@ -117,7 +117,7 @@ m_cmessage(int p_or_n, const char *command, struct MsgBuf *msgbuf_p,
if(p_or_n != NOTICE) if(p_or_n != NOTICE)
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[2]); form_str(ERR_NOSUCHCHANNEL), parv[2]);
return 0; return;
} }
if((msptr = find_channel_membership(chptr, source_p)) == NULL) if((msptr = find_channel_membership(chptr, source_p)) == NULL)
@ -126,7 +126,7 @@ m_cmessage(int p_or_n, const char *command, struct MsgBuf *msgbuf_p,
sendto_one_numeric(source_p, ERR_NOTONCHANNEL, sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), form_str(ERR_NOTONCHANNEL),
chptr->chname); chptr->chname);
return 0; return;
} }
if(!is_chanop_voiced(msptr)) if(!is_chanop_voiced(msptr))
@ -134,7 +134,7 @@ m_cmessage(int p_or_n, const char *command, struct MsgBuf *msgbuf_p,
if(p_or_n != NOTICE) if(p_or_n != NOTICE)
sendto_one(source_p, form_str(ERR_VOICENEEDED), sendto_one(source_p, form_str(ERR_VOICENEEDED),
me.name, source_p->name, chptr->chname); me.name, source_p->name, chptr->chname);
return 0; return;
} }
if(!IsMember(target_p, chptr)) if(!IsMember(target_p, chptr))
@ -143,7 +143,7 @@ m_cmessage(int p_or_n, const char *command, struct MsgBuf *msgbuf_p,
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL, sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), form_str(ERR_USERNOTINCHANNEL),
target_p->name, chptr->chname); target_p->name, chptr->chname);
return 0; return;
} }
if(MyClient(target_p) && (IsSetCallerId(target_p) || (IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0])) && if(MyClient(target_p) && (IsSetCallerId(target_p) || (IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0])) &&
@ -155,7 +155,7 @@ m_cmessage(int p_or_n, const char *command, struct MsgBuf *msgbuf_p,
sendto_one_numeric(source_p, ERR_NONONREG, sendto_one_numeric(source_p, ERR_NONONREG,
form_str(ERR_NONONREG), form_str(ERR_NONONREG),
target_p->name); target_p->name);
return 0; return;
} }
if(p_or_n != NOTICE) if(p_or_n != NOTICE)
sendto_one_numeric(source_p, ERR_TARGUMODEG, sendto_one_numeric(source_p, ERR_TARGUMODEG,
@ -176,12 +176,11 @@ m_cmessage(int p_or_n, const char *command, struct MsgBuf *msgbuf_p,
target_p->localClient->last_caller_id_time = rb_current_time(); target_p->localClient->last_caller_id_time = rb_current_time();
} }
return 0; return;
} }
if(p_or_n != NOTICE) if(p_or_n != NOTICE)
source_p->localClient->last = rb_current_time(); source_p->localClient->last = rb_current_time();
sendto_anywhere(target_p, source_p, command, ":%s", parv[3]); sendto_anywhere(target_p, source_p, command, ":%s", parv[3]);
return 0;
} }

View file

@ -41,8 +41,8 @@
static const char connect_desc[] = static const char connect_desc[] =
"Provides the CONNECT command to introduce servers to the network"; "Provides the CONNECT command to introduce servers to the network";
static int mo_connect(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_connect(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_connect(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_connect(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message connect_msgtab = { struct Message connect_msgtab = {
"CONNECT", 0, 0, 0, 0, "CONNECT", 0, 0, 0, 0,
@ -63,7 +63,7 @@ DECLARE_MODULE_AV2(connect, NULL, NULL, connect_clist, NULL, NULL, NULL, NULL, c
* parv[2] = port number * parv[2] = port number
* parv[3] = remote server * parv[3] = remote server
*/ */
static int static void
mo_connect(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_connect(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
int port; int port;
@ -77,17 +77,17 @@ mo_connect(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "remote"); me.name, source_p->name, "remote");
return 0; return;
} }
if(hunt_server(client_p, source_p, ":%s CONNECT %s %s :%s", 3, parc, parv) != HUNTED_ISME) if(hunt_server(client_p, source_p, ":%s CONNECT %s %s :%s", 3, parc, parv) != HUNTED_ISME)
return 0; return;
if((target_p = find_server(source_p, parv[1]))) if((target_p = find_server(source_p, parv[1])))
{ {
sendto_one_notice(source_p, ":Connect: Server %s already exists from %s.", parv[1], sendto_one_notice(source_p, ":Connect: Server %s already exists from %s.", parv[1],
target_p->from->name); target_p->from->name);
return 0; return;
} }
/* /*
@ -96,7 +96,7 @@ mo_connect(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
if((server_p = find_server_conf(parv[1])) == NULL) if((server_p = find_server_conf(parv[1])) == NULL)
{ {
sendto_one_notice(source_p, ":Connect: Host %s not listed in ircd.conf", parv[1]); sendto_one_notice(source_p, ":Connect: Host %s not listed in ircd.conf", parv[1]);
return 0; return;
} }
if(ServerConfSSL(server_p) && (!ssl_ok || !get_ssld_count())) if(ServerConfSSL(server_p) && (!ssl_ok || !get_ssld_count()))
@ -104,7 +104,7 @@ mo_connect(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
sendto_one_notice(source_p, sendto_one_notice(source_p,
":Connect: Server %s is set to use SSL/TLS but SSL/TLS is not configured.", ":Connect: Server %s is set to use SSL/TLS but SSL/TLS is not configured.",
parv[1]); parv[1]);
return 0; return;
} }
/* /*
@ -120,7 +120,7 @@ mo_connect(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
else if(port <= 0) else if(port <= 0)
{ {
sendto_one_notice(source_p, ":Connect: illegal port number"); sendto_one_notice(source_p, ":Connect: illegal port number");
return 0; return;
} }
/* /*
@ -152,8 +152,6 @@ mo_connect(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
* destroyed, so reset it back to the configured settings * destroyed, so reset it back to the configured settings
*/ */
server_p->port = tmpport; server_p->port = tmpport;
return 0;
} }
/* /*
@ -166,7 +164,7 @@ mo_connect(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
* parv[2] = port number * parv[2] = port number
* parv[3] = remote server * parv[3] = remote server
*/ */
static int static void
ms_connect(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_connect(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
int port; int port;
@ -175,13 +173,13 @@ ms_connect(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
struct Client *target_p; struct Client *target_p;
if(hunt_server(client_p, source_p, ":%s CONNECT %s %s :%s", 3, parc, parv) != HUNTED_ISME) if(hunt_server(client_p, source_p, ":%s CONNECT %s %s :%s", 3, parc, parv) != HUNTED_ISME)
return 0; return;
if((target_p = find_server(NULL, parv[1]))) if((target_p = find_server(NULL, parv[1])))
{ {
sendto_one_notice(source_p, ":Connect: Server %s already exists from %s.", sendto_one_notice(source_p, ":Connect: Server %s already exists from %s.",
parv[1], target_p->from->name); parv[1], target_p->from->name);
return 0; return;
} }
/* /*
@ -191,7 +189,7 @@ ms_connect(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
{ {
sendto_one_notice(source_p, ":Connect: Host %s not listed in ircd.conf", sendto_one_notice(source_p, ":Connect: Host %s not listed in ircd.conf",
parv[1]); parv[1]);
return 0; return;
} }
if(ServerConfSSL(server_p) && (!ssl_ok || !get_ssld_count())) if(ServerConfSSL(server_p) && (!ssl_ok || !get_ssld_count()))
@ -199,7 +197,7 @@ ms_connect(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
sendto_one_notice(source_p, sendto_one_notice(source_p,
":Connect: Server %s is set to use SSL/TLS but SSL/TLS is not configured.", ":Connect: Server %s is set to use SSL/TLS but SSL/TLS is not configured.",
parv[1]); parv[1]);
return 0; return;
} }
/* /*
@ -217,7 +215,7 @@ ms_connect(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
else if(port <= 0) else if(port <= 0)
{ {
sendto_one_notice(source_p, ":Connect: Illegal port number"); sendto_one_notice(source_p, ":Connect: Illegal port number");
return 0; return;
} }
/* /*
@ -248,5 +246,4 @@ ms_connect(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
* destroyed * destroyed
*/ */
server_p->port = tmpport; server_p->port = tmpport;
return 0;
} }

View file

@ -45,10 +45,10 @@
static const char dline_desc[] = "Provides the DLINE facility to ban users via IP address"; static const char dline_desc[] = "Provides the DLINE facility to ban users via IP address";
static int mo_dline(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_dline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_dline(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_dline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_undline(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_undline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_undline(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_undline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message dline_msgtab = { struct Message dline_msgtab = {
"DLINE", 0, 0, 0, 0, "DLINE", 0, 0, 0, 0,
@ -62,20 +62,18 @@ struct Message undline_msgtab = {
mapi_clist_av1 dline_clist[] = { &dline_msgtab, &undline_msgtab, NULL }; mapi_clist_av1 dline_clist[] = { &dline_msgtab, &undline_msgtab, NULL };
static const char dline_desc[] = "Provides the DLINE facility to ban users via IP address";
DECLARE_MODULE_AV2(dline, NULL, NULL, dline_clist, NULL, NULL, NULL, NULL, dline_desc); DECLARE_MODULE_AV2(dline, NULL, NULL, dline_clist, NULL, NULL, NULL, NULL, dline_desc);
static int remove_temp_dline(struct ConfItem *); static bool remove_temp_dline(struct ConfItem *);
static int apply_dline(struct Client *, const char *, int, char *); static void apply_dline(struct Client *, const char *, int, char *);
static int apply_undline(struct Client *, const char *); static void apply_undline(struct Client *, const char *);
/* mo_dline() /* mo_dline()
* *
* parv[1] - dline to add * parv[1] - dline to add
* parv[2] - reason * parv[2] - reason
*/ */
static int static void
mo_dline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_dline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
char def[] = "No Reason"; char def[] = "No Reason";
@ -89,7 +87,7 @@ mo_dline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(!IsOperK(source_p)) if(!IsOperK(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "kline"); sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "kline");
return 0; return;
} }
if((tdline_time = valid_temp_time(parv[loc])) >= 0) if((tdline_time = valid_temp_time(parv[loc])) >= 0)
@ -103,7 +101,7 @@ mo_dline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if (*dlhost == ':') if (*dlhost == ':')
{ {
sendto_one_notice(source_p, ":Invalid D-Line"); sendto_one_notice(source_p, ":Invalid D-Line");
return 0; return;
} }
if(parc >= loc + 2 && !irccmp(parv[loc], "ON")) if(parc >= loc + 2 && !irccmp(parv[loc], "ON"))
@ -112,7 +110,7 @@ mo_dline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "remoteban"); me.name, source_p->name, "remoteban");
return 0; return;
} }
target_server = parv[loc + 1]; target_server = parv[loc + 1];
@ -130,20 +128,19 @@ mo_dline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
target_server, tdline_time, dlhost, reason); target_server, tdline_time, dlhost, reason);
if(!match(target_server, me.name)) if(!match(target_server, me.name))
return 0; return;
} }
apply_dline(source_p, dlhost, tdline_time, reason); apply_dline(source_p, dlhost, tdline_time, reason);
check_dlines(); check_dlines();
return 0;
} }
/* mo_undline() /* mo_undline()
* *
* parv[1] = dline to remove * parv[1] = dline to remove
*/ */
static int static void
mo_undline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_undline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
const char *cidr; const char *cidr;
@ -152,7 +149,7 @@ mo_undline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
if(!IsOperK(source_p)) if(!IsOperK(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "unkline"); sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "unkline");
return 0; return;
} }
cidr = parv[1]; cidr = parv[1];
@ -163,7 +160,7 @@ mo_undline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "remoteban"); me.name, source_p->name, "remoteban");
return 0; return;
} }
target_server = parv[3]; target_server = parv[3];
@ -171,15 +168,13 @@ mo_undline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
CAP_ENCAP, NOCAPS, "ENCAP %s UNDLINE %s", target_server, cidr); CAP_ENCAP, NOCAPS, "ENCAP %s UNDLINE %s", target_server, cidr);
if(!match(target_server, me.name)) if(!match(target_server, me.name))
return 0; return;
} }
apply_undline(source_p, cidr); apply_undline(source_p, cidr);
return 0;
} }
static int static void
me_dline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv) me_dline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{ {
int tdline_time = atoi(parv[1]); int tdline_time = atoi(parv[1]);
@ -188,35 +183,32 @@ me_dline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
*/ */
if(!IsPerson(source_p)) if(!IsPerson(source_p))
return 0; return;
if(!find_shared_conf(source_p->username, source_p->host, if(!find_shared_conf(source_p->username, source_p->host,
source_p->servptr->name, source_p->servptr->name,
tdline_time > 0 ? SHARED_TDLINE : SHARED_PDLINE)) tdline_time > 0 ? SHARED_TDLINE : SHARED_PDLINE))
return 0; return;
apply_dline(source_p, parv[2], tdline_time, LOCAL_COPY(parv[3])); apply_dline(source_p, parv[2], tdline_time, LOCAL_COPY(parv[3]));
check_dlines(); check_dlines();
return 0;
} }
static int static void
me_undline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv) me_undline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{ {
if(!IsPerson(source_p)) if(!IsPerson(source_p))
return 0; return;
if(!find_shared_conf(source_p->username, source_p->host, if(!find_shared_conf(source_p->username, source_p->host,
source_p->servptr->name, SHARED_UNDLINE)) source_p->servptr->name, SHARED_UNDLINE))
return 0; return;
apply_undline(source_p, parv[1]); apply_undline(source_p, parv[1]);
return 0;
} }
static int static void
apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *reason) apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *reason)
{ {
struct ConfItem *aconf; struct ConfItem *aconf;
@ -229,7 +221,7 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *
if(ty == HM_HOST) if(ty == HM_HOST)
{ {
sendto_one(source_p, ":%s NOTICE %s :Invalid D-Line", me.name, source_p->name); sendto_one(source_p, ":%s NOTICE %s :Invalid D-Line", me.name, source_p->name);
return 0; return;
} }
#ifdef RB_IPV6 #ifdef RB_IPV6
if(ty == HM_IPV6) if(ty == HM_IPV6)
@ -245,7 +237,7 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *
{ {
sendto_one_notice(source_p, sendto_one_notice(source_p,
":For safety, bitmasks less than 8 require conf access."); ":For safety, bitmasks less than 8 require conf access.");
return 0; return;
} }
} }
else else
@ -254,7 +246,7 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *
{ {
sendto_one_notice(source_p, sendto_one_notice(source_p,
":Dline bitmasks less than 16 are for admins only."); ":Dline bitmasks less than 16 are for admins only.");
return 0; return;
} }
} }
@ -277,7 +269,7 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *
":%s NOTICE %s :[%s] already D-lined by [%s] - %s", ":%s NOTICE %s :[%s] already D-lined by [%s] - %s",
me.name, source_p->name, dlhost, aconf->host, me.name, source_p->name, dlhost, aconf->host,
creason); creason);
return 0; return;
} }
} }
} }
@ -357,11 +349,9 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *
aconf->host, reason, oper_reason); aconf->host, reason, oper_reason);
} }
} }
return 0;
} }
static int static void
apply_undline(struct Client *source_p, const char *cidr) apply_undline(struct Client *source_p, const char *cidr)
{ {
char buf[BUFSIZE]; char buf[BUFSIZE];
@ -370,14 +360,14 @@ apply_undline(struct Client *source_p, const char *cidr)
if(parse_netmask(cidr, NULL, NULL) == HM_HOST) if(parse_netmask(cidr, NULL, NULL) == HM_HOST)
{ {
sendto_one_notice(source_p, ":Invalid D-Line"); sendto_one_notice(source_p, ":Invalid D-Line");
return 0; return;
} }
aconf = find_exact_conf_by_address(cidr, CONF_DLINE, NULL); aconf = find_exact_conf_by_address(cidr, CONF_DLINE, NULL);
if(aconf == NULL) if(aconf == NULL)
{ {
sendto_one_notice(source_p, ":No D-Line for %s", cidr); sendto_one_notice(source_p, ":No D-Line for %s", cidr);
return 0; return;
} }
rb_strlcpy(buf, aconf->host, sizeof buf); rb_strlcpy(buf, aconf->host, sizeof buf);
@ -390,7 +380,7 @@ apply_undline(struct Client *source_p, const char *cidr)
"%s has removed the temporary D-Line for: [%s]", "%s has removed the temporary D-Line for: [%s]",
get_oper_name(source_p), buf); get_oper_name(source_p), buf);
ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), buf); ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), buf);
return 0; return;
} }
bandb_del(BANDB_DLINE, aconf->host, NULL); bandb_del(BANDB_DLINE, aconf->host, NULL);
@ -401,17 +391,15 @@ apply_undline(struct Client *source_p, const char *cidr)
get_oper_name(source_p), aconf->host); get_oper_name(source_p), aconf->host);
ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), aconf->host); ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), aconf->host);
delete_one_address_conf(aconf->host, aconf); delete_one_address_conf(aconf->host, aconf);
return 0;
} }
/* remove_temp_dline() /* remove_temp_dline()
* *
* inputs - confitem to undline * inputs - confitem to undline
* outputs - * outputs - true if removed, false otherwise.
* side effects - tries to undline anything that matches * side effects - tries to undline anything that matches
*/ */
static int static bool
remove_temp_dline(struct ConfItem *aconf) remove_temp_dline(struct ConfItem *aconf)
{ {
rb_dlink_node *ptr; rb_dlink_node *ptr;
@ -425,10 +413,10 @@ remove_temp_dline(struct ConfItem *aconf)
{ {
rb_dlinkDestroy(ptr, &temp_dlines[i]); rb_dlinkDestroy(ptr, &temp_dlines[i]);
delete_one_address_conf(aconf->host, aconf); delete_one_address_conf(aconf->host, aconf);
return YES; return true;
} }
} }
} }
return NO; return false;
} }

View file

@ -43,7 +43,7 @@
static const char encap_desc[] = "Provides the TS6 ENCAP facility"; static const char encap_desc[] = "Provides the TS6 ENCAP facility";
static int ms_encap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, static void ms_encap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]); int parc, const char *parv[]);
struct Message encap_msgtab = { struct Message encap_msgtab = {
@ -61,7 +61,7 @@ DECLARE_MODULE_AV2(encap, NULL, NULL, encap_clist, NULL, NULL, NULL, NULL, encap
* parv[2] - subcommand * parv[2] - subcommand
* parv[3] - parameters * parv[3] - parameters
*/ */
static int static void
ms_encap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_encap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
char buffer[BUFSIZE]; char buffer[BUFSIZE];
@ -78,7 +78,7 @@ ms_encap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
/* ugh, not even at the last parameter, just bail --fl */ /* ugh, not even at the last parameter, just bail --fl */
if((size_t)(cur_len + len) >= sizeof(buffer)) if((size_t)(cur_len + len) >= sizeof(buffer))
return 0; return;
snprintf(ptr, sizeof(buffer) - cur_len, "%s ", parv[i]); snprintf(ptr, sizeof(buffer) - cur_len, "%s ", parv[i]);
cur_len += len; cur_len += len;
@ -103,6 +103,4 @@ ms_encap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
/* if it matches us, find a matching handler and call it */ /* if it matches us, find a matching handler and call it */
if(match(parv[1], me.name)) if(match(parv[1], me.name))
handle_encap(msgbuf_p, client_p, source_p, parv[2], parc - 2, parv + 2); handle_encap(msgbuf_p, client_p, source_p, parv[2], parc - 2, parv + 2);
return 0;
} }

View file

@ -53,10 +53,10 @@
static const char etrace_desc[] = static const char etrace_desc[] =
"Provides enhanced tracing facilities to opers (ETRACE, CHANTRACE, and MASKTRACE)"; "Provides enhanced tracing facilities to opers (ETRACE, CHANTRACE, and MASKTRACE)";
static int mo_etrace(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_etrace(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_etrace(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_etrace(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int m_chantrace(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_chantrace(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_masktrace(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_masktrace(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message etrace_msgtab = { struct Message etrace_msgtab = {
"ETRACE", 0, 0, 0, 0, "ETRACE", 0, 0, 0, 0,
@ -101,7 +101,7 @@ static const char *spoofed_sockhost = "0";
* parv[1] = options [or target] * parv[1] = options [or target]
* parv[2] = [target] * parv[2] = [target]
*/ */
static int static void
mo_etrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_etrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(parc > 1 && !EmptyString(parv[1])) if(parc > 1 && !EmptyString(parv[1]))
@ -135,17 +135,15 @@ mo_etrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
} }
else else
do_etrace(source_p, 1, 1); do_etrace(source_p, 1, 1);
return 0;
} }
static int static void
me_etrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) me_etrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
if(!IsOper(source_p) || parc < 2 || EmptyString(parv[1])) if(!IsOper(source_p) || parc < 2 || EmptyString(parv[1]))
return 0; return;
/* we cant etrace remote clients.. we shouldnt even get sent them */ /* we cant etrace remote clients.. we shouldnt even get sent them */
if((target_p = find_person(parv[1])) && MyClient(target_p)) if((target_p = find_person(parv[1])) && MyClient(target_p))
@ -153,8 +151,6 @@ me_etrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
sendto_one_numeric(source_p, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE), sendto_one_numeric(source_p, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE),
target_p ? target_p->name : parv[1]); target_p ? target_p->name : parv[1]);
return 0;
} }
static void static void
@ -229,7 +225,7 @@ do_single_etrace(struct Client *source_p, struct Client *target_p)
target_p->localClient->fullcaps, target_p->info); target_p->localClient->fullcaps, target_p->info);
} }
static int static void
m_chantrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_chantrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -251,7 +247,7 @@ m_chantrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
{ {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
me.name, source_p->name, "CHANTRACE"); me.name, source_p->name, "CHANTRACE");
return 0; return;
} }
} }
@ -259,7 +255,7 @@ m_chantrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
{ {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL),
name); name);
return 0; return;
} }
/* dont report operspys for nonexistant channels. */ /* dont report operspys for nonexistant channels. */
@ -270,7 +266,7 @@ m_chantrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
{ {
sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL), sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL),
chptr->chname); chptr->chname);
return 0; return;
} }
RB_DLINK_FOREACH(ptr, chptr->members.head) RB_DLINK_FOREACH(ptr, chptr->members.head)
@ -295,7 +291,6 @@ m_chantrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
} }
sendto_one_numeric(source_p, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE), me.name); sendto_one_numeric(source_p, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE), me.name);
return 0;
} }
static void static void
@ -342,7 +337,7 @@ match_masktrace(struct Client *source_p, rb_dlink_list *list,
} }
} }
static int static void
mo_masktrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, mo_masktrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc,
const char *parv[]) const char *parv[])
{ {
@ -372,7 +367,7 @@ mo_masktrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
if((hostname = strchr(name, '@')) == NULL) if((hostname = strchr(name, '@')) == NULL)
{ {
sendto_one_notice(source_p, ":Invalid parameters"); sendto_one_notice(source_p, ":Invalid parameters");
return 0; return;
} }
*hostname++ = '\0'; *hostname++ = '\0';
@ -387,7 +382,7 @@ mo_masktrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
if(EmptyString(username) || EmptyString(hostname)) if(EmptyString(username) || EmptyString(hostname))
{ {
sendto_one_notice(source_p, ":Invalid parameters"); sendto_one_notice(source_p, ":Invalid parameters");
return 0; return;
} }
if(operspy) { if(operspy) {
@ -407,5 +402,4 @@ mo_masktrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
match_masktrace(source_p, &lclient_list, username, hostname, name, gecos); match_masktrace(source_p, &lclient_list, username, hostname, name, gecos);
sendto_one_numeric(source_p, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE), me.name); sendto_one_numeric(source_p, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE), me.name);
return 0;
} }

View file

@ -17,10 +17,10 @@
static const char grant_desc[] = static const char grant_desc[] =
"Provides the grant facility for giving other users specific privilege sets"; "Provides the grant facility for giving other users specific privilege sets";
static int mo_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void mo_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int me_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void me_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int do_grant(struct Client *source_p, struct Client *target_p, const char *new_privset); static void do_grant(struct Client *source_p, struct Client *target_p, const char *new_privset);
struct Message grant_msgtab = { struct Message grant_msgtab = {
"GRANT", 0, 0, 0, 0, "GRANT", 0, 0, 0, 0,
@ -31,7 +31,7 @@ mapi_clist_av1 grant_clist[] = { &grant_msgtab, NULL };
DECLARE_MODULE_AV2(grant, NULL, NULL, grant_clist, NULL, NULL, NULL, NULL, grant_desc); DECLARE_MODULE_AV2(grant, NULL, NULL, grant_clist, NULL, NULL, NULL, NULL, grant_desc);
static int static void
mo_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -39,7 +39,7 @@ mo_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(!HasPrivilege(source_p, "oper:grant")) if(!HasPrivilege(source_p, "oper:grant"))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "grant"); sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "grant");
return 0; return;
} }
target_p = find_named_person(parv[1]); target_p = find_named_person(parv[1]);
@ -47,7 +47,7 @@ mo_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one_numeric(source_p, ERR_NOSUCHNICK, sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), parv[1]); form_str(ERR_NOSUCHNICK), parv[1]);
return 0; return;
} }
if (MyClient(target_p)) if (MyClient(target_p))
@ -60,11 +60,10 @@ mo_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
get_id(source_p, target_p), target_p->servptr->name, get_id(source_p, target_p), target_p->servptr->name,
get_id(target_p, target_p), parv[2]); get_id(target_p, target_p), parv[2]);
} }
return 0;
} }
static int me_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) static void
me_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -73,7 +72,7 @@ static int me_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Cli
{ {
sendto_one_numeric(source_p, ERR_NOSUCHNICK, sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), parv[1]); form_str(ERR_NOSUCHNICK), parv[1]);
return 0; return;
} }
if(!find_shared_conf(source_p->username, source_p->host, if(!find_shared_conf(source_p->username, source_p->host,
@ -81,26 +80,26 @@ static int me_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Cli
{ {
sendto_one(source_p, ":%s NOTICE %s :You don't have an appropriate shared" sendto_one(source_p, ":%s NOTICE %s :You don't have an appropriate shared"
"block to grant privilege on this server.", me.name, source_p->name); "block to grant privilege on this server.", me.name, source_p->name);
return 0; return;
} }
do_grant(source_p, target_p, parv[2]); do_grant(source_p, target_p, parv[2]);
return 0;
} }
static int do_grant(struct Client *source_p, struct Client *target_p, const char *new_privset) static void
do_grant(struct Client *source_p, struct Client *target_p, const char *new_privset)
{ {
int dooper = 0, dodeoper = 0; int dooper = 0, dodeoper = 0;
struct PrivilegeSet *privset = 0; struct PrivilegeSet *privset = 0;
const char *modeparv[4];
if (!strcmp(new_privset, "deoper")) if (!strcmp(new_privset, "deoper"))
{ {
if (!IsOper(target_p)) if (!IsOper(target_p))
{ {
sendto_one_notice(source_p, ":You can't deoper someone who isn't an oper."); sendto_one_notice(source_p, ":You can't deoper someone who isn't an oper.");
return 0; return;
} }
new_privset = "default"; new_privset = "default";
dodeoper = 1; dodeoper = 1;
@ -113,13 +112,13 @@ static int do_grant(struct Client *source_p, struct Client *target_p, const char
if (!(privset = privilegeset_get(new_privset))) if (!(privset = privilegeset_get(new_privset)))
{ {
sendto_one_notice(source_p, ":There is no privilege set named '%s'.", new_privset); sendto_one_notice(source_p, ":There is no privilege set named '%s'.", new_privset);
return 0; return;
} }
if (privset == target_p->localClient->privset) if (privset == target_p->localClient->privset)
{ {
sendto_one_notice(source_p, ":%s already has privilege set %s.", target_p->name, target_p->localClient->privset->name); sendto_one_notice(source_p, ":%s already has privilege set %s.", target_p->name, target_p->localClient->privset->name);
return 0; return;
} }
} }
@ -159,11 +158,8 @@ static int do_grant(struct Client *source_p, struct Client *target_p, const char
} }
target_p->localClient->privset = privset; target_p->localClient->privset = privset;
const char *modeparv[4];
modeparv[0] = modeparv[1] = target_p->name; modeparv[0] = modeparv[1] = target_p->name;
modeparv[2] = "+"; modeparv[2] = "+";
modeparv[3] = NULL; modeparv[3] = NULL;
user_mode(target_p, target_p, 3, modeparv); user_mode(target_p, target_p, 3, modeparv);
return 0;
} }

View file

@ -39,9 +39,9 @@
static const char help_desc[] = static const char help_desc[] =
"Provides the help facility for commands, modes, and server concepts"; "Provides the help facility for commands, modes, and server concepts";
static int m_help(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_help(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_help(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_help(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_uhelp(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_uhelp(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void dohelp(struct Client *, int, const char *); static void dohelp(struct Client *, int, const char *);
struct Message help_msgtab = { struct Message help_msgtab = {
@ -60,33 +60,29 @@ DECLARE_MODULE_AV2(help, NULL, NULL, help_clist, NULL, NULL, NULL, NULL, help_de
/* /*
* m_help - HELP message handler * m_help - HELP message handler
*/ */
static int static void
m_help(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_help(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
dohelp(source_p, HELP_USER, parc > 1 ? parv[1] : NULL); dohelp(source_p, HELP_USER, parc > 1 ? parv[1] : NULL);
return 0;
} }
/* /*
* mo_help - HELP message handler * mo_help - HELP message handler
*/ */
static int static void
mo_help(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_help(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
dohelp(source_p, HELP_OPER, parc > 1 ? parv[1] : NULL); dohelp(source_p, HELP_OPER, parc > 1 ? parv[1] : NULL);
return 0;
} }
/* /*
* mo_uhelp - HELP message handler * mo_uhelp - HELP message handler
* This is used so that opers can view the user help file without deopering * This is used so that opers can view the user help file without deopering
*/ */
static int static void
mo_uhelp(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_uhelp(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
dohelp(source_p, HELP_USER, parc > 1 ? parv[1] : NULL); dohelp(source_p, HELP_USER, parc > 1 ? parv[1] : NULL);
return 0;
} }
static void static void
@ -127,5 +123,4 @@ dohelp(struct Client *source_p, int flags, const char *topic)
sendto_one(source_p, form_str(RPL_ENDOFHELP), sendto_one(source_p, form_str(RPL_ENDOFHELP),
me.name, source_p->name, topic); me.name, source_p->name, topic);
return;
} }

View file

@ -47,8 +47,8 @@ static void send_birthdate_online_time(struct Client *source_p);
static void send_info_text(struct Client *source_p); static void send_info_text(struct Client *source_p);
static void info_spy(struct Client *); static void info_spy(struct Client *);
static int m_info(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_info(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_info(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_info(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message info_msgtab = { struct Message info_msgtab = {
"INFO", 0, 0, 0, 0, "INFO", 0, 0, 0, 0,
@ -672,7 +672,7 @@ static struct InfoStruct info_table[] = {
** m_info ** m_info
** parv[1] = servername ** parv[1] = servername
*/ */
static int static void
m_info(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_info(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
static time_t last_used = 0L; static time_t last_used = 0L;
@ -683,13 +683,13 @@ m_info(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
sendto_one(source_p, form_str(RPL_LOAD2HI), sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "INFO"); me.name, source_p->name, "INFO");
sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO)); sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO));
return 0; return;
} }
else else
last_used = rb_current_time(); last_used = rb_current_time();
if(hunt_server(client_p, source_p, ":%s INFO :%s", 1, parc, parv) != HUNTED_ISME) if(hunt_server(client_p, source_p, ":%s INFO :%s", 1, parc, parv) != HUNTED_ISME)
return 0; return;
info_spy(source_p); info_spy(source_p);
@ -697,14 +697,13 @@ m_info(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
send_birthdate_online_time(source_p); send_birthdate_online_time(source_p);
sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO)); sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO));
return 0;
} }
/* /*
** mo_info ** mo_info
** parv[1] = servername ** parv[1] = servername
*/ */
static int static void
mo_info(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_info(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(hunt_server(client_p, source_p, ":%s INFO :%s", 1, parc, parv) == HUNTED_ISME) if(hunt_server(client_p, source_p, ":%s INFO :%s", 1, parc, parv) == HUNTED_ISME)
@ -723,8 +722,6 @@ mo_info(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO)); sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO));
} }
return 0;
} }
/* /*

View file

@ -41,7 +41,7 @@
static const char invite_desc[] = "Provides facilities for invite and related notifications"; static const char invite_desc[] = "Provides facilities for invite and related notifications";
static int m_invite(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_invite(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static unsigned int CAP_INVITE_NOTIFY = 0; static unsigned int CAP_INVITE_NOTIFY = 0;
struct Message invite_msgtab = { struct Message invite_msgtab = {
@ -64,7 +64,7 @@ static void add_invite(struct Channel *, struct Client *);
* parv[1] - user to invite * parv[1] - user to invite
* parv[2] - channel name * parv[2] - channel name
*/ */
static int static void
m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -89,7 +89,7 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
sendto_one_numeric(source_p, ERR_NOSUCHNICK, sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), form_str(ERR_NOSUCHNICK),
parv[1]); parv[1]);
return 0; return;
} }
if(check_channel_name(parv[2]) == 0) if(check_channel_name(parv[2]) == 0)
@ -97,7 +97,7 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
sendto_one_numeric(source_p, ERR_BADCHANNAME, sendto_one_numeric(source_p, ERR_BADCHANNAME,
form_str(ERR_BADCHANNAME), form_str(ERR_BADCHANNAME),
parv[2]); parv[2]);
return 0; return;
} }
/* Do not send local channel invites to users if they are not on the /* Do not send local channel invites to users if they are not on the
@ -107,7 +107,7 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one(source_p, form_str(ERR_USERNOTONSERV), sendto_one(source_p, form_str(ERR_USERNOTONSERV),
me.name, source_p->name, target_p->name); me.name, source_p->name, target_p->name);
return 0; return;
} }
if(((MyConnect(source_p) && !IsExemptResv(source_p)) || if(((MyConnect(source_p) && !IsExemptResv(source_p)) ||
@ -117,14 +117,14 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
sendto_one_numeric(source_p, ERR_BADCHANNAME, sendto_one_numeric(source_p, ERR_BADCHANNAME,
form_str(ERR_BADCHANNAME), form_str(ERR_BADCHANNAME),
parv[2]); parv[2]);
return 0; return;
} }
if((chptr = find_channel(parv[2])) == NULL) if((chptr = find_channel(parv[2])) == NULL)
{ {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[2]); form_str(ERR_NOSUCHCHANNEL), parv[2]);
return 0; return;
} }
msptr = find_channel_membership(chptr, source_p); msptr = find_channel_membership(chptr, source_p);
@ -132,7 +132,7 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one_numeric(source_p, ERR_NOTONCHANNEL, sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), parv[2]); form_str(ERR_NOTONCHANNEL), parv[2]);
return 0; return;
} }
if(IsMember(target_p, chptr)) if(IsMember(target_p, chptr))
@ -140,7 +140,7 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
sendto_one_numeric(source_p, ERR_USERONCHANNEL, sendto_one_numeric(source_p, ERR_USERONCHANNEL,
form_str(ERR_USERONCHANNEL), form_str(ERR_USERONCHANNEL),
target_p->name, parv[2]); target_p->name, parv[2]);
return 0; return;
} }
/* unconditionally require ops, unless the channel is +g */ /* unconditionally require ops, unless the channel is +g */
@ -150,7 +150,7 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, parv[2]); me.name, source_p->name, parv[2]);
return 0; return;
} }
/* store invites when they could affect the ability to join /* store invites when they could affect the ability to join
@ -169,7 +169,7 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one(source_p, form_str(ERR_TARGCHANGE), sendto_one(source_p, form_str(ERR_TARGCHANGE),
me.name, source_p->name, target_p->name); me.name, source_p->name, target_p->name);
return 0; return;
} }
sendto_one(source_p, form_str(RPL_INVITING), sendto_one(source_p, form_str(RPL_INVITING),
me.name, source_p->name, me.name, source_p->name,
@ -183,7 +183,7 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
/* this should never be less than */ /* this should never be less than */
if(atol(parv[3]) > chptr->channelts) if(atol(parv[3]) > chptr->channelts)
return 0; return;
} }
if(MyConnect(target_p)) if(MyConnect(target_p))
@ -197,7 +197,7 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
sendto_one_numeric(source_p, ERR_NONONREG, sendto_one_numeric(source_p, ERR_NONONREG,
form_str(ERR_NONONREG), form_str(ERR_NONONREG),
target_p->name); target_p->name);
return 0; return;
} }
else else
{ {
@ -210,7 +210,7 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
sendto_one_numeric(source_p, ERR_TARGUMODEG, sendto_one_numeric(source_p, ERR_TARGUMODEG,
form_str(ERR_TARGUMODEG), form_str(ERR_TARGUMODEG),
target_p->name); target_p->name);
return 0; return;
} }
target_p->localClient->last_caller_id_time = rb_current_time(); target_p->localClient->last_caller_id_time = rb_current_time();
} }
@ -236,8 +236,6 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
sendto_server(source_p, chptr, CAP_TS6, 0, ":%s INVITE %s %s %lu", sendto_server(source_p, chptr, CAP_TS6, 0, ":%s INVITE %s %s %lu",
use_id(source_p), use_id(target_p), use_id(source_p), use_id(target_p),
chptr->chname, (unsigned long) chptr->channelts); chptr->chname, (unsigned long) chptr->channelts);
return 0;
} }
/* add_invite() /* add_invite()

View file

@ -39,7 +39,7 @@
static const char ison_desc[] = "Provides the ISON command to check if a set of users is online"; static const char ison_desc[] = "Provides the ISON command to check if a set of users is online";
static int m_ison(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_ison(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message ison_msgtab = { struct Message ison_msgtab = {
"ISON", 0, 0, 0, 0, "ISON", 0, 0, 0, 0,
@ -63,7 +63,7 @@ static char buf2[BUFSIZE];
* format: * format:
* ISON :nicklist * ISON :nicklist
*/ */
static int static void
m_ison(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_ison(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -81,7 +81,7 @@ m_ison(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
len = strlen(buf); len = strlen(buf);
current_insert_point = buf + len; current_insert_point = buf + len;
/* rfc1489 is ambigious about how to handle ISON /* rfc1459 is ambigious about how to handle ISON
* this should handle both interpretations. * this should handle both interpretations.
*/ */
for (i = 1; i < parc; i++) for (i = 1; i < parc; i++)
@ -120,6 +120,4 @@ m_ison(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
*current_insert_point2 = '\0'; *current_insert_point2 = '\0';
sendto_one(source_p, "%s", buf); sendto_one(source_p, "%s", buf);
return 0;
} }

View file

@ -46,12 +46,12 @@
static const char kline_desc[] = "Provides the KLINE facility to ban users via hostmask"; static const char kline_desc[] = "Provides the KLINE facility to ban users via hostmask";
static int mo_kline(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_kline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_kline(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_kline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_kline(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_kline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_unkline(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_unkline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_unkline(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_unkline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_unkline(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_unkline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message kline_msgtab = { struct Message kline_msgtab = {
"KLINE", 0, 0, 0, 0, "KLINE", 0, 0, 0, 0,
@ -68,8 +68,8 @@ mapi_clist_av1 kline_clist[] = { &kline_msgtab, &unkline_msgtab, NULL };
DECLARE_MODULE_AV2(kline, NULL, NULL, kline_clist, NULL, NULL, NULL, NULL, kline_desc); DECLARE_MODULE_AV2(kline, NULL, NULL, kline_clist, NULL, NULL, NULL, NULL, kline_desc);
/* Local function prototypes */ /* Local function prototypes */
static int find_user_host(struct Client *source_p, const char *userhost, char *user, char *host); static bool find_user_host(struct Client *source_p, const char *userhost, char *user, char *host);
static int valid_user_host(struct Client *source_p, const char *user, const char *host); static bool valid_user_host(struct Client *source_p, const char *user, const char *host);
static void handle_remote_kline(struct Client *source_p, int tkline_time, static void handle_remote_kline(struct Client *source_p, int tkline_time,
const char *user, const char *host, const char *reason); const char *user, const char *host, const char *reason);
@ -79,11 +79,11 @@ static void apply_tkline(struct Client *source_p, struct ConfItem *aconf,
const char *, const char *, int); const char *, const char *, int);
static void apply_prop_kline(struct Client *source_p, struct ConfItem *aconf, static void apply_prop_kline(struct Client *source_p, struct ConfItem *aconf,
const char *, const char *, int); const char *, const char *, int);
static int already_placed_kline(struct Client *, const char *, const char *, int); static bool already_placed_kline(struct Client *, const char *, const char *, int);
static void handle_remote_unkline(struct Client *source_p, const char *user, const char *host); static void handle_remote_unkline(struct Client *source_p, const char *user, const char *host);
static void remove_permkline_match(struct Client *, struct ConfItem *); static void remove_permkline_match(struct Client *, struct ConfItem *);
static int remove_temp_kline(struct Client *, struct ConfItem *); static bool remove_temp_kline(struct Client *, struct ConfItem *);
static void remove_prop_kline(struct Client *, struct ConfItem *); static void remove_prop_kline(struct Client *, struct ConfItem *);
/* mo_kline() /* mo_kline()
@ -94,7 +94,7 @@ static void remove_prop_kline(struct Client *, struct ConfItem *);
* parv[4] - server to target, or reason * parv[4] - server to target, or reason
* parv[5] - reason * parv[5] - reason
*/ */
static int static void
mo_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv) mo_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{ {
char def[] = "No Reason"; char def[] = "No Reason";
@ -111,7 +111,7 @@ mo_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(!IsOperK(source_p)) if(!IsOperK(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "kline"); sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "kline");
return 0; return;
} }
if((tkline_time = valid_temp_time(parv[loc])) >= 0) if((tkline_time = valid_temp_time(parv[loc])) >= 0)
@ -121,7 +121,7 @@ mo_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
tkline_time = 0; tkline_time = 0;
if(find_user_host(source_p, parv[loc], user, host) == 0) if(find_user_host(source_p, parv[loc], user, host) == 0)
return 0; return;
loc++; loc++;
@ -131,7 +131,7 @@ mo_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "remoteban"); me.name, source_p->name, "remoteban");
return 0; return;
} }
target_server = parv[loc + 1]; target_server = parv[loc + 1];
@ -142,7 +142,7 @@ mo_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
me.name, source_p->name, "KLINE"); me.name, source_p->name, "KLINE");
return 0; return;
} }
reason = LOCAL_COPY(parv[loc]); reason = LOCAL_COPY(parv[loc]);
@ -154,7 +154,7 @@ mo_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
/* If we are sending it somewhere that doesnt include us, stop */ /* If we are sending it somewhere that doesnt include us, stop */
if(!match(target_server, me.name)) if(!match(target_server, me.name))
return 0; return;
/* Set as local-only. */ /* Set as local-only. */
propagated = 0; propagated = 0;
@ -166,7 +166,7 @@ mo_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
"%lu %s %s :%s", tkline_time, user, host, reason); "%lu %s %s :%s", tkline_time, user, host, reason);
if(!valid_user_host(source_p, user, host)) if(!valid_user_host(source_p, user, host))
return 0; return;
if(!valid_wild_card(user, host)) if(!valid_wild_card(user, host))
{ {
@ -174,17 +174,17 @@ mo_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
":Please include at least %d non-wildcard " ":Please include at least %d non-wildcard "
"characters with the user@host", "characters with the user@host",
ConfigFileEntry.min_nonwildcard); ConfigFileEntry.min_nonwildcard);
return 0; return;
} }
if(propagated && tkline_time == 0) if(propagated && tkline_time == 0)
{ {
sendto_one_notice(source_p, ":Cannot set a permanent global ban"); sendto_one_notice(source_p, ":Cannot set a permanent global ban");
return 0; return;
} }
if(already_placed_kline(source_p, user, host, tkline_time)) if(already_placed_kline(source_p, user, host, tkline_time))
return 0; return;
rb_set_time(); rb_set_time();
aconf = make_conf(); aconf = make_conf();
@ -227,8 +227,6 @@ mo_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
} }
else else
check_klines(); check_klines();
return 0;
} }
/* ms_kline() /* ms_kline()
@ -239,7 +237,7 @@ mo_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
* parv[4] - host * parv[4] - host
* parv[5] - reason * parv[5] - reason
*/ */
static int static void
ms_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
int tkline_time = atoi(parv[2]); int tkline_time = atoi(parv[2]);
@ -249,30 +247,28 @@ ms_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
* but its not worth dropping the link over.. --anfl * but its not worth dropping the link over.. --anfl
*/ */
if(parc < 6 || EmptyString(parv[5])) if(parc < 6 || EmptyString(parv[5]))
return 0; return;
propagate_generic(source_p, "KLINE", parv[1], CAP_KLN, propagate_generic(source_p, "KLINE", parv[1], CAP_KLN,
"%d %s %s :%s", tkline_time, parv[3], parv[4], parv[5]); "%d %s %s :%s", tkline_time, parv[3], parv[4], parv[5]);
if(!match(parv[1], me.name)) if(!match(parv[1], me.name))
return 0; return;
if(!IsPerson(source_p)) if(!IsPerson(source_p))
return 0; return;
handle_remote_kline(source_p, tkline_time, parv[3], parv[4], parv[5]); handle_remote_kline(source_p, tkline_time, parv[3], parv[4], parv[5]);
return 0;
} }
static int static void
me_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) me_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
/* <tkline_time> <user> <host> :<reason> */ /* <tkline_time> <user> <host> :<reason> */
if(!IsPerson(source_p)) if(!IsPerson(source_p))
return 0; return;
handle_remote_kline(source_p, atoi(parv[1]), parv[2], parv[3], parv[4]); handle_remote_kline(source_p, atoi(parv[1]), parv[2], parv[3], parv[4]);
return 0;
} }
static void static void
@ -341,8 +337,6 @@ handle_remote_kline(struct Client *source_p, int tkline_time,
} }
else else
check_klines(); check_klines();
return;
} }
/* mo_unkline() /* mo_unkline()
@ -351,7 +345,7 @@ handle_remote_kline(struct Client *source_p, int tkline_time,
* parv[2] - optional "ON" * parv[2] - optional "ON"
* parv[3] - optional target server * parv[3] - optional target server
*/ */
static int static void
mo_unkline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_unkline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
const char *user; const char *user;
@ -364,7 +358,7 @@ mo_unkline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
if(!IsOperUnkline(source_p)) if(!IsOperUnkline(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "unkline"); sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "unkline");
return 0; return;
} }
if((host = strchr(h, '@')) || *h == '*' || strchr(h, '.') || strchr(h, ':')) if((host = strchr(h, '@')) || *h == '*' || strchr(h, '.') || strchr(h, ':'))
@ -394,7 +388,7 @@ mo_unkline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
else else
{ {
sendto_one_notice(source_p, ":Invalid parameters"); sendto_one_notice(source_p, ":Invalid parameters");
return 0; return;
} }
/* possible remote kline.. */ /* possible remote kline.. */
@ -404,13 +398,13 @@ mo_unkline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "remoteban"); me.name, source_p->name, "remoteban");
return 0; return;
} }
propagate_generic(source_p, "UNKLINE", parv[3], CAP_UNKLN, "%s %s", user, host); propagate_generic(source_p, "UNKLINE", parv[3], CAP_UNKLN, "%s %s", user, host);
if(match(parv[3], me.name) == 0) if(match(parv[3], me.name) == 0)
return 0; return;
propagated = 0; propagated = 0;
} }
@ -426,7 +420,7 @@ mo_unkline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
if(aconf == NULL) if(aconf == NULL)
{ {
sendto_one_notice(source_p, ":No K-Line for %s@%s", user, host); sendto_one_notice(source_p, ":No K-Line for %s@%s", user, host);
return 0; return;
} }
if(aconf->lifetime) if(aconf->lifetime)
@ -435,15 +429,13 @@ mo_unkline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
remove_prop_kline(source_p, aconf); remove_prop_kline(source_p, aconf);
else else
sendto_one_notice(source_p, ":Cannot remove global K-Line %s@%s on specific servers", user, host); sendto_one_notice(source_p, ":Cannot remove global K-Line %s@%s on specific servers", user, host);
return 0; return;
} }
if(remove_temp_kline(source_p, aconf)) if(remove_temp_kline(source_p, aconf))
return 0; return;
remove_permkline_match(source_p, aconf); remove_permkline_match(source_p, aconf);
return 0;
} }
/* ms_unkline() /* ms_unkline()
@ -452,7 +444,7 @@ mo_unkline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
* parv[2] - user to unkline * parv[2] - user to unkline
* parv[3] - host to unkline * parv[3] - host to unkline
*/ */
static int static void
ms_unkline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_unkline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
/* parv[0] parv[1] parv[2] parv[3] /* parv[0] parv[1] parv[2] parv[3]
@ -460,24 +452,22 @@ ms_unkline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
propagate_generic(source_p, "UNKLINE", parv[1], CAP_UNKLN, "%s %s", parv[2], parv[3]); propagate_generic(source_p, "UNKLINE", parv[1], CAP_UNKLN, "%s %s", parv[2], parv[3]);
if(!match(parv[1], me.name)) if(!match(parv[1], me.name))
return 0; return;
if(!IsPerson(source_p)) if(!IsPerson(source_p))
return 0; return;
handle_remote_unkline(source_p, parv[2], parv[3]); handle_remote_unkline(source_p, parv[2], parv[3]);
return 0;
} }
static int static void
me_unkline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) me_unkline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
/* user host */ /* user host */
if(!IsPerson(source_p)) if(!IsPerson(source_p))
return 0; return;
handle_remote_unkline(source_p, parv[1], parv[2]); handle_remote_unkline(source_p, parv[1], parv[2]);
return 0;
} }
static void static void
@ -634,10 +624,10 @@ apply_prop_kline(struct Client *source_p, struct ConfItem *aconf,
/* find_user_host() /* find_user_host()
* *
* inputs - client placing kline, user@host, user buffer, host buffer * inputs - client placing kline, user@host, user buffer, host buffer
* output - 0 if not ok to kline, 1 to kline i.e. if valid user host * output - false if not ok to kline, true to kline i.e. if valid user host
* side effects - * side effects -
*/ */
static int static bool
find_user_host(struct Client *source_p, const char *userhost, char *luser, char *lhost) find_user_host(struct Client *source_p, const char *userhost, char *luser, char *lhost)
{ {
char *hostp; char *hostp;
@ -664,7 +654,7 @@ find_user_host(struct Client *source_p, const char *userhost, char *luser, char
if(strchr(userhost, '.') == NULL && strchr(userhost, ':') == NULL) if(strchr(userhost, '.') == NULL && strchr(userhost, ':') == NULL)
{ {
sendto_one_notice(source_p, ":K-Line must be a user@host or host"); sendto_one_notice(source_p, ":K-Line must be a user@host or host");
return 0; return false;
} }
luser[0] = '*'; /* no @ found, assume its *@somehost */ luser[0] = '*'; /* no @ found, assume its *@somehost */
@ -676,43 +666,43 @@ find_user_host(struct Client *source_p, const char *userhost, char *luser, char
if (*luser == ':' || *lhost == ':') if (*luser == ':' || *lhost == ':')
{ {
sendto_one_notice(source_p, ":Invalid K-Line"); sendto_one_notice(source_p, ":Invalid K-Line");
return 0; return false;
} }
return 1; return true;
} }
/* valid_user_host() /* valid_user_host()
* *
* inputs - user buffer, host buffer * inputs - user buffer, host buffer
* output - 0 if invalid, 1 if valid * output - false if invalid, true if valid
* side effects - * side effects -
*/ */
static int static bool
valid_user_host(struct Client *source_p, const char *luser, const char *lhost) valid_user_host(struct Client *source_p, const char *luser, const char *lhost)
{ {
/* # is invalid, as are '!' (n!u@h kline) and '@' (u@@h kline) */ /* # is invalid, as are '!' (n!u@h kline) and '@' (u@@h kline) */
if(strchr(lhost, '#') || strchr(luser, '#') || strchr(luser, '!') || strchr(lhost, '@')) if(strchr(lhost, '#') || strchr(luser, '#') || strchr(luser, '!') || strchr(lhost, '@'))
{ {
sendto_one_notice(source_p, ":Invalid K-Line"); sendto_one_notice(source_p, ":Invalid K-Line");
return 0; return false;
} }
return 1; return true;
} }
/* already_placed_kline() /* already_placed_kline()
* *
* inputs - source to notify, user@host to check, tkline time * inputs - source to notify, user@host to check, tkline time
* outputs - 1 if a perm kline or a tkline when a tkline is being * outputs - true if a perm kline or a tkline when a tkline is being
* set exists, else 0 * set exists, else false
* side effects - notifies source_p kline exists * side effects - notifies source_p kline exists
*/ */
/* Note: This currently works if the new K-line is a special case of an /* Note: This currently works if the new K-line is a special case of an
* existing K-line, but not the other way round. To do that we would * existing K-line, but not the other way round. To do that we would
* have to walk the hash and check every existing K-line. -A1kmm. * have to walk the hash and check every existing K-line. -A1kmm.
*/ */
static int static bool
already_placed_kline(struct Client *source_p, const char *luser, const char *lhost, int tkline) already_placed_kline(struct Client *source_p, const char *luser, const char *lhost, int tkline)
{ {
const char *reason, *p; const char *reason, *p;
@ -762,11 +752,11 @@ already_placed_kline(struct Client *source_p, const char *luser, const char *lho
sendto_one_notice(source_p, sendto_one_notice(source_p,
":[%s@%s] already K-Lined by [%s@%s] - %s", ":[%s@%s] already K-Lined by [%s@%s] - %s",
luser, lhost, aconf->user, aconf->host, reason); luser, lhost, aconf->user, aconf->host, reason);
return 1; return true;
} }
} }
return 0; return false;
} }
/* remove_permkline_match() /* remove_permkline_match()
@ -787,8 +777,6 @@ remove_permkline_match(struct Client *source_p, struct ConfItem *aconf)
remove_reject_mask(aconf->user, aconf->host); remove_reject_mask(aconf->user, aconf->host);
bandb_del(BANDB_KLINE, aconf->user, aconf->host); bandb_del(BANDB_KLINE, aconf->user, aconf->host);
delete_one_address_conf(aconf->host, aconf); delete_one_address_conf(aconf->host, aconf);
return;
} }
/* remove_temp_kline() /* remove_temp_kline()
@ -797,7 +785,7 @@ remove_permkline_match(struct Client *source_p, struct ConfItem *aconf)
* outputs - * outputs -
* side effects - tries to unkline anything that matches * side effects - tries to unkline anything that matches
*/ */
static int static bool
remove_temp_kline(struct Client *source_p, struct ConfItem *aconf) remove_temp_kline(struct Client *source_p, struct ConfItem *aconf)
{ {
rb_dlink_node *ptr; rb_dlink_node *ptr;
@ -822,12 +810,12 @@ remove_temp_kline(struct Client *source_p, struct ConfItem *aconf)
rb_dlinkDestroy(ptr, &temp_klines[i]); rb_dlinkDestroy(ptr, &temp_klines[i]);
remove_reject_mask(aconf->user, aconf->host); remove_reject_mask(aconf->user, aconf->host);
delete_one_address_conf(aconf->host, aconf); delete_one_address_conf(aconf->host, aconf);
return YES; return true;
} }
} }
} }
return NO; return false;
} }
static void static void

View file

@ -38,7 +38,7 @@
static const char knock_desc[] = "Provides the KNOCK command to ask for an invite to an invite-only channel"; static const char knock_desc[] = "Provides the KNOCK command to ask for an invite to an invite-only channel";
static int m_knock(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_knock(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message knock_msgtab = { struct Message knock_msgtab = {
"KNOCK", 0, 0, 0, 0, "KNOCK", 0, 0, 0, 0,
@ -75,7 +75,7 @@ DECLARE_MODULE_AV2(knock, _modinit, _moddeinit, knock_clist, NULL, NULL, NULL, N
* of these conditions. Concept by Dianora <db@db.net> and written by * of these conditions. Concept by Dianora <db@db.net> and written by
* <anonymous> * <anonymous>
*/ */
static int static void
m_knock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_knock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Channel *chptr; struct Channel *chptr;
@ -85,7 +85,7 @@ m_knock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one(source_p, form_str(ERR_KNOCKDISABLED), sendto_one(source_p, form_str(ERR_KNOCKDISABLED),
me.name, source_p->name); me.name, source_p->name);
return 0; return;
} }
name = LOCAL_COPY(parv[1]); name = LOCAL_COPY(parv[1]);
@ -98,7 +98,7 @@ m_knock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), name); form_str(ERR_NOSUCHCHANNEL), name);
return 0; return;
} }
if(IsMember(source_p, chptr)) if(IsMember(source_p, chptr))
@ -106,7 +106,7 @@ m_knock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if(MyClient(source_p)) if(MyClient(source_p))
sendto_one(source_p, form_str(ERR_KNOCKONCHAN), sendto_one(source_p, form_str(ERR_KNOCKONCHAN),
me.name, source_p->name, name); me.name, source_p->name, name);
return 0; return;
} }
if(!((chptr->mode.mode & MODE_INVITEONLY) || (*chptr->mode.key) || if(!((chptr->mode.mode & MODE_INVITEONLY) || (*chptr->mode.key) ||
@ -115,7 +115,7 @@ m_knock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one_numeric(source_p, ERR_CHANOPEN, sendto_one_numeric(source_p, ERR_CHANOPEN,
form_str(ERR_CHANOPEN), name); form_str(ERR_CHANOPEN), name);
return 0; return;
} }
/* cant knock to a +p channel */ /* cant knock to a +p channel */
@ -123,7 +123,7 @@ m_knock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN, sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN,
form_str(ERR_CANNOTSENDTOCHAN), name); form_str(ERR_CANNOTSENDTOCHAN), name);
return 0; return;
} }
@ -135,7 +135,7 @@ m_knock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN, sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN,
form_str(ERR_CANNOTSENDTOCHAN), name); form_str(ERR_CANNOTSENDTOCHAN), name);
return 0; return;
} }
/* local flood protection: /* local flood protection:
@ -147,13 +147,13 @@ m_knock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one(source_p, form_str(ERR_TOOMANYKNOCK), sendto_one(source_p, form_str(ERR_TOOMANYKNOCK),
me.name, source_p->name, name, "user"); me.name, source_p->name, name, "user");
return 0; return;
} }
else if((chptr->last_knock + ConfigChannel.knock_delay_channel) > rb_current_time()) else if((chptr->last_knock + ConfigChannel.knock_delay_channel) > rb_current_time())
{ {
sendto_one(source_p, form_str(ERR_TOOMANYKNOCK), sendto_one(source_p, form_str(ERR_TOOMANYKNOCK),
me.name, source_p->name, name, "channel"); me.name, source_p->name, name, "channel");
return 0; return;
} }
/* ok, we actually can send the knock, tell client */ /* ok, we actually can send the knock, tell client */
@ -175,6 +175,5 @@ m_knock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
":%s KNOCK %s", use_id(source_p), name); ":%s KNOCK %s", use_id(source_p), name);
sendto_server(client_p, chptr, CAP_KNOCK, CAP_TS6, sendto_server(client_p, chptr, CAP_KNOCK, CAP_TS6,
":%s KNOCK %s", source_p->name, name); ":%s KNOCK %s", source_p->name, name);
return 0;
} }

View file

@ -40,8 +40,8 @@
static const char links_desc[] = static const char links_desc[] =
"Provides the LINKS command to view servers linked to the host server"; "Provides the LINKS command to view servers linked to the host server";
static int m_links(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_links(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_links(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_links(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static char * clean_string(char *dest, const unsigned char *src, size_t len); static char * clean_string(char *dest, const unsigned char *src, size_t len);
struct Message links_msgtab = { struct Message links_msgtab = {
@ -66,18 +66,16 @@ DECLARE_MODULE_AV2(links, NULL, NULL, links_clist, links_hlist, NULL, NULL, NULL
* parv[1] = server to query * parv[1] = server to query
* parv[2] = servername mask * parv[2] = servername mask
*/ */
static int static void
m_links(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_links(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(ConfigServerHide.flatten_links && !IsExemptShide(source_p)) if(ConfigServerHide.flatten_links && !IsExemptShide(source_p))
scache_send_flattened_links(source_p); scache_send_flattened_links(source_p);
else else
mo_links(msgbuf_p, client_p, source_p, parc, parv); mo_links(msgbuf_p, client_p, source_p, parc, parv);
return 0;
} }
static int static void
mo_links(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_links(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
const char *mask = ""; const char *mask = "";
@ -90,10 +88,10 @@ mo_links(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(parc > 2) if(parc > 2)
{ {
if(strlen(parv[2]) > HOSTLEN) if(strlen(parv[2]) > HOSTLEN)
return 0; return;
if(hunt_server(client_p, source_p, ":%s LINKS %s :%s", 1, parc, parv) if(hunt_server(client_p, source_p, ":%s LINKS %s :%s", 1, parc, parv)
!= HUNTED_ISME) != HUNTED_ISME)
return 0; return;
mask = parv[2]; mask = parv[2];
} }
@ -128,8 +126,6 @@ mo_links(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
sendto_one_numeric(source_p, RPL_ENDOFLINKS, form_str(RPL_ENDOFLINKS), sendto_one_numeric(source_p, RPL_ENDOFLINKS, form_str(RPL_ENDOFLINKS),
EmptyString(mask) ? "*" : mask); EmptyString(mask) ? "*" : mask);
return 0;
} }
static char * static char *

View file

@ -55,11 +55,13 @@ static const char list_desc[] = "Provides the LIST command to clients to view no
static rb_dlink_list safelisting_clients = { NULL, NULL, 0 }; static rb_dlink_list safelisting_clients = { NULL, NULL, 0 };
static struct ev_entry *iterate_clients_ev = NULL;
static int _modinit(void); static int _modinit(void);
static void _moddeinit(void); static void _moddeinit(void);
static int m_list(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_list(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_list(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_list(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void list_one_channel(struct Client *source_p, struct Channel *chptr, int visible); static void list_one_channel(struct Client *source_p, struct Channel *chptr, int visible);
@ -85,8 +87,6 @@ mapi_hfn_list_av1 list_hfnlist[] = {
DECLARE_MODULE_AV2(list, _modinit, _moddeinit, list_clist, NULL, list_hfnlist, NULL, NULL, list_desc); DECLARE_MODULE_AV2(list, _modinit, _moddeinit, list_clist, NULL, list_hfnlist, NULL, NULL, list_desc);
static struct ev_entry *iterate_clients_ev = NULL;
static int _modinit(void) static int _modinit(void)
{ {
iterate_clients_ev = rb_event_add("safelist_iterate_clients", safelist_iterate_clients, NULL, 3); iterate_clients_ev = rb_event_add("safelist_iterate_clients", safelist_iterate_clients, NULL, 3);
@ -130,7 +130,8 @@ static void safelist_check_cliexit(hook_data_client_exit * hdata)
* XXX - With SAFELIST, do we really need to continue pacing? * XXX - With SAFELIST, do we really need to continue pacing?
* In theory, the server cannot be lagged by this. --nenolod * In theory, the server cannot be lagged by this. --nenolod
*/ */
static int m_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) static void
m_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
static time_t last_used = 0L; static time_t last_used = 0L;
@ -138,7 +139,7 @@ static int m_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Clien
{ {
sendto_one_notice(source_p, ":/LIST aborted"); sendto_one_notice(source_p, ":/LIST aborted");
safelist_client_release(source_p); safelist_client_release(source_p);
return 0; return;
} }
if (parc < 2 || !IsChannelName(parv[1])) if (parc < 2 || !IsChannelName(parv[1]))
@ -148,19 +149,20 @@ static int m_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Clien
{ {
sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "LIST"); sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "LIST");
sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name); sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);
return 0; return;
} }
else else
last_used = rb_current_time(); last_used = rb_current_time();
} }
return mo_list(msgbuf_p, client_p, source_p, parc, parv); mo_list(msgbuf_p, client_p, source_p, parc, parv);
} }
/* mo_list() /* mo_list()
* parv[1] = channel * parv[1] = channel
*/ */
static int mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) static void
mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct ListClient *params; struct ListClient *params;
char *p; char *p;
@ -172,7 +174,7 @@ static int mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Clie
{ {
sendto_one_notice(source_p, ":/LIST aborted"); sendto_one_notice(source_p, ":/LIST aborted");
safelist_client_release(source_p); safelist_client_release(source_p);
return 0; return;
} }
if (parc > 1) if (parc > 1)
@ -191,7 +193,7 @@ static int mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Clie
if (args && IsChannelName(args)) if (args && IsChannelName(args))
{ {
safelist_channel_named(source_p, args, operspy); safelist_channel_named(source_p, args, operspy);
return 0; return;
} }
/* Multiple channels, possibly with parameters. */ /* Multiple channels, possibly with parameters. */
@ -286,8 +288,6 @@ static int mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Clie
} }
safelist_client_instantiate(source_p, params); safelist_client_instantiate(source_p, params);
return 0;
} }
/* /*
@ -317,19 +317,16 @@ static void list_one_channel(struct Client *source_p, struct Channel *chptr,
* safelist_sendq_exceeded() * safelist_sendq_exceeded()
* *
* inputs - pointer to client that needs checking * inputs - pointer to client that needs checking
* outputs - 1 if a client has exceeded the reserved * outputs - true if a client has exceeded the reserved
* sendq limit, 0 if not * sendq limit, false if not
* side effects - none * side effects - none
* *
* When safelisting, we only use half of the SendQ at any * When safelisting, we only use half of the SendQ at any
* given time. * given time.
*/ */
static int safelist_sendq_exceeded(struct Client *client_p) static bool safelist_sendq_exceeded(struct Client *client_p)
{ {
if (rb_linebuf_len(&client_p->localClient->buf_sendq) > (get_sendq(client_p) / 2)) return rb_linebuf_len(&client_p->localClient->buf_sendq) > (get_sendq(client_p) / 2);
return YES;
else
return NO;
} }
/* /*
@ -367,12 +364,12 @@ static void safelist_client_instantiate(struct Client *client_p, struct ListClie
* outputs - none * outputs - none
* side effects - the client is no longer being * side effects - the client is no longer being
* listed * listed
*
* Please do not ever call this on a non-local client.
* If you do, you will get SIGSEGV.
*/ */
static void safelist_client_release(struct Client *client_p) static void safelist_client_release(struct Client *client_p)
{ {
if(!MyClient(client_p))
return;
s_assert(MyClient(client_p)); s_assert(MyClient(client_p));
rb_dlinkFindDestroy(client_p, &safelisting_clients); rb_dlinkFindDestroy(client_p, &safelisting_clients);
@ -478,7 +475,7 @@ static void safelist_iterate_client(struct Client *source_p)
RB_RADIXTREE_FOREACH_FROM(chptr, &iter, channel_tree, source_p->localClient->safelist_data->chname) RB_RADIXTREE_FOREACH_FROM(chptr, &iter, channel_tree, source_p->localClient->safelist_data->chname)
{ {
if (safelist_sendq_exceeded(source_p->from) == YES) if (safelist_sendq_exceeded(source_p->from))
{ {
rb_free(source_p->localClient->safelist_data->chname); rb_free(source_p->localClient->safelist_data->chname);
source_p->localClient->safelist_data->chname = rb_strdup(chptr->chname); source_p->localClient->safelist_data->chname = rb_strdup(chptr->chname);

View file

@ -40,9 +40,9 @@
static const char locops_desc[] = static const char locops_desc[] =
"Provides the LOCOPS command to send a message to all local operators"; "Provides the LOCOPS command to send a message to all local operators";
static int m_locops(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_locops(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_locops(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_locops(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_locops(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_locops(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message locops_msgtab = { struct Message locops_msgtab = {
"LOCOPS", 0, 0, 0, 0, "LOCOPS", 0, 0, 0, 0,
@ -58,7 +58,7 @@ DECLARE_MODULE_AV2(locops, NULL, NULL, locops_clist, NULL, NULL, NULL, NULL, loc
* (write to *all* local opers currently online) * (write to *all* local opers currently online)
* parv[1] = message text * parv[1] = message text
*/ */
static int static void
m_locops(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_locops(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
sendto_wallops_flags(UMODE_LOCOPS, source_p, "LOCOPS - %s", parv[1]); sendto_wallops_flags(UMODE_LOCOPS, source_p, "LOCOPS - %s", parv[1]);
@ -66,11 +66,9 @@ m_locops(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(rb_dlink_list_length(&cluster_conf_list) > 0) if(rb_dlink_list_length(&cluster_conf_list) > 0)
cluster_generic(source_p, "LOCOPS", SHARED_LOCOPS, CAP_CLUSTER, cluster_generic(source_p, "LOCOPS", SHARED_LOCOPS, CAP_CLUSTER,
":%s", parv[1]); ":%s", parv[1]);
return 0;
} }
static int static void
ms_locops(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_locops(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
/* source_p parv[1] parv[2] /* source_p parv[1] parv[2]
@ -80,24 +78,20 @@ ms_locops(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
":%s", parv[2]); ":%s", parv[2]);
if(!match(parv[1], me.name)) if(!match(parv[1], me.name))
return 0; return;
if(find_shared_conf("*", "*", source_p->servptr->name, SHARED_LOCOPS)) if(find_shared_conf("*", "*", source_p->servptr->name, SHARED_LOCOPS))
sendto_wallops_flags(UMODE_LOCOPS, source_p, "SLOCOPS - %s", parv[2]); sendto_wallops_flags(UMODE_LOCOPS, source_p, "SLOCOPS - %s", parv[2]);
return 0;
} }
static int static void
me_locops(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, me_locops(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]) int parc, const char *parv[])
{ {
if(!IsPerson(source_p)) if(!IsPerson(source_p))
return 0; return;
if(find_shared_conf("*", "*", source_p->servptr->name, SHARED_LOCOPS)) if(find_shared_conf("*", "*", source_p->servptr->name, SHARED_LOCOPS))
sendto_wallops_flags(UMODE_LOCOPS, source_p, "SLOCOPS - %s", parv[1]); sendto_wallops_flags(UMODE_LOCOPS, source_p, "SLOCOPS - %s", parv[1]);
return 0;
} }

View file

@ -37,8 +37,8 @@
static const char lusers_desc[] = static const char lusers_desc[] =
"Provides the LUSERS command to view the number of current and maximum lusers on a server"; "Provides the LUSERS command to view the number of current and maximum lusers on a server";
static int m_lusers(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_lusers(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_lusers(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_lusers(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message lusers_msgtab = { struct Message lusers_msgtab = {
"LUSERS", 0, 0, 0, 0, "LUSERS", 0, 0, 0, 0,
@ -57,7 +57,7 @@ DECLARE_MODULE_AV2(lusers, NULL, NULL, lusers_clist, NULL, NULL, NULL, NULL, lus
* 19970918 JRL hacked to ignore parv[1] completely and require parc > 3 * 19970918 JRL hacked to ignore parv[1] completely and require parc > 3
* to cause a force * to cause a force
*/ */
static int static void
m_lusers(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_lusers(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
static time_t last_used = 0; static time_t last_used = 0;
@ -69,19 +69,17 @@ m_lusers(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
/* safe enough to give this on a local connect only */ /* safe enough to give this on a local connect only */
sendto_one(source_p, form_str(RPL_LOAD2HI), sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "LUSERS"); me.name, source_p->name, "LUSERS");
return 0; return;
} }
else else
last_used = rb_current_time(); last_used = rb_current_time();
if(hunt_server(client_p, source_p, ":%s LUSERS %s :%s", 2, parc, parv) != if(hunt_server(client_p, source_p, ":%s LUSERS %s :%s", 2, parc, parv) !=
HUNTED_ISME) HUNTED_ISME)
return 0; return;
} }
show_lusers(source_p); show_lusers(source_p);
return 0;
} }
/* /*
@ -92,17 +90,15 @@ m_lusers(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
* 199970918 JRL hacked to ignore parv[1] completely and require parc > 3 * 199970918 JRL hacked to ignore parv[1] completely and require parc > 3
* to cause a force * to cause a force
*/ */
static int static void
ms_lusers(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_lusers(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(parc > 2) if(parc > 2)
{ {
if(hunt_server(client_p, source_p, ":%s LUSERS %s :%s", 2, parc, parv) if(hunt_server(client_p, source_p, ":%s LUSERS %s :%s", 2, parc, parv)
!= HUNTED_ISME) != HUNTED_ISME)
return 0; return;
} }
show_lusers(source_p); show_lusers(source_p);
return 0;
} }

View file

@ -32,8 +32,8 @@
static const char map_desc[] = "Provides the MAP command to view network topology information"; static const char map_desc[] = "Provides the MAP command to view network topology information";
static int m_map(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void m_map(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int mo_map(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void mo_map(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message map_msgtab = { struct Message map_msgtab = {
"MAP", 0, 0, 0, 0, "MAP", 0, 0, 0, 0,
@ -51,7 +51,7 @@ static char buf[BUFSIZE];
/* m_map /* m_map
*/ */
static int static void
m_map(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_map(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if((!IsExemptShide(source_p) && ConfigServerHide.flatten_links) || if((!IsExemptShide(source_p) && ConfigServerHide.flatten_links) ||
@ -59,25 +59,22 @@ m_map(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
{ {
flattened_map(client_p); flattened_map(client_p);
sendto_one_numeric(client_p, RPL_MAPEND, form_str(RPL_MAPEND)); sendto_one_numeric(client_p, RPL_MAPEND, form_str(RPL_MAPEND));
return 0; return;
} }
dump_map(client_p, &me, buf); dump_map(client_p, &me, buf);
sendto_one_numeric(client_p, RPL_MAPEND, form_str(RPL_MAPEND)); sendto_one_numeric(client_p, RPL_MAPEND, form_str(RPL_MAPEND));
return 0;
} }
/* /*
** mo_map ** mo_map
*/ */
static int static void
mo_map(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_map(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
dump_map(client_p, &me, buf); dump_map(client_p, &me, buf);
scache_send_missing(client_p); scache_send_missing(client_p);
sendto_one_numeric(client_p, RPL_MAPEND, form_str(RPL_MAPEND)); sendto_one_numeric(client_p, RPL_MAPEND, form_str(RPL_MAPEND));
return 0;
} }
/* /*

View file

@ -43,7 +43,7 @@ static const char monitor_desc[] = "Provides the MONITOR facility for tracking u
static int monitor_init(void); static int monitor_init(void);
static void monitor_deinit(void); static void monitor_deinit(void);
static int m_monitor(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_monitor(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message monitor_msgtab = { struct Message monitor_msgtab = {
"MONITOR", 0, 0, 0, 0, "MONITOR", 0, 0, 0, 0,
@ -324,7 +324,7 @@ show_monitor_status(struct Client *client_p)
sendto_one(client_p, "%s", offbuf); sendto_one(client_p, "%s", offbuf);
} }
static int static void
m_monitor(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_monitor(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
switch(parv[1][0]) switch(parv[1][0])
@ -334,7 +334,7 @@ m_monitor(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
{ {
sendto_one(client_p, form_str(ERR_NEEDMOREPARAMS), sendto_one(client_p, form_str(ERR_NEEDMOREPARAMS),
me.name, source_p->name, "MONITOR"); me.name, source_p->name, "MONITOR");
return 0; return;
} }
add_monitor(source_p, parv[2]); add_monitor(source_p, parv[2]);
@ -344,7 +344,7 @@ m_monitor(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
{ {
sendto_one(client_p, form_str(ERR_NEEDMOREPARAMS), sendto_one(client_p, form_str(ERR_NEEDMOREPARAMS),
me.name, source_p->name, "MONITOR"); me.name, source_p->name, "MONITOR");
return 0; return;
} }
del_monitor(source_p, parv[2]); del_monitor(source_p, parv[2]);
@ -368,6 +368,4 @@ m_monitor(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
default: default:
break; break;
} }
return 0;
} }

View file

@ -38,8 +38,8 @@
static const char motd_desc[] = "Provides the MOTD command to view the Message of the Day"; static const char motd_desc[] = "Provides the MOTD command to view the Message of the Day";
static int m_motd(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_motd(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_motd(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_motd(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message motd_msgtab = { struct Message motd_msgtab = {
"MOTD", 0, 0, 0, 0, "MOTD", 0, 0, 0, 0,
@ -62,7 +62,7 @@ static void motd_spy(struct Client *);
** m_motd ** m_motd
** parv[1] = servername ** parv[1] = servername
*/ */
static int static void
m_motd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_motd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
static time_t last_used = 0; static time_t last_used = 0;
@ -74,34 +74,30 @@ m_motd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
me.name, source_p->name, "MOTD"); me.name, source_p->name, "MOTD");
sendto_one(source_p, form_str(RPL_ENDOFMOTD), sendto_one(source_p, form_str(RPL_ENDOFMOTD),
me.name, source_p->name); me.name, source_p->name);
return 0; return;
} }
else else
last_used = rb_current_time(); last_used = rb_current_time();
if(hunt_server(client_p, source_p, ":%s MOTD :%s", 1, parc, parv) != HUNTED_ISME) if(hunt_server(client_p, source_p, ":%s MOTD :%s", 1, parc, parv) != HUNTED_ISME)
return 0; return;
motd_spy(source_p); motd_spy(source_p);
send_user_motd(source_p); send_user_motd(source_p);
return 0;
} }
/* /*
** mo_motd ** mo_motd
** parv[1] = servername ** parv[1] = servername
*/ */
static int static void
mo_motd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_motd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(hunt_server(client_p, source_p, ":%s MOTD :%s", 1, parc, parv) != HUNTED_ISME) if(hunt_server(client_p, source_p, ":%s MOTD :%s", 1, parc, parv) != HUNTED_ISME)
return 0; return;
motd_spy(source_p); motd_spy(source_p);
send_user_motd(source_p); send_user_motd(source_p);
return 0;
} }
/* motd_spy() /* motd_spy()

View file

@ -39,7 +39,7 @@
static const char names_desc[] = "Provides the NAMES command to view users on a channel"; static const char names_desc[] = "Provides the NAMES command to view users on a channel";
static int m_names(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_names(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message names_msgtab = { struct Message names_msgtab = {
"NAMES", 0, 0, 0, 0, "NAMES", 0, 0, 0, 0,
@ -60,7 +60,7 @@ static void names_global(struct Client *source_p);
* m_names * m_names
* parv[1] = channel * parv[1] = channel
*/ */
static int static void
m_names(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_names(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
static time_t last_used = 0; static time_t last_used = 0;
@ -78,7 +78,7 @@ m_names(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
sendto_one_numeric(source_p, ERR_BADCHANNAME, sendto_one_numeric(source_p, ERR_BADCHANNAME,
form_str(ERR_BADCHANNAME), form_str(ERR_BADCHANNAME),
(unsigned char *) p); (unsigned char *) p);
return 0; return;
} }
if((chptr = find_channel(p)) != NULL) if((chptr = find_channel(p)) != NULL)
@ -97,7 +97,7 @@ m_names(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
me.name, source_p->name, "NAMES"); me.name, source_p->name, "NAMES");
sendto_one(source_p, form_str(RPL_ENDOFNAMES), sendto_one(source_p, form_str(RPL_ENDOFNAMES),
me.name, source_p->name, "*"); me.name, source_p->name, "*");
return 0; return;
} }
else else
last_used = rb_current_time(); last_used = rb_current_time();
@ -108,7 +108,7 @@ m_names(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
me.name, source_p->name, "*"); me.name, source_p->name, "*");
} }
return 0; return;
} }
/* /*
@ -124,7 +124,7 @@ names_global(struct Client *source_p)
int mlen; int mlen;
int tlen; int tlen;
int cur_len; int cur_len;
int dont_show = NO; bool dont_show = false;
rb_dlink_node *lp, *ptr; rb_dlink_node *lp, *ptr;
struct Client *target_p; struct Client *target_p;
struct Channel *chptr = NULL; struct Channel *chptr = NULL;
@ -146,7 +146,7 @@ names_global(struct Client *source_p)
RB_DLINK_FOREACH(ptr, global_client_list.head) RB_DLINK_FOREACH(ptr, global_client_list.head)
{ {
target_p = ptr->data; target_p = ptr->data;
dont_show = NO; dont_show = false;
if(!IsPerson(target_p) || IsInvisible(target_p)) if(!IsPerson(target_p) || IsInvisible(target_p))
continue; continue;
@ -166,7 +166,7 @@ names_global(struct Client *source_p)
if(PubChannel(chptr) || IsMember(source_p, chptr) || if(PubChannel(chptr) || IsMember(source_p, chptr) ||
SecretChannel(chptr)) SecretChannel(chptr))
{ {
dont_show = YES; dont_show = true;
break; break;
} }
} }

View file

@ -41,7 +41,9 @@
static const char oper_desc[] = "Provides the OPER command to become an IRC operator"; static const char oper_desc[] = "Provides the OPER command to become an IRC operator";
static int m_oper(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_oper(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static bool match_oper_password(const char *password, struct oper_conf *oper_p);
struct Message oper_msgtab = { struct Message oper_msgtab = {
"OPER", 0, 0, 0, 0, "OPER", 0, 0, 0, 0,
@ -52,14 +54,12 @@ mapi_clist_av1 oper_clist[] = { &oper_msgtab, NULL };
DECLARE_MODULE_AV2(oper, NULL, NULL, oper_clist, NULL, NULL, NULL, NULL, oper_desc); DECLARE_MODULE_AV2(oper, NULL, NULL, oper_clist, NULL, NULL, NULL, NULL, oper_desc);
static int match_oper_password(const char *password, struct oper_conf *oper_p);
/* /*
* m_oper * m_oper
* parv[1] = oper name * parv[1] = oper name
* parv[2] = oper password * parv[2] = oper password
*/ */
static int static void
m_oper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_oper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct oper_conf *oper_p; struct oper_conf *oper_p;
@ -73,7 +73,7 @@ m_oper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
{ {
sendto_one(source_p, form_str(RPL_YOUREOPER), me.name, source_p->name); sendto_one(source_p, form_str(RPL_YOUREOPER), me.name, source_p->name);
send_oper_motd(source_p); send_oper_motd(source_p);
return 0; return;
} }
/* end the grace period */ /* end the grace period */
@ -97,7 +97,7 @@ m_oper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
source_p->name, source_p->username, source_p->host); source_p->name, source_p->username, source_p->host);
} }
return 0; return;
} }
if(IsOperConfNeedSSL(oper_p) && !IsSSLClient(source_p)) if(IsOperConfNeedSSL(oper_p) && !IsSSLClient(source_p))
@ -113,7 +113,7 @@ m_oper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
"Failed OPER attempt - missing SSL/TLS by %s (%s@%s)", "Failed OPER attempt - missing SSL/TLS by %s (%s@%s)",
source_p->name, source_p->username, source_p->host); source_p->name, source_p->username, source_p->host);
} }
return 0; return;
} }
if (oper_p->certfp != NULL) if (oper_p->certfp != NULL)
@ -131,7 +131,7 @@ m_oper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
"Failed OPER attempt - client certificate fingerprint mismatch by %s (%s@%s)", "Failed OPER attempt - client certificate fingerprint mismatch by %s (%s@%s)",
source_p->name, source_p->username, source_p->host); source_p->name, source_p->username, source_p->host);
} }
return 0; return;
} }
} }
@ -142,7 +142,7 @@ m_oper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
ilog(L_OPERED, "OPER %s by %s!%s@%s (%s)", ilog(L_OPERED, "OPER %s by %s!%s@%s (%s)",
name, source_p->name, source_p->username, source_p->host, name, source_p->name, source_p->username, source_p->host,
source_p->sockhost); source_p->sockhost);
return 0; return;
} }
else else
{ {
@ -160,8 +160,6 @@ m_oper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
source_p->name, source_p->username, source_p->host); source_p->name, source_p->username, source_p->host);
} }
} }
return 0;
} }
/* /*
@ -169,17 +167,17 @@ m_oper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
* *
* inputs - pointer to given password * inputs - pointer to given password
* - pointer to Conf * - pointer to Conf
* output - YES or NO if match * output - true if match, false otherwise
* side effects - none * side effects - none
*/ */
static int static bool
match_oper_password(const char *password, struct oper_conf *oper_p) match_oper_password(const char *password, struct oper_conf *oper_p)
{ {
const char *encr; const char *encr;
/* passwd may be NULL pointer. Head it off at the pass... */ /* passwd may be NULL pointer. Head it off at the pass... */
if(EmptyString(oper_p->passwd)) if(EmptyString(oper_p->passwd))
return NO; return false;
if(IsOperConfEncrypted(oper_p)) if(IsOperConfEncrypted(oper_p))
{ {
@ -198,7 +196,7 @@ match_oper_password(const char *password, struct oper_conf *oper_p)
encr = password; encr = password;
if(encr != NULL && strcmp(encr, oper_p->passwd) == 0) if(encr != NULL && strcmp(encr, oper_p->passwd) == 0)
return YES; return true;
else else
return NO; return false;
} }

View file

@ -45,7 +45,7 @@
static const char operspy_desc[] = static const char operspy_desc[] =
"Provides the operspy facility for viewing normally private data"; "Provides the operspy facility for viewing normally private data";
static int ms_operspy(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, static void ms_operspy(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]); int parc, const char *parv[]);
struct Message operspy_msgtab = { struct Message operspy_msgtab = {
@ -62,7 +62,7 @@ DECLARE_MODULE_AV2(operspy, NULL, NULL, operspy_clist, NULL, NULL, NULL, NULL, o
* parv[1] - operspy command * parv[1] - operspy command
* parv[2] - optional params * parv[2] - optional params
*/ */
static int static void
ms_operspy(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, ms_operspy(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]) int parc, const char *parv[])
{ {
@ -87,7 +87,7 @@ ms_operspy(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
len = strlen(parv[i]) + 1; len = strlen(parv[i]) + 1;
if((size_t)(cur_len + len) >= sizeof(buffer)) if((size_t)(cur_len + len) >= sizeof(buffer))
return 0; return;
snprintf(ptr, sizeof(buffer) - cur_len, "%s ", snprintf(ptr, sizeof(buffer) - cur_len, "%s ",
parv[i]); parv[i]);
@ -97,6 +97,4 @@ ms_operspy(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
report_operspy(source_p, parv[1], buffer); report_operspy(source_p, parv[1], buffer);
} }
return 0;
} }

View file

@ -37,7 +37,7 @@
static const char pass_desc[] = "Provides the PASS command to authenticate clients and servers"; static const char pass_desc[] = "Provides the PASS command to authenticate clients and servers";
static int mr_pass(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mr_pass(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message pass_msgtab = { struct Message pass_msgtab = {
"PASS", 0, 0, 0, 0, "PASS", 0, 0, 0, 0,
@ -57,14 +57,14 @@ DECLARE_MODULE_AV2(pass, NULL, NULL, pass_clist, NULL, NULL, NULL, NULL, pass_de
* parv[2] = "TS" if this server supports TS. * parv[2] = "TS" if this server supports TS.
* parv[3] = optional TS version field -- needed for TS6 * parv[3] = optional TS version field -- needed for TS6
*/ */
static int static void
mr_pass(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mr_pass(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
char *auth_user, *pass, *buf; char *auth_user, *pass, *buf;
buf = LOCAL_COPY(parv[1]); buf = LOCAL_COPY(parv[1]);
if(client_p->localClient->passwd || client_p->localClient->auth_user) if(client_p->localClient->passwd || client_p->localClient->auth_user)
return 0; return;
if ((pass = strchr(buf, ':')) != NULL) if ((pass = strchr(buf, ':')) != NULL)
{ {
@ -108,6 +108,4 @@ mr_pass(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
} }
} }
} }
return 0;
} }

View file

@ -38,8 +38,8 @@
static const char ping_desc[] = static const char ping_desc[] =
"Provides the PING command to ensure a client or server is still alive"; "Provides the PING command to ensure a client or server is still alive";
static int m_ping(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_ping(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_ping(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_ping(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message ping_msgtab = { struct Message ping_msgtab = {
"PING", 0, 0, 0, 0, "PING", 0, 0, 0, 0,
@ -55,7 +55,7 @@ DECLARE_MODULE_AV2(ping, NULL, NULL, ping_clist, NULL, NULL, NULL, NULL, ping_de
** parv[1] = origin ** parv[1] = origin
** parv[2] = destination ** parv[2] = destination
*/ */
static int static void
m_ping(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_ping(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -76,17 +76,15 @@ m_ping(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
sendto_one_numeric(source_p, ERR_NOSUCHSERVER, sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
form_str(ERR_NOSUCHSERVER), form_str(ERR_NOSUCHSERVER),
destination); destination);
return 0; return;
} }
} }
else else
sendto_one(source_p, ":%s PONG %s :%s", me.name, sendto_one(source_p, ":%s PONG %s :%s", me.name,
(destination) ? destination : me.name, parv[1]); (destination) ? destination : me.name, parv[1]);
return 0;
} }
static int static void
ms_ping(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_ping(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -111,6 +109,4 @@ ms_ping(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
sendto_one(source_p, ":%s PONG %s :%s", sendto_one(source_p, ":%s PONG %s :%s",
get_id(&me, source_p), me.name, get_id(&me, source_p), me.name,
get_id(source_p, source_p)); get_id(source_p, source_p));
return 0;
} }

View file

@ -40,8 +40,8 @@
static const char pong_desc[] = "Provides the PONG command to respond to a PING message"; static const char pong_desc[] = "Provides the PONG command to respond to a PING message";
static int mr_pong(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mr_pong(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_pong(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_pong(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message pong_msgtab = { struct Message pong_msgtab = {
"PONG", 0, 0, 0, 0, "PONG", 0, 0, 0, 0,
@ -52,7 +52,7 @@ mapi_clist_av1 pong_clist[] = { &pong_msgtab, NULL };
DECLARE_MODULE_AV2(pong, NULL, NULL, pong_clist, NULL, NULL, NULL, NULL, pong_desc); DECLARE_MODULE_AV2(pong, NULL, NULL, pong_clist, NULL, NULL, NULL, NULL, pong_desc);
static int static void
ms_pong(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_pong(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -79,7 +79,7 @@ ms_pong(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if(!IsDigit(*destination)) if(!IsDigit(*destination))
sendto_one_numeric(source_p, ERR_NOSUCHSERVER, sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
form_str(ERR_NOSUCHSERVER), destination); form_str(ERR_NOSUCHSERVER), destination);
return 0; return;
} }
} }
@ -95,11 +95,9 @@ ms_pong(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
eob_count++; eob_count++;
call_hook(h_server_eob, source_p); call_hook(h_server_eob, source_p);
} }
return 0;
} }
static int static void
mr_pong(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mr_pong(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(parc == 2 && !EmptyString(parv[1])) if(parc == 2 && !EmptyString(parv[1]))
@ -119,7 +117,7 @@ mr_pong(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
sendto_one(source_p, form_str(ERR_WRONGPONG), sendto_one(source_p, form_str(ERR_WRONGPONG),
me.name, source_p->name, me.name, source_p->name,
source_p->localClient->random_ping); source_p->localClient->random_ping);
return 0; return;
} }
} }
} }
@ -129,6 +127,4 @@ mr_pong(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
sendto_one(source_p, form_str(ERR_NOORIGIN), me.name, source_p->name); sendto_one(source_p, form_str(ERR_NOORIGIN), me.name, source_p->name);
source_p->flags &= ~FLAGS_PINGSENT; source_p->flags &= ~FLAGS_PINGSENT;
return 0;
} }

View file

@ -36,7 +36,7 @@
static const char post_desc[] = static const char post_desc[] =
"Ensure Web forms/proxies cannot connect by disconnecting on POST, GET, and PUT"; "Ensure Web forms/proxies cannot connect by disconnecting on POST, GET, and PUT";
static int mr_dumb_proxy(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mr_dumb_proxy(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message post_msgtab = { struct Message post_msgtab = {
"POST", 0, 0, 0, 0, "POST", 0, 0, 0, 0,
@ -54,17 +54,15 @@ struct Message put_msgtab = {
mapi_clist_av1 post_clist[] = { mapi_clist_av1 post_clist[] = {
&post_msgtab, &get_msgtab, &put_msgtab, NULL &post_msgtab, &get_msgtab, &put_msgtab, NULL
}; };
DECLARE_MODULE_AV2(post, NULL, NULL, post_clist, NULL, NULL, NULL, NULL, post_desc);
DECLARE_MODULE_AV2(post, NULL, NULL, post_clist, NULL, NULL, NULL, NULL, post_desc);
/* /*
** mr_dumb_proxy ** mr_dumb_proxy
** parv[1] = comment ** parv[1] = comment
*/ */
static int static void
mr_dumb_proxy(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mr_dumb_proxy(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
exit_client(client_p, source_p, source_p, "Client Exit"); exit_client(client_p, source_p, source_p, "Client Exit");
return 0;
} }

View file

@ -42,9 +42,9 @@
static const char privs_desc[] = "Provides the PRIVS command to inspect an operator's privileges"; static const char privs_desc[] = "Provides the PRIVS command to inspect an operator's privileges";
static int m_privs(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void m_privs(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int me_privs(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void me_privs(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int mo_privs(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void mo_privs(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message privs_msgtab = { struct Message privs_msgtab = {
"PRIVS", 0, 0, 0, 0, "PRIVS", 0, 0, 0, 0,
@ -115,21 +115,21 @@ static void show_privs(struct Client *source_p, struct Client *target_p)
target_p->name, buf); target_p->name, buf);
} }
static int me_privs(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) static void
me_privs(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
if (!IsOper(source_p) || parc < 2 || EmptyString(parv[1])) if (!IsOper(source_p) || parc < 2 || EmptyString(parv[1]))
return 0; return;
/* we cannot show privs for remote clients */ /* we cannot show privs for remote clients */
if((target_p = find_person(parv[1])) && MyClient(target_p)) if((target_p = find_person(parv[1])) && MyClient(target_p))
show_privs(source_p, target_p); show_privs(source_p, target_p);
return 0;
} }
static int mo_privs(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) static void
mo_privs(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -142,7 +142,7 @@ static int mo_privs(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Cli
{ {
sendto_one_numeric(source_p, ERR_NOSUCHNICK, sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), parv[1]); form_str(ERR_NOSUCHNICK), parv[1]);
return 0; return;
} }
} }
@ -153,18 +153,17 @@ static int mo_privs(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Cli
get_id(source_p, target_p), get_id(source_p, target_p),
target_p->servptr->name, target_p->servptr->name,
use_id(target_p)); use_id(target_p));
return 0;
} }
static int m_privs(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) static void
m_privs(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if (parc >= 2 && !EmptyString(parv[1]) && if (parc >= 2 && !EmptyString(parv[1]) &&
irccmp(parv[1], source_p->name)) { irccmp(parv[1], source_p->name)) {
sendto_one_numeric(source_p, ERR_NOPRIVILEGES, sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
form_str(ERR_NOPRIVILEGES)); form_str(ERR_NOPRIVILEGES));
return 0; return;
} }
show_privs(source_p, source_p); show_privs(source_p, source_p);
return 0;
} }

View file

@ -47,8 +47,8 @@
static const char rehash_desc[] = static const char rehash_desc[] =
"Provides the REHASH command to reload configuration and other files"; "Provides the REHASH command to reload configuration and other files";
static int mo_rehash(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_rehash(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_rehash(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_rehash(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message rehash_msgtab = { struct Message rehash_msgtab = {
"REHASH", 0, 0, 0, 0, "REHASH", 0, 0, 0, 0,
@ -357,7 +357,7 @@ do_rehash(struct Client *source_p, const char *type)
* parv[1] = rehash type or destination * parv[1] = rehash type or destination
* parv[2] = destination * parv[2] = destination
*/ */
static int static void
mo_rehash(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_rehash(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
const char *type = NULL, *target_server = NULL; const char *type = NULL, *target_server = NULL;
@ -366,7 +366,7 @@ mo_rehash(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "rehash"); me.name, source_p->name, "rehash");
return 0; return;
} }
if (parc > 2) if (parc > 2)
@ -384,33 +384,29 @@ mo_rehash(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "remoteban"); me.name, source_p->name, "remoteban");
return 0; return;
} }
sendto_match_servs(source_p, target_server, sendto_match_servs(source_p, target_server,
CAP_ENCAP, NOCAPS, CAP_ENCAP, NOCAPS,
"ENCAP %s REHASH %s", "ENCAP %s REHASH %s",
target_server, type != NULL ? type : ""); target_server, type != NULL ? type : "");
if (match(target_server, me.name) == 0) if (match(target_server, me.name) == 0)
return 0; return;
} }
do_rehash(source_p, type); do_rehash(source_p, type);
return 0;
} }
static int static void
me_rehash(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) me_rehash(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if (!IsPerson(source_p)) if (!IsPerson(source_p))
return 0; return;
if (!find_shared_conf(source_p->username, source_p->host, if (!find_shared_conf(source_p->username, source_p->host,
source_p->servptr->name, SHARED_REHASH)) source_p->servptr->name, SHARED_REHASH))
return 0; return;
do_rehash(source_p, parc > 1 ? parv[1] : NULL); do_rehash(source_p, parc > 1 ? parv[1] : NULL);
return 0;
} }

View file

@ -40,9 +40,9 @@
static const char restart_desc[] = "Provides the RESTART command to restart the server"; static const char restart_desc[] = "Provides the RESTART command to restart the server";
static int mo_restart(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_restart(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_restart(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_restart(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int do_restart(struct Client *source_p, const char *servername); static void do_restart(struct Client *source_p, const char *servername);
struct Message restart_msgtab = { struct Message restart_msgtab = {
"RESTART", 0, 0, 0, 0, "RESTART", 0, 0, 0, 0,
@ -56,7 +56,7 @@ DECLARE_MODULE_AV2(restart, NULL, NULL, restart_clist, NULL, NULL, NULL, NULL, r
/* /*
* mo_restart * mo_restart
*/ */
static int static void
mo_restart(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_restart(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
char buf[BUFSIZE]; char buf[BUFSIZE];
@ -67,13 +67,13 @@ mo_restart(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "die"); me.name, source_p->name, "die");
return 0; return;
} }
if(parc < 2 || EmptyString(parv[1])) if(parc < 2 || EmptyString(parv[1]))
{ {
sendto_one_notice(source_p, ":Need server name /restart %s", me.name); sendto_one_notice(source_p, ":Need server name /restart %s", me.name);
return 0; return;
} }
if(parc > 2) if(parc > 2)
@ -83,33 +83,33 @@ mo_restart(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
if (!server_p) if (!server_p)
{ {
sendto_one_numeric(source_p, ERR_NOSUCHSERVER, form_str(ERR_NOSUCHSERVER), parv[2]); sendto_one_numeric(source_p, ERR_NOSUCHSERVER, form_str(ERR_NOSUCHSERVER), parv[2]);
return 0; return;
} }
if (!IsMe(server_p)) if (!IsMe(server_p))
{ {
sendto_one(server_p, ":%s ENCAP %s RESTART %s", source_p->name, parv[2], parv[1]); sendto_one(server_p, ":%s ENCAP %s RESTART %s", source_p->name, parv[2], parv[1]);
return 0; return;
} }
} }
return do_restart(source_p, parv[1]); do_restart(source_p, parv[1]);
} }
static int static void
me_restart(struct MsgBuf *msgbuf_p __unused, struct Client *client_p __unused, struct Client *source_p, int parc, const char *parv[]) me_restart(struct MsgBuf *msgbuf_p __unused, struct Client *client_p __unused, struct Client *source_p, int parc, const char *parv[])
{ {
if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_DIE)) if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_DIE))
{ {
sendto_one_notice(source_p, ":*** You do not have an appropriate shared block to " sendto_one_notice(source_p, ":*** You do not have an appropriate shared block to "
"remotely restart this server."); "remotely restart this server.");
return 0; return;
} }
return do_restart(source_p, parv[1]); do_restart(source_p, parv[1]);
} }
static int static void
do_restart(struct Client *source_p, const char *servername) do_restart(struct Client *source_p, const char *servername)
{ {
char buf[BUFSIZE]; char buf[BUFSIZE];
@ -119,7 +119,7 @@ do_restart(struct Client *source_p, const char *servername)
if(irccmp(servername, me.name)) if(irccmp(servername, me.name))
{ {
sendto_one_notice(source_p, ":Mismatch on /restart %s", me.name); sendto_one_notice(source_p, ":Mismatch on /restart %s", me.name);
return 0; return;
} }
RB_DLINK_FOREACH(ptr, lclient_list.head) RB_DLINK_FOREACH(ptr, lclient_list.head)
@ -139,6 +139,4 @@ do_restart(struct Client *source_p, const char *servername)
sprintf(buf, "Server RESTART by %s", get_client_name(source_p, HIDE_IP)); sprintf(buf, "Server RESTART by %s", get_client_name(source_p, HIDE_IP));
restart(buf); restart(buf);
return 0;
} }

View file

@ -41,12 +41,12 @@
static const char resv_desc[] = static const char resv_desc[] =
"Provides management of reserved nicknames and channels using (UN)RESV"; "Provides management of reserved nicknames and channels using (UN)RESV";
static int mo_resv(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_resv(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_resv(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_resv(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_resv(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_resv(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_unresv(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_unresv(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_unresv(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_unresv(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_unresv(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_unresv(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message resv_msgtab = { struct Message resv_msgtab = {
"RESV", 0, 0, 0, 0, "RESV", 0, 0, 0, 0,
@ -77,7 +77,7 @@ static void remove_resv(struct Client *source_p, const char *name, int propagate
* parv[1] = channel/nick to forbid * parv[1] = channel/nick to forbid
* parv[2] = reason * parv[2] = reason
*/ */
static int static void
mo_resv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_resv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
const char *name; const char *name;
@ -90,7 +90,7 @@ mo_resv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if(!IsOperResv(source_p)) if(!IsOperResv(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "resv"); sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "resv");
return 0; return;
} }
/* RESV [time] <name> [ON <server>] :<reason> */ /* RESV [time] <name> [ON <server>] :<reason> */
@ -110,7 +110,7 @@ mo_resv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "remoteban"); me.name, source_p->name, "remoteban");
return 0; return;
} }
target_server = parv[loc + 1]; target_server = parv[loc + 1];
@ -123,7 +123,7 @@ mo_resv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if(parc <= loc || EmptyString(parv[loc])) if(parc <= loc || EmptyString(parv[loc]))
{ {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "RESV"); sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "RESV");
return 0; return;
} }
reason = parv[loc]; reason = parv[loc];
@ -134,7 +134,7 @@ mo_resv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
propagate_resv(source_p, target_server, temp_time, name, reason); propagate_resv(source_p, target_server, temp_time, name, reason);
if(match(target_server, me.name) == 0) if(match(target_server, me.name) == 0)
return 0; return;
} }
else if(!propagated && rb_dlink_list_length(&cluster_conf_list) > 0) else if(!propagated && rb_dlink_list_length(&cluster_conf_list) > 0)
cluster_resv(source_p, temp_time, name, reason); cluster_resv(source_p, temp_time, name, reason);
@ -142,12 +142,10 @@ mo_resv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if(propagated && temp_time == 0) if(propagated && temp_time == 0)
{ {
sendto_one_notice(source_p, ":Cannot set a permanent global ban"); sendto_one_notice(source_p, ":Cannot set a permanent global ban");
return 0; return;
} }
parse_resv(source_p, name, reason, temp_time, propagated); parse_resv(source_p, name, reason, temp_time, propagated);
return 0;
} }
/* ms_resv() /* ms_resv()
@ -155,7 +153,7 @@ mo_resv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
* parv[2] = channel/nick to forbid * parv[2] = channel/nick to forbid
* parv[3] = reason * parv[3] = reason
*/ */
static int static void
ms_resv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_resv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
/* parv[0] parv[1] parv[2] parv[3] /* parv[0] parv[1] parv[2] parv[3]
@ -164,24 +162,22 @@ ms_resv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
propagate_resv(source_p, parv[1], 0, parv[2], parv[3]); propagate_resv(source_p, parv[1], 0, parv[2], parv[3]);
if(!match(parv[1], me.name)) if(!match(parv[1], me.name))
return 0; return;
if(!IsPerson(source_p)) if(!IsPerson(source_p))
return 0; return;
parse_resv(source_p, parv[2], parv[3], 0, 0); parse_resv(source_p, parv[2], parv[3], 0, 0);
return 0;
} }
static int static void
me_resv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) me_resv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
/* time name 0 :reason */ /* time name 0 :reason */
if(!IsPerson(source_p)) if(!IsPerson(source_p))
return 0; return;
parse_resv(source_p, parv[2], parv[4], atoi(parv[1]), 0); parse_resv(source_p, parv[2], parv[4], atoi(parv[1]), 0);
return 0;
} }
/* parse_resv() /* parse_resv()
@ -423,7 +419,7 @@ cluster_resv(struct Client *source_p, int temp_time, const char *name, const cha
* mo_unresv() * mo_unresv()
* parv[1] = channel/nick to unforbid * parv[1] = channel/nick to unforbid
*/ */
static int static void
mo_unresv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_unresv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
int propagated = 1; int propagated = 1;
@ -431,7 +427,7 @@ mo_unresv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
if(!IsOperResv(source_p)) if(!IsOperResv(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "resv"); sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "resv");
return 0; return;
} }
if((parc == 4) && (irccmp(parv[2], "ON") == 0)) if((parc == 4) && (irccmp(parv[2], "ON") == 0))
@ -440,13 +436,13 @@ mo_unresv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "remoteban"); me.name, source_p->name, "remoteban");
return 0; return;
} }
propagate_generic(source_p, "UNRESV", parv[3], CAP_CLUSTER, "%s", parv[1]); propagate_generic(source_p, "UNRESV", parv[3], CAP_CLUSTER, "%s", parv[1]);
if(match(parv[3], me.name) == 0) if(match(parv[3], me.name) == 0)
return 0; return;
propagated = 0; propagated = 0;
} }
@ -457,14 +453,13 @@ mo_unresv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
/* cluster{} moved to remove_resv */ /* cluster{} moved to remove_resv */
remove_resv(source_p, parv[1], propagated); remove_resv(source_p, parv[1], propagated);
return 0;
} }
/* ms_unresv() /* ms_unresv()
* parv[1] = target server * parv[1] = target server
* parv[2] = resv to remove * parv[2] = resv to remove
*/ */
static int static void
ms_unresv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_unresv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
/* parv[0] parv[1] parv[2] /* parv[0] parv[1] parv[2]
@ -473,24 +468,22 @@ ms_unresv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
propagate_generic(source_p, "UNRESV", parv[1], CAP_CLUSTER, "%s", parv[2]); propagate_generic(source_p, "UNRESV", parv[1], CAP_CLUSTER, "%s", parv[2]);
if(!match(parv[1], me.name)) if(!match(parv[1], me.name))
return 0; return;
if(!IsPerson(source_p)) if(!IsPerson(source_p))
return 0; return;
handle_remote_unresv(source_p, parv[2]); handle_remote_unresv(source_p, parv[2]);
return 0;
} }
static int static void
me_unresv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) me_unresv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
/* name */ /* name */
if(!IsPerson(source_p)) if(!IsPerson(source_p))
return 0; return;
handle_remote_unresv(source_p, parv[1]); handle_remote_unresv(source_p, parv[1]);
return 0;
} }
static void static void

View file

@ -43,9 +43,9 @@
static const char sasl_desc[] = "Provides SASL authentication support"; static const char sasl_desc[] = "Provides SASL authentication support";
static int m_authenticate(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_authenticate(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_sasl(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_sasl(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_mechlist(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_mechlist(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void abort_sasl(struct Client *); static void abort_sasl(struct Client *);
static void abort_sasl_exit(hook_data_client_exit *); static void abort_sasl_exit(hook_data_client_exit *);
@ -80,7 +80,7 @@ mapi_hfn_list_av1 sasl_hfnlist[] = {
{ NULL, NULL } { NULL, NULL }
}; };
static int static bool
sasl_visible(struct Client *client_p) sasl_visible(struct Client *client_p)
{ {
struct Client *agent_p = NULL; struct Client *agent_p = NULL;
@ -119,7 +119,7 @@ _moddeinit(void)
DECLARE_MODULE_AV2(sasl, _modinit, _moddeinit, sasl_clist, NULL, sasl_hfnlist, NULL, NULL, sasl_desc); DECLARE_MODULE_AV2(sasl, _modinit, _moddeinit, sasl_clist, NULL, sasl_hfnlist, NULL, NULL, sasl_desc);
static int static void
m_authenticate(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, m_authenticate(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]) int parc, const char *parv[])
{ {
@ -128,19 +128,19 @@ m_authenticate(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
/* They really should use CAP for their own sake. */ /* They really should use CAP for their own sake. */
if(!IsCapable(source_p, CLICAP_SASL)) if(!IsCapable(source_p, CLICAP_SASL))
return 0; return;
if (strlen(client_p->id) == 3) if (strlen(client_p->id) == 3)
{ {
exit_client(client_p, client_p, client_p, "Mixing client and server protocol"); exit_client(client_p, client_p, client_p, "Mixing client and server protocol");
return 0; return;
} }
saslserv_p = find_named_client(ConfigFileEntry.sasl_service); saslserv_p = find_named_client(ConfigFileEntry.sasl_service);
if (saslserv_p == NULL || !IsService(saslserv_p)) if (saslserv_p == NULL || !IsService(saslserv_p))
{ {
sendto_one(source_p, form_str(ERR_SASLABORTED), me.name, EmptyString(source_p->name) ? "*" : source_p->name); sendto_one(source_p, form_str(ERR_SASLABORTED), me.name, EmptyString(source_p->name) ? "*" : source_p->name);
return 0; return;
} }
if(source_p->localClient->sasl_complete) if(source_p->localClient->sasl_complete)
@ -152,7 +152,7 @@ m_authenticate(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
if(strlen(parv[1]) > 400) if(strlen(parv[1]) > 400)
{ {
sendto_one(source_p, form_str(ERR_SASLTOOLONG), me.name, EmptyString(source_p->name) ? "*" : source_p->name); sendto_one(source_p, form_str(ERR_SASLTOOLONG), me.name, EmptyString(source_p->name) ? "*" : source_p->name);
return 0; return;
} }
if(!*source_p->id) if(!*source_p->id)
@ -187,11 +187,9 @@ m_authenticate(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
me.id, agent_p->servptr->name, source_p->id, agent_p->id, me.id, agent_p->servptr->name, source_p->id, agent_p->id,
parv[1]); parv[1]);
source_p->localClient->sasl_out++; source_p->localClient->sasl_out++;
return 0;
} }
static int static void
me_sasl(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, me_sasl(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]) int parc, const char *parv[])
{ {
@ -201,26 +199,26 @@ me_sasl(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
* Only SASL agents can answer global requests. * Only SASL agents can answer global requests.
*/ */
if(strncmp(parv[2], me.id, 3)) if(strncmp(parv[2], me.id, 3))
return 0; return;
if((target_p = find_id(parv[2])) == NULL) if((target_p = find_id(parv[2])) == NULL)
return 0; return;
if((agent_p = find_id(parv[1])) == NULL) if((agent_p = find_id(parv[1])) == NULL)
return 0; return;
if(source_p != agent_p->servptr) /* WTF?! */ if(source_p != agent_p->servptr) /* WTF?! */
return 0; return;
/* We only accept messages from SASL agents; these must have umode +S /* We only accept messages from SASL agents; these must have umode +S
* (so the server must be listed in a service{} block). * (so the server must be listed in a service{} block).
*/ */
if(!IsService(agent_p)) if(!IsService(agent_p))
return 0; return;
/* Reject if someone has already answered. */ /* Reject if someone has already answered. */
if(*target_p->localClient->sasl_agent && strncmp(parv[1], target_p->localClient->sasl_agent, IDLEN)) if(*target_p->localClient->sasl_agent && strncmp(parv[1], target_p->localClient->sasl_agent, IDLEN))
return 0; return;
else if(!*target_p->localClient->sasl_agent) else if(!*target_p->localClient->sasl_agent)
rb_strlcpy(target_p->localClient->sasl_agent, parv[1], IDLEN); rb_strlcpy(target_p->localClient->sasl_agent, parv[1], IDLEN);
@ -239,17 +237,13 @@ me_sasl(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
} }
else if(*parv[3] == 'M') else if(*parv[3] == 'M')
sendto_one(target_p, form_str(RPL_SASLMECHS), me.name, EmptyString(target_p->name) ? "*" : target_p->name, parv[4]); sendto_one(target_p, form_str(RPL_SASLMECHS), me.name, EmptyString(target_p->name) ? "*" : target_p->name, parv[4]);
return 0;
} }
static int static void
me_mechlist(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, me_mechlist(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]) int parc, const char *parv[])
{ {
rb_strlcpy(mechlist_buf, parv[1], sizeof mechlist_buf); rb_strlcpy(mechlist_buf, parv[1], sizeof mechlist_buf);
return 0;
} }
/* If the client never finished authenticating but is /* If the client never finished authenticating but is

View file

@ -52,8 +52,8 @@
static const char scan_desc[] = static const char scan_desc[] =
"Provides the SCAN command to show users that have a mode set or cleared"; "Provides the SCAN command to show users that have a mode set or cleared";
static int mo_scan(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_scan(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int scan_umodes(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void scan_umodes(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message scan_msgtab = { struct Message scan_msgtab = {
"SCAN", 0, 0, 0, 0, "SCAN", 0, 0, 0, 0,
@ -64,7 +64,7 @@ mapi_clist_av1 scan_clist[] = { &scan_msgtab, NULL };
DECLARE_MODULE_AV2(scan, NULL, NULL, scan_clist, NULL, NULL, NULL, NULL, scan_desc); DECLARE_MODULE_AV2(scan, NULL, NULL, scan_clist, NULL, NULL, NULL, NULL, scan_desc);
typedef int (*scan_handler)(struct MsgBuf *, struct Client *, struct Client *, int, typedef void (*scan_handler)(struct MsgBuf *, struct Client *, struct Client *, int,
const char **); const char **);
struct scan_cmd { struct scan_cmd {
@ -84,7 +84,7 @@ static const char *spoofed_sockhost = "0";
* parv[1] = options [or target] * parv[1] = options [or target]
* parv[2] = [target] * parv[2] = [target]
*/ */
static int static void
mo_scan(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, mo_scan(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc,
const char *parv[]) const char *parv[])
{ {
@ -94,28 +94,25 @@ mo_scan(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
if (!irccmp(sptr->name, parv[1])) if (!irccmp(sptr->name, parv[1]))
{ {
if (sptr->operlevel == L_ADMIN && if (!(sptr->operlevel == L_ADMIN && !IsOperAdmin(source_p)))
!IsOperAdmin(source_p)) sptr->handler(msgbuf_p, client_p, source_p, parc, parv);
return -1;
else return;
return sptr->handler(msgbuf_p, client_p, source_p, parc, parv);
} }
} }
sendto_one_notice(source_p, ":*** %s is not an implemented SCAN target", sendto_one_notice(source_p, ":*** %s is not an implemented SCAN target",
parv[1]); parv[1]);
return 0;
} }
static int static void
scan_umodes(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, scan_umodes(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc,
const char *parv[]) const char *parv[])
{ {
unsigned int allowed_umodes = 0, disallowed_umodes = 0; unsigned int allowed_umodes = 0, disallowed_umodes = 0;
int what = MODE_ADD; int what = MODE_ADD;
int mode; int mode;
int list_users = YES; bool list_users = true;
int list_max = 500; int list_max = 500;
int list_count = 0, count = 0; int list_count = 0, count = 0;
const char *mask = NULL; const char *mask = NULL;
@ -133,13 +130,13 @@ scan_umodes(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
me.name, source_p->name, "SCAN UMODES"); me.name, source_p->name, "SCAN UMODES");
return -1; return;
} }
if (parv[2][0] != '+' && parv[2][0] != '-') if (parv[2][0] != '+' && parv[2][0] != '-')
{ {
sendto_one_notice(source_p, ":SCAN UMODES: umodes parameter must start with '+' or '-'"); sendto_one_notice(source_p, ":SCAN UMODES: umodes parameter must start with '+' or '-'");
return -1; return;
} }
for (c = parv[2]; *c; c++) for (c = parv[2]; *c; c++)
@ -166,9 +163,9 @@ scan_umodes(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
for (i = 3; i < parc; i++) for (i = 3; i < parc; i++)
{ {
if (!irccmp(parv[i], "no-list")) if (!irccmp(parv[i], "no-list"))
list_users = NO; list_users = false;
else if (!irccmp(parv[i], "list")) else if (!irccmp(parv[i], "list"))
list_users = YES; list_users = true;
else if (!irccmp(parv[i], "global")) else if (!irccmp(parv[i], "global"))
target_list = &global_client_list; target_list = &global_client_list;
else if (i < (parc - 1)) else if (i < (parc - 1))
@ -180,13 +177,13 @@ scan_umodes(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
else else
{ {
sendto_one_notice(source_p, ":SCAN UMODES: invalid parameters"); sendto_one_notice(source_p, ":SCAN UMODES: invalid parameters");
return -1; return;
} }
} }
else else
{ {
sendto_one_notice(source_p, ":SCAN UMODES: invalid parameters"); sendto_one_notice(source_p, ":SCAN UMODES: invalid parameters");
return -1; return;
} }
} }
if (target_list == &global_client_list && list_users) if (target_list == &global_client_list && list_users)
@ -208,7 +205,7 @@ scan_umodes(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "oper_spy"); me.name, source_p->name, "oper_spy");
return -1; return;
} }
} }
@ -277,6 +274,4 @@ scan_umodes(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
sendto_one_numeric(source_p, RPL_SCANMATCHED, sendto_one_numeric(source_p, RPL_SCANMATCHED,
form_str(RPL_SCANMATCHED), count); form_str(RPL_SCANMATCHED), count);
return 0;
} }

View file

@ -55,10 +55,10 @@ static void _moddeinit(void);
static void mark_services(void); static void mark_services(void);
static void unmark_services(void); static void unmark_services(void);
static int me_su(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_su(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_login(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_login(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_rsfnc(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_rsfnc(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_nickdelay(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_nickdelay(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void h_svc_server_introduced(hook_data_client *); static void h_svc_server_introduced(hook_data_client *);
static void h_svc_whois(hook_data_client *); static void h_svc_whois(hook_data_client *);
@ -113,7 +113,7 @@ _moddeinit(void)
unmark_services(); unmark_services();
} }
static int static void
me_su(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, me_su(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]) int parc, const char *parv[])
{ {
@ -123,14 +123,14 @@ me_su(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
{ {
sendto_realops_snomask(SNO_GENERAL, L_ALL, sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Non-service server %s attempting to execute services-only command SU", source_p->name); "Non-service server %s attempting to execute services-only command SU", source_p->name);
return 0; return;
} }
if((target_p = find_client(parv[1])) == NULL) if((target_p = find_client(parv[1])) == NULL)
return 0; return;
if(!target_p->user) if(!target_p->user)
return 0; return;
if(EmptyString(parv[2])) if(EmptyString(parv[2]))
target_p->user->suser[0] = '\0'; target_p->user->suser[0] = '\0';
@ -142,22 +142,19 @@ me_su(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
EmptyString(target_p->user->suser) ? "*" : target_p->user->suser); EmptyString(target_p->user->suser) ? "*" : target_p->user->suser);
invalidate_bancache_user(target_p); invalidate_bancache_user(target_p);
return 0;
} }
static int static void
me_login(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, me_login(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]) int parc, const char *parv[])
{ {
if(!IsPerson(source_p)) if(!IsPerson(source_p))
return 0; return;
rb_strlcpy(source_p->user->suser, parv[1], sizeof(source_p->user->suser)); rb_strlcpy(source_p->user->suser, parv[1], sizeof(source_p->user->suser));
return 0;
} }
static int static void
me_rsfnc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, me_rsfnc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]) int parc, const char *parv[])
{ {
@ -170,17 +167,17 @@ me_rsfnc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_realops_snomask(SNO_GENERAL, L_ALL, sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Non-service server %s attempting to execute services-only command RSFNC", source_p->name); "Non-service server %s attempting to execute services-only command RSFNC", source_p->name);
return 0; return;
} }
if((target_p = find_person(parv[1])) == NULL) if((target_p = find_person(parv[1])) == NULL)
return 0; return;
if(!MyClient(target_p)) if(!MyClient(target_p))
return 0; return;
if(!clean_nick(parv[2], 0) || IsDigit(parv[2][0])) if(!clean_nick(parv[2], 0) || IsDigit(parv[2][0]))
return 0; return;
curts = atol(parv[4]); curts = atol(parv[4]);
@ -189,7 +186,7 @@ me_rsfnc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
* nicknames before the RSFNC arrives.. --anfl * nicknames before the RSFNC arrives.. --anfl
*/ */
if(target_p->tsinfo != curts) if(target_p->tsinfo != curts)
return 0; return;
if((exist_p = find_named_client(parv[2]))) if((exist_p = find_named_client(parv[2])))
{ {
@ -258,7 +255,6 @@ doit:
snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name); snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name);
rb_note(target_p->localClient->F, note); rb_note(target_p->localClient->F, note);
return 0;
} }
/* /*
@ -266,7 +262,7 @@ doit:
** parv[1] = duration in seconds (0 to remove) ** parv[1] = duration in seconds (0 to remove)
** parv[2] = nick ** parv[2] = nick
*/ */
static int static void
me_nickdelay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) me_nickdelay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
int duration; int duration;
@ -276,7 +272,7 @@ me_nickdelay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
{ {
sendto_realops_snomask(SNO_GENERAL, L_ALL, sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Non-service server %s attempting to execute services-only command NICKDELAY", source_p->name); "Non-service server %s attempting to execute services-only command NICKDELAY", source_p->name);
return 0; return;
} }
duration = atoi(parv[1]); duration = atoi(parv[1]);
@ -295,8 +291,6 @@ me_nickdelay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
if (nd != NULL) if (nd != NULL)
nd->expire = rb_current_time() + duration; nd->expire = rb_current_time() + duration;
} }
return 0;
} }
static void static void

View file

@ -41,7 +41,7 @@
static const char set_desc[] = "Provides the SET command to change server parameters"; static const char set_desc[] = "Provides the SET command to change server parameters";
static int mo_set(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_set(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message set_msgtab = { struct Message set_msgtab = {
"SET", 0, 0, 0, 0, "SET", 0, 0, 0, 0,
@ -453,7 +453,7 @@ quote_splitusers(struct Client *source_p, const char *arg, int newval)
* mo_set - SET command handler * mo_set - SET command handler
* set options while running * set options while running
*/ */
static int static void
mo_set(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_set(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
int newval; int newval;
@ -497,7 +497,7 @@ mo_set(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
wants_char ? "string, " : ""), wants_char ? "string, " : ""),
(set_cmd_table[i]. (set_cmd_table[i].
wants_char ? "int" : "")); wants_char ? "int" : ""));
return 0; return;
} }
if(parc <= 2) if(parc <= 2)
@ -529,14 +529,14 @@ mo_set(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
":Value less than 0 illegal for %s", ":Value less than 0 illegal for %s",
set_cmd_table[i].name); set_cmd_table[i].name);
return 0; return;
} }
} }
else else
newval = -1; newval = -1;
set_cmd_table[i].handler(source_p, arg, newval); set_cmd_table[i].handler(source_p, arg, newval);
return 0; return;
} }
} }
@ -545,10 +545,8 @@ mo_set(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
* found within set_cmd_table. * found within set_cmd_table.
*/ */
sendto_one_notice(source_p, ":Variable not found."); sendto_one_notice(source_p, ":Variable not found.");
return 0; return;
} }
list_quote_commands(source_p); list_quote_commands(source_p);
return 0;
} }

View file

@ -51,8 +51,8 @@
static const char signon_desc[] = "Provides account login/logout support for services"; static const char signon_desc[] = "Provides account login/logout support for services";
static int me_svslogin(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_svslogin(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_signon(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_signon(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void send_signon(struct Client *, struct Client *, const char *, const char *, const char *, unsigned int, const char *); static void send_signon(struct Client *, struct Client *, const char *, const char *, const char *, unsigned int, const char *);
@ -75,7 +75,7 @@ DECLARE_MODULE_AV2(signon, NULL, NULL, signon_clist, NULL, NULL, NULL, NULL, sig
#define USER_VALID 2 #define USER_VALID 2
#define HOST_VALID 4 #define HOST_VALID 4
static int static bool
clean_username(const char *username) clean_username(const char *username)
{ {
int len = 0; int len = 0;
@ -85,16 +85,16 @@ clean_username(const char *username)
len++; len++;
if(!IsUserChar(*username)) if(!IsUserChar(*username))
return 0; return false;
} }
if(len > USERLEN) if(len > USERLEN)
return 0; return false;
return 1; return true;
} }
static int static bool
clean_host(const char *host) clean_host(const char *host)
{ {
int len = 0; int len = 0;
@ -104,16 +104,16 @@ clean_host(const char *host)
len++; len++;
if(!IsHostChar(*host)) if(!IsHostChar(*host))
return 0; return false;
} }
if(len > HOSTLEN) if(len > HOSTLEN)
return 0; return false;
return 1; return true;
} }
static int static void
me_svslogin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, me_svslogin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]) int parc, const char *parv[])
{ {
@ -126,14 +126,14 @@ me_svslogin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
{ {
sendto_realops_snomask(SNO_GENERAL, L_ALL, sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Non-service server %s attempting to execute services-only command SVSLOGIN", source_p->name); "Non-service server %s attempting to execute services-only command SVSLOGIN", source_p->name);
return 0; return;
} }
if((target_p = find_client(parv[1])) == NULL) if((target_p = find_client(parv[1])) == NULL)
return 0; return;
if(!MyClient(target_p) && !IsUnknown(target_p)) if(!MyClient(target_p) && !IsUnknown(target_p))
return 0; return;
if(clean_nick(parv[2], 0)) if(clean_nick(parv[2], 0))
{ {
@ -175,7 +175,7 @@ me_svslogin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
/* Login (mostly) follows nick rules. */ /* Login (mostly) follows nick rules. */
if(*login && !clean_nick(login, 0)) if(*login && !clean_nick(login, 0))
return 0; return;
if((exist_p = find_person(nick)) && target_p != exist_p) if((exist_p = find_person(nick)) && target_p != exist_p)
{ {
@ -195,7 +195,9 @@ me_svslogin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))", snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))",
me.name); me.name);
exit_client(NULL, exist_p, &me, buf); exit_client(NULL, exist_p, &me, buf);
}else if((exist_p = find_client(nick)) && IsUnknown(exist_p) && exist_p != target_p) { }
else if((exist_p = find_client(nick)) && IsUnknown(exist_p) && exist_p != target_p)
{
exit_client(NULL, exist_p, &me, "Overridden"); exit_client(NULL, exist_p, &me, "Overridden");
} }
@ -239,11 +241,9 @@ me_svslogin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name); snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name);
rb_note(target_p->localClient->F, note); rb_note(target_p->localClient->F, note);
} }
return 0;
} }
static int static void
ms_signon(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, ms_signon(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]) int parc, const char *parv[])
{ {
@ -266,7 +266,7 @@ ms_signon(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
me.name); me.name);
source_p->flags |= FLAGS_KILLED; source_p->flags |= FLAGS_KILLED;
exit_client(NULL, source_p, &me, "Bad nickname from SIGNON"); exit_client(NULL, source_p, &me, "Bad nickname from SIGNON");
return 0; return;
} }
if(!clean_username(parv[2]) || !clean_host(parv[3])) if(!clean_username(parv[2]) || !clean_host(parv[3]))
@ -284,7 +284,7 @@ ms_signon(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
me.name); me.name);
source_p->flags |= FLAGS_KILLED; source_p->flags |= FLAGS_KILLED;
exit_client(NULL, source_p, &me, "Bad user@host from SIGNON"); exit_client(NULL, source_p, &me, "Bad user@host from SIGNON");
return 0; return;
} }
newts = atol(parv[4]); newts = atol(parv[4]);
@ -296,7 +296,7 @@ ms_signon(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
if (clean_nick(parv[5], 0)) if (clean_nick(parv[5], 0))
rb_strlcpy(login, parv[5], NICKLEN + 1); rb_strlcpy(login, parv[5], NICKLEN + 1);
else else
return 0; return;
} }
else else
login[0] = '\0'; login[0] = '\0';
@ -331,7 +331,7 @@ ms_signon(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
exit_client(NULL, target_p, &me, "Nick collision(new)"); exit_client(NULL, target_p, &me, "Nick collision(new)");
source_p->flags |= FLAGS_KILLED; source_p->flags |= FLAGS_KILLED;
exit_client(client_p, source_p, &me, "Nick collision(old)"); exit_client(client_p, source_p, &me, "Nick collision(old)");
return 0; return;
} }
else else
{ {
@ -367,7 +367,7 @@ ms_signon(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
exit_client(client_p, source_p, &me, "Nick collision(old)"); exit_client(client_p, source_p, &me, "Nick collision(old)");
else else
exit_client(client_p, source_p, &me, "Nick collision(new)"); exit_client(client_p, source_p, &me, "Nick collision(new)");
return 0; return;
} }
else else
{ {
@ -400,7 +400,6 @@ ms_signon(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
} }
send_signon(client_p, source_p, parv[1], parv[2], parv[3], newts, login); send_signon(client_p, source_p, parv[1], parv[2], parv[3], newts, login);
return 0;
} }
static void static void

View file

@ -66,7 +66,7 @@ DECLARE_MODULE_AV2(snote, NULL, NULL, snote_clist, NULL, NULL, NULL, NULL, snote
* parv[1] = snomask letter * parv[1] = snomask letter
* parv[2] = message * parv[2] = message
*/ */
static int static void
me_snote(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, me_snote(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc,
const char *parv[]) const char *parv[])
{ {
@ -75,12 +75,10 @@ me_snote(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
* shit happens afterall -nenolod * shit happens afterall -nenolod
*/ */
if (parc > 3) if (parc > 3)
return 0; return;
if (!IsServer(source_p)) if (!IsServer(source_p))
return 0; return;
sendto_realops_snomask_from(snomask_modes[(unsigned char) *parv[1]], sendto_realops_snomask_from(snomask_modes[(unsigned char) *parv[1]],
L_ALL, source_p, "%s", parv[2]); L_ALL, source_p, "%s", parv[2]);
return 0;
} }

View file

@ -35,7 +35,7 @@
static const char starttls_desc[] = "Provides the tls CAP and STARTTLS command"; static const char starttls_desc[] = "Provides the tls CAP and STARTTLS command";
static int mr_starttls(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mr_starttls(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message starttls_msgtab = { struct Message starttls_msgtab = {
"STARTTLS", 0, 0, 0, 0, "STARTTLS", 0, 0, 0, 0,
@ -59,7 +59,7 @@ mapi_cap_list_av2 starttls_cap_list[] = { { 0, NULL, NULL, NULL } };
DECLARE_MODULE_AV2(starttls, NULL, NULL, starttls_clist, NULL, NULL, starttls_cap_list, NULL, starttls_desc); DECLARE_MODULE_AV2(starttls, NULL, NULL, starttls_clist, NULL, NULL, starttls_cap_list, NULL, starttls_desc);
static int static void
mr_starttls(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mr_starttls(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
#ifdef HAVE_LIBCRYPTO #ifdef HAVE_LIBCRYPTO
@ -67,25 +67,25 @@ mr_starttls(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
rb_fde_t *F[2]; rb_fde_t *F[2];
if (!MyConnect(client_p)) if (!MyConnect(client_p))
return 0; return;
if (IsSSL(client_p)) if (IsSSL(client_p))
{ {
sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "Nested TLS handshake not allowed"); sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "Nested TLS handshake not allowed");
return 1; return;
} }
if (!ssl_ok || !get_ssld_count()) if (!ssl_ok || !get_ssld_count())
{ {
sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "TLS is not configured"); sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "TLS is not configured");
return 1; return;
} }
if (rb_socketpair(AF_UNIX, SOCK_STREAM, 0, &F[0], &F[1], "STARTTLS ssld session") == -1) if (rb_socketpair(AF_UNIX, SOCK_STREAM, 0, &F[0], &F[1], "STARTTLS ssld session") == -1)
{ {
ilog_error("error creating SSL/TLS socketpair for ssld slave"); ilog_error("error creating SSL/TLS socketpair for ssld slave");
sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "Unable to create SSL/TLS socketpair for ssld offload slave"); sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "Unable to create SSL/TLS socketpair for ssld offload slave");
return 1; return;
} }
s_assert(client_p->localClient != NULL); s_assert(client_p->localClient != NULL);
@ -103,11 +103,7 @@ mr_starttls(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
client_p->localClient->ssl_ctl = ctl; client_p->localClient->ssl_ctl = ctl;
SetSSL(client_p); SetSSL(client_p);
} }
else #else /* HAVE_LIBCRYPTO */
return 1;
#else
sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "TLS is not configured"); sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "TLS is not configured");
#endif #endif /* HAVE_LIBCRYPTO */
return 0;
} }

View file

@ -52,7 +52,7 @@
static const char stats_desc[] = static const char stats_desc[] =
"Provides the STATS command to inspect various server/network information"; "Provides the STATS command to inspect various server/network information";
static int m_stats (struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_stats (struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message stats_msgtab = { struct Message stats_msgtab = {
"STATS", 0, 0, 0, 0, "STATS", 0, 0, 0, 0,
@ -73,8 +73,8 @@ DECLARE_MODULE_AV2(stats, NULL, NULL, stats_clist, stats_hlist, NULL, NULL, NULL
const char *Lformat = "%s %u %u %u %u %u :%u %u %s"; const char *Lformat = "%s %u %u %u %u %u :%u %u %s";
static void stats_l_list(struct Client *s, const char *, int, int, rb_dlink_list *, char, static void stats_l_list(struct Client *s, const char *, bool, bool, rb_dlink_list *, char,
int (*check_fn)(struct Client *target_p)); bool (*check_fn)(struct Client *target_p));
static void stats_l_client(struct Client *source_p, struct Client *target_p, static void stats_l_client(struct Client *source_p, struct Client *target_p,
char statchar); char statchar);
@ -193,7 +193,7 @@ static struct stats_cmd stats_cmd_table[255] = {
* This will search the tables for the appropriate stats letter, * This will search the tables for the appropriate stats letter,
* if found execute it. * if found execute it.
*/ */
static int static void
m_stats(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_stats(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
static time_t last_used = 0; static time_t last_used = 0;
@ -214,14 +214,14 @@ m_stats(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
me.name, source_p->name, "STATS"); me.name, source_p->name, "STATS");
sendto_one_numeric(source_p, RPL_ENDOFSTATS, sendto_one_numeric(source_p, RPL_ENDOFSTATS,
form_str(RPL_ENDOFSTATS), statchar); form_str(RPL_ENDOFSTATS), statchar);
return 0; return;
} }
else else
last_used = rb_current_time(); last_used = rb_current_time();
} }
if(hunt_server (client_p, source_p, ":%s STATS %s :%s", 2, parc, parv) != HUNTED_ISME) if(hunt_server (client_p, source_p, ":%s STATS %s :%s", 2, parc, parv) != HUNTED_ISME)
return 0; return;
if((statchar != 'L') && (statchar != 'l')) if((statchar != 'L') && (statchar != 'l'))
{ {
@ -266,8 +266,6 @@ stats_out:
/* Send the end of stats notice, and the stats_spy */ /* Send the end of stats notice, and the stats_spy */
sendto_one_numeric(source_p, RPL_ENDOFSTATS, sendto_one_numeric(source_p, RPL_ENDOFSTATS,
form_str(RPL_ENDOFSTATS), statchar); form_str(RPL_ENDOFSTATS), statchar);
return 0;
} }
static void static void
@ -1587,20 +1585,17 @@ stats_servlinks (struct Client *source_p)
sendto_one_numeric(source_p, RPL_STATSDEBUG, "? :Server recv: %s", buf); sendto_one_numeric(source_p, RPL_STATSDEBUG, "? :Server recv: %s", buf);
} }
static int static inline bool
stats_l_should_show_oper(struct Client *target_p) stats_l_should_show_oper(struct Client *target_p)
{ {
if (IsOperInvis(target_p)) return (!IsOperInvis(target_p));
return 0;
return 1;
} }
static void static void
stats_ltrace(struct Client *source_p, int parc, const char *parv[]) stats_ltrace(struct Client *source_p, int parc, const char *parv[])
{ {
int doall = 0; bool doall = false;
int wilds = 0; bool wilds = false;
const char *name; const char *name;
char statchar = parv[1][0]; char statchar = parv[1][0];
@ -1612,7 +1607,7 @@ stats_ltrace(struct Client *source_p, int parc, const char *parv[])
(!MyClient(source_p) && !irccmp(parv[2], me.id))) (!MyClient(source_p) && !irccmp(parv[2], me.id)))
{ {
name = me.name; name = me.name;
doall = 1; doall = true;
} }
else else
{ {
@ -1646,7 +1641,7 @@ stats_ltrace(struct Client *source_p, int parc, const char *parv[])
else else
{ {
name = me.name; name = me.name;
doall = 1; doall = true;
} }
stats_spy(source_p, statchar, name); stats_spy(source_p, statchar, name);
@ -1684,8 +1679,8 @@ stats_ltrace(struct Client *source_p, int parc, const char *parv[])
} }
static void static void
stats_l_list(struct Client *source_p, const char *name, int doall, int wilds, stats_l_list(struct Client *source_p, const char *name, bool doall, bool wilds,
rb_dlink_list * list, char statchar, int (*check_fn)(struct Client *target_p)) rb_dlink_list * list, char statchar, bool (*check_fn)(struct Client *target_p))
{ {
rb_dlink_node *ptr; rb_dlink_node *ptr;
struct Client *target_p; struct Client *target_p;
@ -1766,10 +1761,6 @@ stats_comm(struct Client *source_p)
* output - none * output - none
* side effects - * side effects -
* This little helper function reports to opers if configured. * This little helper function reports to opers if configured.
* personally, I don't see why opers need to see stats requests
* at all. They are just "noise" to an oper, and users can't do
* any damage with stats requests now anyway. So, why show them?
* -Dianora
*/ */
static int static int
stats_spy(struct Client *source_p, char statchar, const char *name) stats_spy(struct Client *source_p, char statchar, const char *name)

View file

@ -38,7 +38,7 @@
static const char svinfo_desc[] = static const char svinfo_desc[] =
"Provides TS6 SVINFO command to ensure version and clock synchronisation"; "Provides TS6 SVINFO command to ensure version and clock synchronisation";
static int ms_svinfo(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_svinfo(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message svinfo_msgtab = { struct Message svinfo_msgtab = {
"SVINFO", 0, 0, 0, 0, "SVINFO", 0, 0, 0, 0,
{mg_unreg, mg_ignore, mg_ignore, {ms_svinfo, 5}, mg_ignore, mg_ignore} {mg_unreg, mg_ignore, mg_ignore, {ms_svinfo, 5}, mg_ignore, mg_ignore}
@ -54,7 +54,7 @@ DECLARE_MODULE_AV2(svinfo, NULL, NULL, svinfo_clist, NULL, NULL, NULL, NULL, svi
* parv[3] = unused, send 0 * parv[3] = unused, send 0
* parv[4] = server's idea of UTC time * parv[4] = server's idea of UTC time
*/ */
static int static void
ms_svinfo(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_svinfo(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
signed long deltat; signed long deltat;
@ -63,7 +63,7 @@ ms_svinfo(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
/* SVINFO isnt remote. */ /* SVINFO isnt remote. */
if(source_p != client_p) if(source_p != client_p)
return 0; return;
if(TS_CURRENT < atoi(parv[2]) || atoi(parv[1]) < TS_MIN) if(TS_CURRENT < atoi(parv[2]) || atoi(parv[1]) < TS_MIN)
{ {
@ -74,7 +74,7 @@ ms_svinfo(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
snprintf(squitreason, sizeof squitreason, "Incompatible TS version (%s,%s)", snprintf(squitreason, sizeof squitreason, "Incompatible TS version (%s,%s)",
parv[1], parv[2]); parv[1], parv[2]);
exit_client(source_p, source_p, source_p, squitreason); exit_client(source_p, source_p, source_p, squitreason);
return 0; return;
} }
/* /*
@ -99,7 +99,7 @@ ms_svinfo(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
(long) rb_current_time(), (long) theirtime, deltat); (long) rb_current_time(), (long) theirtime, deltat);
disable_server_conf_autoconn(source_p->name); disable_server_conf_autoconn(source_p->name);
exit_client(source_p, source_p, source_p, squitreason); exit_client(source_p, source_p, source_p, squitreason);
return 0; return;
} }
if(deltat > ConfigFileEntry.ts_warn_delta) if(deltat > ConfigFileEntry.ts_warn_delta)
@ -109,6 +109,4 @@ ms_svinfo(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
" (my TS=%ld, their TS=%ld, delta=%ld)", " (my TS=%ld, their TS=%ld, delta=%ld)",
source_p->name, (long) rb_current_time(), (long) theirtime, deltat); source_p->name, (long) rb_current_time(), (long) theirtime, deltat);
} }
return 0;
} }

View file

@ -45,8 +45,8 @@
static const char tb_desc[] = static const char tb_desc[] =
"Provides TS6 TB and ETB commands for topic bursting between servers"; "Provides TS6 TB and ETB commands for topic bursting between servers";
static int ms_tb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void ms_tb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int ms_etb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void ms_etb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message tb_msgtab = { struct Message tb_msgtab = {
"TB", 0, 0, 0, 0, "TB", 0, 0, 0, 0,
@ -68,7 +68,7 @@ DECLARE_MODULE_AV2(tb, NULL, NULL, tb_clist, NULL, NULL, NULL, NULL, tb_desc);
* parv[3] - optional topicwho/topic * parv[3] - optional topicwho/topic
* parv[4] - topic * parv[4] - topic
*/ */
static int static void
ms_tb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_tb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Channel *chptr; struct Channel *chptr;
@ -80,7 +80,7 @@ ms_tb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
chptr = find_channel(parv[1]); chptr = find_channel(parv[1]);
if(chptr == NULL) if(chptr == NULL)
return 0; return;
newtopicts = atol(parv[2]); newtopicts = atol(parv[2]);
@ -102,7 +102,7 @@ ms_tb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
} }
if (EmptyString(newtopic)) if (EmptyString(newtopic))
return 0; return;
if(chptr->topic == NULL || chptr->topic_time > newtopicts) if(chptr->topic == NULL || chptr->topic_time > newtopicts)
{ {
@ -111,7 +111,7 @@ ms_tb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
* same topic just drop the message --fl * same topic just drop the message --fl
*/ */
if(chptr->topic != NULL && strcmp(chptr->topic, newtopic) == 0) if(chptr->topic != NULL && strcmp(chptr->topic, newtopic) == 0)
return 0; return;
set_channel_topic(chptr, newtopic, newtopicwho, newtopicts); set_channel_topic(chptr, newtopic, newtopicwho, newtopicts);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s TOPIC %s :%s", sendto_channel_local(ALL_MEMBERS, chptr, ":%s TOPIC %s :%s",
@ -122,8 +122,6 @@ ms_tb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
ConfigChannel.burst_topicwho ? chptr->topic_info : "", ConfigChannel.burst_topicwho ? chptr->topic_info : "",
ConfigChannel.burst_topicwho ? " " : "", chptr->topic); ConfigChannel.burst_topicwho ? " " : "", chptr->topic);
} }
return 0;
} }
/* ms_etb() /* ms_etb()
@ -134,7 +132,7 @@ ms_tb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
* parv[4] - topicwho * parv[4] - topicwho
* parv[5] - topic * parv[5] - topic
*/ */
static int static void
ms_etb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_etb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Channel *chptr; struct Channel *chptr;
@ -148,7 +146,7 @@ ms_etb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
chptr = find_channel(parv[2]); chptr = find_channel(parv[2]);
if(chptr == NULL) if(chptr == NULL)
return 0; return;
newtopicts = atol(parv[3]); newtopicts = atol(parv[3]);
@ -250,6 +248,4 @@ ms_etb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
me.id, chptr->chname, chptr->chname); me.id, chptr->chname, chptr->chname);
} }
} }
return 0;
} }

View file

@ -41,8 +41,8 @@
static const char testline_desc[] = "Provides the ability to test I/K/D/X lines and RESVs"; static const char testline_desc[] = "Provides the ability to test I/K/D/X lines and RESVs";
static int mo_testline(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_testline(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_testgecos(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_testgecos(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message testline_msgtab = { struct Message testline_msgtab = {
"TESTLINE", 0, 0, 0, 0, "TESTLINE", 0, 0, 0, 0,
@ -57,7 +57,7 @@ mapi_clist_av1 testline_clist[] = { &testline_msgtab, &testgecos_msgtab, NULL };
DECLARE_MODULE_AV2(testline, NULL, NULL, testline_clist, NULL, NULL, NULL, NULL, testline_desc); DECLARE_MODULE_AV2(testline, NULL, NULL, testline_clist, NULL, NULL, NULL, NULL, testline_desc);
static int static void
mo_testline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_testline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct ConfItem *aconf; struct ConfItem *aconf;
@ -95,7 +95,7 @@ mo_testline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
else else
sendto_one(source_p, form_str(RPL_NOTESTLINE), sendto_one(source_p, form_str(RPL_NOTESTLINE),
me.name, source_p->name, parv[1]); me.name, source_p->name, parv[1]);
return 0; return;
} }
if((p = strchr(mask, '!'))) if((p = strchr(mask, '!')))
@ -105,7 +105,7 @@ mo_testline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
mask = p; mask = p;
if(EmptyString(mask)) if(EmptyString(mask))
return 0; return;
} }
if((p = strchr(mask, '@'))) if((p = strchr(mask, '@')))
@ -115,7 +115,7 @@ mo_testline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
host = p; host = p;
if(EmptyString(host)) if(EmptyString(host))
return 0; return;
} }
else else
host = mask; host = mask;
@ -142,7 +142,7 @@ mo_testline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
(long) ((aconf->hold - rb_current_time()) / 60) : 0L, (long) ((aconf->hold - rb_current_time()) / 60) : 0L,
phost, reasonbuf); phost, reasonbuf);
return 0; return;
} }
/* Otherwise, aconf is an exempt{} */ /* Otherwise, aconf is an exempt{} */
if(aconf == NULL && if(aconf == NULL &&
@ -195,7 +195,7 @@ mo_testline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
(aconf->flags & CONF_FLAGS_TEMPORARY) ? (aconf->flags & CONF_FLAGS_TEMPORARY) ?
(long) ((aconf->hold - rb_current_time()) / 60) : 0L, (long) ((aconf->hold - rb_current_time()) / 60) : 0L,
buf, reasonbuf); buf, reasonbuf);
return 0; return;
} }
} }
@ -212,7 +212,7 @@ mo_testline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
* --nenolod * --nenolod
*/ */
resv_p->port--; resv_p->port--;
return 0; return;
} }
/* no matching resv, we can print the I: if it exists */ /* no matching resv, we can print the I: if it exists */
@ -222,16 +222,15 @@ mo_testline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
aconf->info.name, EmptyString(aconf->spasswd) ? "<NULL>" : aconf->spasswd, aconf->info.name, EmptyString(aconf->spasswd) ? "<NULL>" : aconf->spasswd,
show_iline_prefix(source_p, aconf, aconf->user), show_iline_prefix(source_p, aconf, aconf->user),
aconf->host, aconf->port, aconf->className); aconf->host, aconf->port, aconf->className);
return 0; return;
} }
/* nothing matches.. */ /* nothing matches.. */
sendto_one(source_p, form_str(RPL_NOTESTLINE), sendto_one(source_p, form_str(RPL_NOTESTLINE),
me.name, source_p->name, parv[1]); me.name, source_p->name, parv[1]);
return 0;
} }
static int static void
mo_testgecos(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_testgecos(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct ConfItem *aconf; struct ConfItem *aconf;
@ -240,7 +239,7 @@ mo_testgecos(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
{ {
sendto_one(source_p, form_str(RPL_NOTESTLINE), sendto_one(source_p, form_str(RPL_NOTESTLINE),
me.name, source_p->name, parv[1]); me.name, source_p->name, parv[1]);
return 0; return;
} }
sendto_one(source_p, form_str(RPL_TESTLINE), sendto_one(source_p, form_str(RPL_TESTLINE),
@ -248,5 +247,4 @@ mo_testgecos(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
aconf->hold ? 'x' : 'X', aconf->hold ? 'x' : 'X',
aconf->hold ? (long) ((aconf->hold - rb_current_time()) / 60) : 0L, aconf->hold ? (long) ((aconf->hold - rb_current_time()) / 60) : 0L,
aconf->host, aconf->passwd); aconf->host, aconf->passwd);
return 0;
} }

View file

@ -46,11 +46,12 @@
#include "parse.h" #include "parse.h"
#include "modules.h" #include "modules.h"
static void mo_testmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]);
static const char testmask_desc[] = static const char testmask_desc[] =
"Provides the TESTMASK command to show the number of clients matching a hostmask or GECOS"; "Provides the TESTMASK command to show the number of clients matching a hostmask or GECOS";
static void mo_testmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]);
struct Message testmask_msgtab = { struct Message testmask_msgtab = {
"TESTMASK", 0, 0, 0, 0, "TESTMASK", 0, 0, 0, 0,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_testmask, 2}} {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_testmask, 2}}
@ -62,7 +63,7 @@ DECLARE_MODULE_AV2(testmask, NULL, NULL, testmask_clist, NULL, NULL, NULL, NULL,
static const char *empty_sockhost = "255.255.255.255"; static const char *empty_sockhost = "255.255.255.255";
static const char *spoofed_sockhost = "0"; static const char *spoofed_sockhost = "0";
static int static void
mo_testmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, mo_testmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]) int parc, const char *parv[])
{ {
@ -81,7 +82,7 @@ mo_testmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
if((hostname = strchr(name, '@')) == NULL) if((hostname = strchr(name, '@')) == NULL)
{ {
sendto_one_notice(source_p, ":Invalid parameters"); sendto_one_notice(source_p, ":Invalid parameters");
return 0; return;
} }
*hostname++ = '\0'; *hostname++ = '\0';
@ -98,7 +99,7 @@ mo_testmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
if(EmptyString(username) || EmptyString(hostname)) if(EmptyString(username) || EmptyString(hostname))
{ {
sendto_one_notice(source_p, ":Invalid parameters"); sendto_one_notice(source_p, ":Invalid parameters");
return 0; return;
} }
if(parc > 2 && !EmptyString(parv[2])) if(parc > 2 && !EmptyString(parv[2]))
@ -143,5 +144,4 @@ mo_testmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
me.name, source_p->name, me.name, source_p->name,
lcount, gcount, name ? name : "*", lcount, gcount, name ? name : "*",
username, hostname, gecos ? gecos : "*"); username, hostname, gecos ? gecos : "*");
return 0;
} }

View file

@ -41,7 +41,7 @@
static const char tginfo_desc[] = "Processes target change notifications from other servers"; static const char tginfo_desc[] = "Processes target change notifications from other servers";
static int me_tginfo(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void me_tginfo(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message tginfo_msgtab = { struct Message tginfo_msgtab = {
"TGINFO", 0, 0, 0, 0, "TGINFO", 0, 0, 0, 0,
@ -56,15 +56,15 @@ DECLARE_MODULE_AV2(tginfo, NULL, NULL, tginfo_clist, NULL, NULL, NULL, NULL, tgi
** me_tginfo ** me_tginfo
** parv[1] = 0, reserved for future use (number of remaining targets) ** parv[1] = 0, reserved for future use (number of remaining targets)
*/ */
static int static void
me_tginfo(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) me_tginfo(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if (!IsPerson(source_p)) if (!IsPerson(source_p))
return 0; return;
int remaining = atoi(parv[1]); int remaining = atoi(parv[1]);
if (remaining != 0) if (remaining != 0)
return 0; /* not implemented */ return; /* not implemented */
if (!EmptyString(source_p->sockhost) && strcmp(source_p->sockhost, "0")) if (!EmptyString(source_p->sockhost) && strcmp(source_p->sockhost, "0"))
{ {
@ -79,6 +79,4 @@ me_tginfo(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
"Excessive target change from %s (%s@%s)", "Excessive target change from %s (%s@%s)",
source_p->name, source_p->username, source_p->orighost); source_p->name, source_p->username, source_p->orighost);
} }
return 0;
} }

View file

@ -34,11 +34,12 @@
#include "modules.h" #include "modules.h"
#include "packet.h" #include "packet.h"
static int m_time(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static char *date(void);
static const char time_desc[] = static const char time_desc[] =
"Provides the TIME command to show the current server time"; "Provides the TIME command to show the current server time";
static void m_time(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static char *date(void);
struct Message time_msgtab = { struct Message time_msgtab = {
"TIME", 0, 0, 0, 0, "TIME", 0, 0, 0, 0,
{mg_unreg, {m_time, 0}, {m_time, 2}, mg_ignore, mg_ignore, {m_time, 0}} {mg_unreg, {m_time, 0}, {m_time, 2}, mg_ignore, mg_ignore, {m_time, 0}}
@ -62,7 +63,7 @@ static const char *weekdays[] = {
* m_time * m_time
* parv[1] = servername * parv[1] = servername
*/ */
static int static void
m_time(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_time(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
/* this is not rate limited, so end the grace period */ /* this is not rate limited, so end the grace period */
@ -72,8 +73,6 @@ m_time(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
if(hunt_server(client_p, source_p, ":%s TIME :%s", 1, parc, parv) == HUNTED_ISME) if(hunt_server(client_p, source_p, ":%s TIME :%s", 1, parc, parv) == HUNTED_ISME)
sendto_one_numeric(source_p, RPL_TIME, form_str(RPL_TIME), sendto_one_numeric(source_p, RPL_TIME, form_str(RPL_TIME),
me.name, date()); me.name, date());
return 0;
} }
/* date() /* date()

View file

@ -44,8 +44,8 @@
static const char topic_desc[] = static const char topic_desc[] =
"Provides the TOPIC command to set, remove, and inspect channel topics"; "Provides the TOPIC command to set, remove, and inspect channel topics";
static int m_topic(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_topic(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_topic(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_topic(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message topic_msgtab = { struct Message topic_msgtab = {
"TOPIC", 0, 0, 0, 0, "TOPIC", 0, 0, 0, 0,
@ -60,7 +60,7 @@ DECLARE_MODULE_AV2(topic, NULL, NULL, topic_clist, NULL, NULL, NULL, NULL, topic
* parv[1] = channel name * parv[1] = channel name
* parv[2] = new topic, if setting topic * parv[2] = new topic, if setting topic
*/ */
static int static void
m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Channel *chptr = NULL; struct Channel *chptr = NULL;
@ -83,7 +83,7 @@ m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
me.name, source_p->name, "TOPIC"); me.name, source_p->name, "TOPIC");
return 0; return;
} }
} }
@ -96,7 +96,7 @@ m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), name); form_str(ERR_NOSUCHCHANNEL), name);
return 0; return;
} }
/* setting topic */ /* setting topic */
@ -108,7 +108,7 @@ m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one_numeric(source_p, ERR_NOTONCHANNEL, sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), name); form_str(ERR_NOTONCHANNEL), name);
return 0; return;
} }
if(MyClient(source_p) && !is_chanop_voiced(msptr) && if(MyClient(source_p) && !is_chanop_voiced(msptr) &&
@ -117,7 +117,7 @@ m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one(source_p, form_str(ERR_TARGCHANGE), sendto_one(source_p, form_str(ERR_TARGCHANGE),
me.name, source_p->name, chptr->chname); me.name, source_p->name, chptr->chname);
return 0; return;
} }
if(((chptr->mode.mode & MODE_TOPICLIMIT) == 0 || if(((chptr->mode.mode & MODE_TOPICLIMIT) == 0 ||
@ -160,7 +160,7 @@ m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one_numeric(source_p, ERR_NOTONCHANNEL, sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), name); form_str(ERR_NOTONCHANNEL), name);
return 0; return;
} }
if(chptr->topic == NULL) if(chptr->topic == NULL)
sendto_one(source_p, form_str(RPL_NOTOPIC), sendto_one(source_p, form_str(RPL_NOTOPIC),
@ -176,8 +176,6 @@ m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
(unsigned long)chptr->topic_time); (unsigned long)chptr->topic_time);
} }
} }
return 0;
} }
/* /*
@ -189,19 +187,17 @@ m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
* *
* Let servers always set a topic * Let servers always set a topic
*/ */
static int static void
ms_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Channel *chptr = NULL; struct Channel *chptr = NULL;
if((chptr = find_channel(parv[1])) == NULL) if((chptr = find_channel(parv[1])) == NULL)
return 0; return;
set_channel_topic(chptr, parv[4], parv[2], atoi(parv[3])); set_channel_topic(chptr, parv[4], parv[2], atoi(parv[3]));
sendto_channel_local(ALL_MEMBERS, chptr, ":%s TOPIC %s :%s", sendto_channel_local(ALL_MEMBERS, chptr, ":%s TOPIC %s :%s",
source_p->name, parv[1], source_p->name, parv[1],
chptr->topic == NULL ? "" : chptr->topic); chptr->topic == NULL ? "" : chptr->topic);
return 0;
} }

View file

@ -43,7 +43,7 @@
static const char trace_desc[] = static const char trace_desc[] =
"Provides the TRACE command to trace the route to a client or server"; "Provides the TRACE command to trace the route to a client or server";
static int m_trace(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_trace(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void trace_spy(struct Client *, struct Client *); static void trace_spy(struct Client *, struct Client *);
@ -70,14 +70,14 @@ static const char *empty_sockhost = "255.255.255.255";
* m_trace * m_trace
* parv[1] = servername * parv[1] = servername
*/ */
static int static void
m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p = NULL; struct Client *target_p = NULL;
struct Class *cltmp; struct Class *cltmp;
const char *tname; const char *tname;
int doall = 0; bool doall = false, wilds, dow;
int cnt = 0, wilds, dow; int cnt = 0;
rb_dlink_node *ptr; rb_dlink_node *ptr;
if(parc > 1) if(parc > 1)
@ -88,7 +88,7 @@ m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
if(hunt_server(client_p, source_p, ":%s TRACE %s :%s", 2, parc, parv) != if(hunt_server(client_p, source_p, ":%s TRACE %s :%s", 2, parc, parv) !=
HUNTED_ISME) HUNTED_ISME)
return 0; return;
} }
} }
else else
@ -134,27 +134,27 @@ m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
ac2ptr ? ac2ptr->name : tname, ac2ptr ? ac2ptr->name : tname,
ac2ptr ? ac2ptr->from->name : "EEK!"); ac2ptr ? ac2ptr->from->name : "EEK!");
return 0; return;
} }
case HUNTED_ISME: case HUNTED_ISME:
break; break;
default: default:
return 0; return;
} }
} }
if(match(tname, me.name)) if(match(tname, me.name))
{ {
doall = 1; doall = true;
} }
/* if theyre tracing our SID, we need to move tname to our name so /* if theyre tracing our SID, we need to move tname to our name so
* we dont give the sid in ENDOFTRACE * we dont give the sid in ENDOFTRACE
*/ */
else if(!MyClient(source_p) && !strcmp(tname, me.id)) else if(!MyClient(source_p) && !strcmp(tname, me.id))
{ {
doall = 1; doall = true;
tname = me.name; tname = me.name;
} }
@ -162,7 +162,7 @@ m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
dow = wilds || doall; dow = wilds || doall;
/* specific trace */ /* specific trace */
if(dow == 0) if(!dow)
{ {
if(MyClient(source_p) || parc > 2) if(MyClient(source_p) || parc > 2)
target_p = find_named_person(tname); target_p = find_named_person(tname);
@ -182,7 +182,7 @@ m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
sendto_one_numeric(source_p, RPL_ENDOFTRACE, sendto_one_numeric(source_p, RPL_ENDOFTRACE,
form_str(RPL_ENDOFTRACE), tname); form_str(RPL_ENDOFTRACE), tname);
return 0; return;
} }
trace_spy(source_p, NULL); trace_spy(source_p, NULL);
@ -223,7 +223,7 @@ m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
sendto_one_numeric(source_p, RPL_ENDOFTRACE, sendto_one_numeric(source_p, RPL_ENDOFTRACE,
form_str(RPL_ENDOFTRACE), tname); form_str(RPL_ENDOFTRACE), tname);
return 0; return;
} }
/* source_p is opered */ /* source_p is opered */
@ -281,7 +281,7 @@ m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
*/ */
sendto_one_numeric(source_p, RPL_ENDOFTRACE, sendto_one_numeric(source_p, RPL_ENDOFTRACE,
form_str(RPL_ENDOFTRACE), tname); form_str(RPL_ENDOFTRACE), tname);
return 0; return;
} }
if(doall) if(doall)
@ -298,8 +298,6 @@ m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
} }
sendto_one_numeric(source_p, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE), tname); sendto_one_numeric(source_p, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE), tname);
return 0;
} }
/* /*

View file

@ -30,41 +30,41 @@
#include "modules.h" #include "modules.h"
#include "send.h" #include "send.h"
static int mo_unreject(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static const char unreject_desc[] = static const char unreject_desc[] =
"Provides the UNREJECT command to remove an IP from the reject cache"; "Provides the UNREJECT command to remove an IP from the reject cache";
static void mo_unreject(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message unreject_msgtab = { struct Message unreject_msgtab = {
"UNREJECT", 0, 0, 0, 0, "UNREJECT", 0, 0, 0, 0,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_unreject, 2}} {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_unreject, 2}}
}; };
mapi_clist_av1 unreject_clist[] = { &unreject_msgtab, NULL }; mapi_clist_av1 unreject_clist[] = { &unreject_msgtab, NULL };
DECLARE_MODULE_AV2(unreject, NULL, NULL, unreject_clist, NULL, NULL, NULL, NULL, unreject_desc); DECLARE_MODULE_AV2(unreject, NULL, NULL, unreject_clist, NULL, NULL, NULL, NULL, unreject_desc);
/* /*
* mo_unreject * mo_unreject
*/ */
static int static void
mo_unreject(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_unreject(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(ConfigFileEntry.reject_after_count == 0 || ConfigFileEntry.reject_ban_time == 0 || if(ConfigFileEntry.reject_after_count == 0 || ConfigFileEntry.reject_ban_time == 0 ||
ConfigFileEntry.reject_duration == 0) ConfigFileEntry.reject_duration == 0)
{ {
sendto_one_notice(source_p, ":Reject cache is disabled"); sendto_one_notice(source_p, ":Reject cache is disabled");
return 0; return;
} }
if(!parse_netmask(parv[1], NULL, NULL)) if(!parse_netmask(parv[1], NULL, NULL))
{ {
sendto_one_notice(source_p, ":Unable to parse netmask %s", parv[1]); sendto_one_notice(source_p, ":Unable to parse netmask %s", parv[1]);
return 0; return;
} }
if(remove_reject_ip(parv[1])) if(remove_reject_ip(parv[1]))
sendto_one_notice(source_p, ":Removed reject for %s", parv[1]); sendto_one_notice(source_p, ":Removed reject for %s", parv[1]);
else else
sendto_one_notice(source_p, ":Unable to remove reject for %s", parv[1]); sendto_one_notice(source_p, ":Unable to remove reject for %s", parv[1]);
return 0;
} }

View file

@ -39,7 +39,7 @@
static const char user_desc[] = static const char user_desc[] =
"Provides the USER command to register a new connection"; "Provides the USER command to register a new connection";
static int mr_user(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mr_user(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message user_msgtab = { struct Message user_msgtab = {
"USER", 0, 0, 0, 0, "USER", 0, 0, 0, 0,
@ -49,7 +49,7 @@ struct Message user_msgtab = {
mapi_clist_av1 user_clist[] = { &user_msgtab, NULL }; mapi_clist_av1 user_clist[] = { &user_msgtab, NULL };
DECLARE_MODULE_AV2(user, NULL, NULL, user_clist, NULL, NULL, NULL, NULL, user_desc); DECLARE_MODULE_AV2(user, NULL, NULL, user_clist, NULL, NULL, NULL, NULL, user_desc);
static int do_local_user(struct Client *client_p, struct Client *source_p, static void do_local_user(struct Client *client_p, struct Client *source_p,
const char *username, const char *realname); const char *username, const char *realname);
/* mr_user() /* mr_user()
@ -58,7 +58,7 @@ static int do_local_user(struct Client *client_p, struct Client *source_p,
* parv[3] = server host name (ignored) * parv[3] = server host name (ignored)
* parv[4] = users gecos * parv[4] = users gecos
*/ */
static int static void
mr_user(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mr_user(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
static char buf[BUFSIZE]; static char buf[BUFSIZE];
@ -67,11 +67,11 @@ mr_user(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if (strlen(client_p->id) == 3) if (strlen(client_p->id) == 3)
{ {
exit_client(client_p, client_p, client_p, "Mixing client and server protocol"); exit_client(client_p, client_p, client_p, "Mixing client and server protocol");
return 0; return;
} }
if(source_p->flags & FLAGS_SENTUSER) if(source_p->flags & FLAGS_SENTUSER)
return 0; return;
if((p = strchr(parv[1], '@'))) if((p = strchr(parv[1], '@')))
*p = '\0'; *p = '\0';
@ -81,10 +81,9 @@ mr_user(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
source_p->localClient->fullcaps = rb_strdup(buf); source_p->localClient->fullcaps = rb_strdup(buf);
do_local_user(client_p, source_p, parv[1], parv[4]); do_local_user(client_p, source_p, parv[1], parv[4]);
return 0;
} }
static int static void
do_local_user(struct Client *client_p, struct Client *source_p, do_local_user(struct Client *client_p, struct Client *source_p,
const char *username, const char *realname) const char *username, const char *realname)
{ {
@ -104,8 +103,6 @@ do_local_user(struct Client *client_p, struct Client *source_p,
if(source_p->name[0]) if(source_p->name[0])
{ {
/* NICK already received, now I have USER... */ /* NICK already received, now I have USER... */
return register_local_user(client_p, source_p); register_local_user(client_p, source_p);
} }
return 0;
} }

View file

@ -39,7 +39,7 @@ static const char userhost_desc[] =
static char buf[BUFSIZE]; static char buf[BUFSIZE];
static int m_userhost(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_userhost(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message userhost_msgtab = { struct Message userhost_msgtab = {
"USERHOST", 0, 0, 0, 0, "USERHOST", 0, 0, 0, 0,
@ -55,7 +55,7 @@ DECLARE_MODULE_AV2(userhost, NULL, NULL, userhost_clist, NULL, NULL, NULL, NULL,
* the need for complicated requests like WHOIS. It returns user/host * the need for complicated requests like WHOIS. It returns user/host
* information only (no spurious AWAY labels or channels). * information only (no spurious AWAY labels or channels).
*/ */
static int static void
m_userhost(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_userhost(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -111,6 +111,4 @@ m_userhost(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
} }
sendto_one(source_p, "%s", buf); sendto_one(source_p, "%s", buf);
return 0;
} }

View file

@ -36,7 +36,7 @@
static const char users_desc[] = static const char users_desc[] =
"Provides the USERS command to display connection statistics locally and globally"; "Provides the USERS command to display connection statistics locally and globally";
static int m_users(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_users(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message users_msgtab = { struct Message users_msgtab = {
"USERS", 0, 0, 0, 0, "USERS", 0, 0, 0, 0,
@ -51,7 +51,7 @@ DECLARE_MODULE_AV2(users, NULL, NULL, users_clist, NULL, NULL, NULL, NULL, users
* m_users * m_users
* parv[1] = servername * parv[1] = servername
*/ */
static int static void
m_users(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_users(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(hunt_server(client_p, source_p, ":%s USERS :%s", 1, parc, parv) == HUNTED_ISME) if(hunt_server(client_p, source_p, ":%s USERS :%s", 1, parc, parv) == HUNTED_ISME)
@ -68,6 +68,4 @@ m_users(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
Count.total, Count.max_tot, Count.total, Count.max_tot,
Count.total, Count.max_tot); Count.total, Count.max_tot);
} }
return 0;
} }

View file

@ -39,8 +39,8 @@ static const char version_desc[] =
static char *confopts(void); static char *confopts(void);
static int m_version(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_version(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int mo_version(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_version(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message version_msgtab = { struct Message version_msgtab = {
"VERSION", 0, 0, 0, 0, "VERSION", 0, 0, 0, 0,
@ -55,7 +55,7 @@ DECLARE_MODULE_AV2(version, NULL, NULL, version_clist, NULL, NULL, NULL, NULL, v
* m_version - VERSION command handler * m_version - VERSION command handler
* parv[1] = remote server * parv[1] = remote server
*/ */
static int static void
m_version(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_version(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
static time_t last_used = 0L; static time_t last_used = 0L;
@ -67,13 +67,13 @@ m_version(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
/* safe enough to give this on a local connect only */ /* safe enough to give this on a local connect only */
sendto_one(source_p, form_str(RPL_LOAD2HI), sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "VERSION"); me.name, source_p->name, "VERSION");
return 0; return;
} }
else else
last_used = rb_current_time(); last_used = rb_current_time();
if(hunt_server(client_p, source_p, ":%s VERSION :%s", 1, parc, parv) != HUNTED_ISME) if(hunt_server(client_p, source_p, ":%s VERSION :%s", 1, parc, parv) != HUNTED_ISME)
return 0; return;
} }
sendto_one_numeric(source_p, RPL_VERSION, form_str(RPL_VERSION), sendto_one_numeric(source_p, RPL_VERSION, form_str(RPL_VERSION),
@ -85,15 +85,13 @@ m_version(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
ServerInfo.sid); ServerInfo.sid);
show_isupport(source_p); show_isupport(source_p);
return 0;
} }
/* /*
* mo_version - VERSION command handler * mo_version - VERSION command handler
* parv[1] = remote server * parv[1] = remote server
*/ */
static int static void
mo_version(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_version(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(hunt_server(client_p, source_p, ":%s VERSION :%s", 1, parc, parv) == HUNTED_ISME) if(hunt_server(client_p, source_p, ":%s VERSION :%s", 1, parc, parv) == HUNTED_ISME)
@ -107,8 +105,6 @@ mo_version(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
ServerInfo.sid); ServerInfo.sid);
show_isupport(source_p); show_isupport(source_p);
} }
return 0;
} }
/* confopts() /* confopts()

View file

@ -39,9 +39,9 @@
static const char wallops_desc[] = static const char wallops_desc[] =
"Provides the WALLOPS and OPERWALL commands to message online operators"; "Provides the WALLOPS and OPERWALL commands to message online operators";
static int mo_operwall(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void mo_operwall(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_operwall(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_operwall(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_wallops(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_wallops(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message wallops_msgtab = { struct Message wallops_msgtab = {
"WALLOPS", 0, 0, 0, 0, "WALLOPS", 0, 0, 0, 0,
@ -60,21 +60,19 @@ DECLARE_MODULE_AV2(wallops, NULL, NULL, wallops_clist, NULL, NULL, NULL, NULL, w
* mo_operwall (write to *all* opers currently online) * mo_operwall (write to *all* opers currently online)
* parv[1] = message text * parv[1] = message text
*/ */
static int static void
mo_operwall(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_operwall(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
if(!IsOperOperwall(source_p)) if(!IsOperOperwall(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "operwall"); me.name, source_p->name, "operwall");
return 0; return;
} }
sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", parv[1]); sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", parv[1]);
sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s OPERWALL :%s", sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s OPERWALL :%s",
use_id(source_p), parv[1]); use_id(source_p), parv[1]);
return 0;
} }
/* /*
@ -82,21 +80,19 @@ mo_operwall(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
* (write to *all* local opers currently online) * (write to *all* local opers currently online)
* parv[1] = message text * parv[1] = message text
*/ */
static int static void
ms_operwall(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_operwall(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s OPERWALL :%s", sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s OPERWALL :%s",
use_id(source_p), parv[1]); use_id(source_p), parv[1]);
sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", parv[1]); sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", parv[1]);
return 0;
} }
/* /*
* ms_wallops (write to *all* opers currently online) * ms_wallops (write to *all* opers currently online)
* parv[1] = message text * parv[1] = message text
*/ */
static int static void
ms_wallops(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_wallops(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
const char *prefix = ""; const char *prefix = "";
@ -105,7 +101,7 @@ ms_wallops(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "mass_notice"); me.name, source_p->name, "mass_notice");
return 0; return;
} }
if (IsPerson(source_p)) if (IsPerson(source_p))
@ -121,7 +117,5 @@ ms_wallops(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s WALLOPS :%s", sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s WALLOPS :%s",
use_id(source_p), parv[1]); use_id(source_p), parv[1]);
return 0;
} }

View file

@ -64,7 +64,15 @@ struct who_format
const char *querytype; const char *querytype;
}; };
static int m_who(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_who(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void do_who_on_channel(struct Client *source_p, struct Channel *chptr,
int server_oper, int member,
struct who_format *fmt);
static void who_global(struct Client *source_p, const char *mask, int server_oper, int operspy, struct who_format *fmt);
static void do_who(struct Client *source_p,
struct Client *target_p, struct membership *msptr,
struct who_format *fmt);
struct Message who_msgtab = { struct Message who_msgtab = {
"WHO", 0, 0, 0, 0, "WHO", 0, 0, 0, 0,
@ -87,23 +95,12 @@ _moddeinit(void)
mapi_clist_av1 who_clist[] = { &who_msgtab, NULL }; mapi_clist_av1 who_clist[] = { &who_msgtab, NULL };
DECLARE_MODULE_AV2(who, _modinit, _moddeinit, who_clist, NULL, NULL, NULL, NULL, who_desc); DECLARE_MODULE_AV2(who, _modinit, _moddeinit, who_clist, NULL, NULL, NULL, NULL, who_desc);
static void do_who_on_channel(struct Client *source_p, struct Channel *chptr,
int server_oper, int member,
struct who_format *fmt);
static void who_global(struct Client *source_p, const char *mask, int server_oper, int operspy, struct who_format *fmt);
static void do_who(struct Client *source_p,
struct Client *target_p, struct membership *msptr,
struct who_format *fmt);
/* /*
** m_who ** m_who
** parv[1] = nickname mask list ** parv[1] = nickname mask list
** parv[2] = additional selection flag and format options ** parv[2] = additional selection flag and format options
*/ */
static int static void
m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
static time_t last_used = 0; static time_t last_used = 0;
@ -162,17 +159,17 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
if((*(mask + 1) == '\0') && (*mask == '*')) if((*(mask + 1) == '\0') && (*mask == '*'))
{ {
if(source_p->user == NULL) if(source_p->user == NULL)
return 0; return;
if((lp = source_p->user->channel.head) != NULL) if((lp = source_p->user->channel.head) != NULL)
{ {
msptr = lp->data; msptr = lp->data;
do_who_on_channel(source_p, msptr->chptr, server_oper, YES, &fmt); do_who_on_channel(source_p, msptr->chptr, server_oper, true, &fmt);
} }
sendto_one(source_p, form_str(RPL_ENDOFWHO), sendto_one(source_p, form_str(RPL_ENDOFWHO),
me.name, source_p->name, "*"); me.name, source_p->name, "*");
return 0; return;
} }
if(IsOperSpy(source_p) && *mask == '!') if(IsOperSpy(source_p) && *mask == '!')
@ -184,7 +181,7 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
{ {
sendto_one(source_p, form_str(RPL_ENDOFWHO), sendto_one(source_p, form_str(RPL_ENDOFWHO),
me.name, source_p->name, parv[1]); me.name, source_p->name, parv[1]);
return 0; return;
} }
} }
@ -202,21 +199,21 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
me.name, source_p->name, "WHO"); me.name, source_p->name, "WHO");
sendto_one(source_p, form_str(RPL_ENDOFWHO), sendto_one(source_p, form_str(RPL_ENDOFWHO),
me.name, source_p->name, "*"); me.name, source_p->name, "*");
return 0; return;
} }
if(operspy) if(operspy)
report_operspy(source_p, "WHO", chptr->chname); report_operspy(source_p, "WHO", chptr->chname);
if(IsMember(source_p, chptr) || operspy) if(IsMember(source_p, chptr) || operspy)
do_who_on_channel(source_p, chptr, server_oper, YES, &fmt); do_who_on_channel(source_p, chptr, server_oper, true, &fmt);
else if(!SecretChannel(chptr)) else if(!SecretChannel(chptr))
do_who_on_channel(source_p, chptr, server_oper, NO, &fmt); do_who_on_channel(source_p, chptr, server_oper, false, &fmt);
} }
sendto_one(source_p, form_str(RPL_ENDOFWHO), sendto_one(source_p, form_str(RPL_ENDOFWHO),
me.name, source_p->name, parv[1] + operspy); me.name, source_p->name, parv[1] + operspy);
return 0; return;
} }
/* '/who nick' */ /* '/who nick' */
@ -251,7 +248,7 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
sendto_one(source_p, form_str(RPL_ENDOFWHO), sendto_one(source_p, form_str(RPL_ENDOFWHO),
me.name, source_p->name, mask); me.name, source_p->name, mask);
return 0; return;
} }
if(!IsFloodDone(source_p)) if(!IsFloodDone(source_p))
@ -266,7 +263,7 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
me.name, source_p->name, "WHO"); me.name, source_p->name, "WHO");
sendto_one(source_p, form_str(RPL_ENDOFWHO), sendto_one(source_p, form_str(RPL_ENDOFWHO),
me.name, source_p->name, "*"); me.name, source_p->name, "*");
return 0; return;
} }
else else
last_used = rb_current_time(); last_used = rb_current_time();
@ -288,8 +285,6 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
sendto_one(source_p, form_str(RPL_ENDOFWHO), sendto_one(source_p, form_str(RPL_ENDOFWHO),
me.name, source_p->name, mask); me.name, source_p->name, mask);
return 0;
} }
/* who_common_channel /* who_common_channel
@ -556,12 +551,12 @@ do_who(struct Client *source_p, struct Client *target_p, struct membership *mspt
if (pos >= sizeof str) if (pos >= sizeof str)
{ {
static int warned = 0; static bool warned = false;
if (!warned) if (!warned)
sendto_realops_snomask(SNO_DEBUG, L_NETWIDE, sendto_realops_snomask(SNO_DEBUG, L_NETWIDE,
"WHOX overflow while sending information about %s to %s", "WHOX overflow while sending information about %s to %s",
target_p->name, source_p->name); target_p->name, source_p->name);
warned = 1; warned = true;
} }
sendto_one(source_p, "%s", str); sendto_one(source_p, "%s", str);
} }

View file

@ -51,8 +51,8 @@ static const char whois_desc[] =
static void do_whois(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void do_whois(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void single_whois(struct Client *source_p, struct Client *target_p, int operspy); static void single_whois(struct Client *source_p, struct Client *target_p, int operspy);
static int m_whois(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_whois(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int ms_whois(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void ms_whois(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message whois_msgtab = { struct Message whois_msgtab = {
"WHOIS", 0, 0, 0, 0, "WHOIS", 0, 0, 0, 0,
@ -77,7 +77,7 @@ DECLARE_MODULE_AV2(whois, NULL, NULL, whois_clist, whois_hlist, NULL, NULL, NULL
* m_whois * m_whois
* parv[1] = nickname masklist * parv[1] = nickname masklist
*/ */
static int static void
m_whois(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_whois(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
static time_t last_used = 0; static time_t last_used = 0;
@ -88,7 +88,7 @@ m_whois(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN), sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN),
me.name, source_p->name); me.name, source_p->name);
return 0; return;
} }
if(!IsOper(source_p)) if(!IsOper(source_p))
@ -100,7 +100,7 @@ m_whois(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
me.name, source_p->name, "WHOIS"); me.name, source_p->name, "WHOIS");
sendto_one_numeric(source_p, RPL_ENDOFWHOIS, sendto_one_numeric(source_p, RPL_ENDOFWHOIS,
form_str(RPL_ENDOFWHOIS), parv[2]); form_str(RPL_ENDOFWHOIS), parv[2]);
return 0; return;
} }
else else
last_used = rb_current_time(); last_used = rb_current_time();
@ -108,14 +108,12 @@ m_whois(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if(hunt_server(client_p, source_p, ":%s WHOIS %s :%s", 1, parc, parv) != if(hunt_server(client_p, source_p, ":%s WHOIS %s :%s", 1, parc, parv) !=
HUNTED_ISME) HUNTED_ISME)
return 0; return;
parv[1] = parv[2]; parv[1] = parv[2];
} }
do_whois(client_p, source_p, parc, parv); do_whois(client_p, source_p, parc, parv);
return 0;
} }
/* /*
@ -123,7 +121,7 @@ m_whois(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
* parv[1] = server to reply * parv[1] = server to reply
* parv[2] = nickname to whois * parv[2] = nickname to whois
*/ */
static int static void
ms_whois(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_whois(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct Client *target_p; struct Client *target_p;
@ -136,7 +134,7 @@ ms_whois(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN), sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN),
me.name, source_p->name); me.name, source_p->name);
return 0; return;
} }
/* check if parv[1] exists */ /* check if parv[1] exists */
@ -145,7 +143,7 @@ ms_whois(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
sendto_one_numeric(source_p, ERR_NOSUCHSERVER, sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
form_str(ERR_NOSUCHSERVER), form_str(ERR_NOSUCHSERVER),
IsDigit(parv[1][0]) ? "*" : parv[1]); IsDigit(parv[1][0]) ? "*" : parv[1]);
return 0; return;
} }
/* if parv[1] isnt my client, or me, someone else is supposed /* if parv[1] isnt my client, or me, someone else is supposed
@ -156,7 +154,7 @@ ms_whois(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
sendto_one(target_p, ":%s WHOIS %s :%s", sendto_one(target_p, ":%s WHOIS %s :%s",
get_id(source_p, target_p), get_id(source_p, target_p),
get_id(target_p, target_p), parv[2]); get_id(target_p, target_p), parv[2]);
return 0; return;
} }
/* ok, the target is either us, or a client on our server, so perform the whois /* ok, the target is either us, or a client on our server, so perform the whois
@ -165,8 +163,6 @@ ms_whois(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
*/ */
parv[1] = parv[2]; parv[1] = parv[2];
do_whois(client_p, source_p, parc, parv); do_whois(client_p, source_p, parc, parv);
return 0;
} }
/* do_whois /* do_whois
@ -215,7 +211,6 @@ do_whois(struct Client *client_p, struct Client *source_p, int parc, const char
sendto_one_numeric(source_p, RPL_ENDOFWHOIS, sendto_one_numeric(source_p, RPL_ENDOFWHOIS,
form_str(RPL_ENDOFWHOIS), parv[1]); form_str(RPL_ENDOFWHOIS), parv[1]);
return;
} }
/* /*
@ -421,6 +416,4 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
call_hook(doing_whois_hook, &hdata); call_hook(doing_whois_hook, &hdata);
else else
call_hook(doing_whois_global_hook, &hdata); call_hook(doing_whois_global_hook, &hdata);
return;
} }

View file

@ -42,7 +42,7 @@
static const char whowas_desc[] = static const char whowas_desc[] =
"Provides the WHOWAS command to display information on a disconnected user"; "Provides the WHOWAS command to display information on a disconnected user";
static int m_whowas(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void m_whowas(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message whowas_msgtab = { struct Message whowas_msgtab = {
"WHOWAS", 0, 0, 0, 0, "WHOWAS", 0, 0, 0, 0,
@ -57,7 +57,7 @@ DECLARE_MODULE_AV2(whowas, NULL, NULL, whowas_clist, NULL, NULL, NULL, NULL, who
** m_whowas ** m_whowas
** parv[1] = nickname queried ** parv[1] = nickname queried
*/ */
static int static void
m_whowas(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_whowas(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
rb_dlink_list *whowas_list; rb_dlink_list *whowas_list;
@ -81,7 +81,7 @@ m_whowas(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
me.name, source_p->name, "WHOWAS"); me.name, source_p->name, "WHOWAS");
sendto_one_numeric(source_p, RPL_ENDOFWHOWAS, form_str(RPL_ENDOFWHOWAS), sendto_one_numeric(source_p, RPL_ENDOFWHOWAS, form_str(RPL_ENDOFWHOWAS),
parv[1]); parv[1]);
return 0; return;
} }
else else
last_used = rb_current_time(); last_used = rb_current_time();
@ -93,7 +93,7 @@ m_whowas(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(parc > 3) if(parc > 3)
if(hunt_server(client_p, source_p, ":%s WHOWAS %s %s :%s", 3, parc, parv)) if(hunt_server(client_p, source_p, ":%s WHOWAS %s %s :%s", 3, parc, parv))
return 0; return;
if(!MyClient(source_p) && (max <= 0 || max > 20)) if(!MyClient(source_p) && (max <= 0 || max > 20))
max = 20; max = 20;
@ -110,7 +110,7 @@ m_whowas(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one_numeric(source_p, ERR_WASNOSUCHNICK, form_str(ERR_WASNOSUCHNICK), nick); sendto_one_numeric(source_p, ERR_WASNOSUCHNICK, form_str(ERR_WASNOSUCHNICK), nick);
sendto_one_numeric(source_p, RPL_ENDOFWHOWAS, form_str(RPL_ENDOFWHOWAS), parv[1]); sendto_one_numeric(source_p, RPL_ENDOFWHOWAS, form_str(RPL_ENDOFWHOWAS), parv[1]);
return 0; return;
} }
RB_DLINK_FOREACH(ptr, whowas_list->head) RB_DLINK_FOREACH(ptr, whowas_list->head)
@ -149,5 +149,4 @@ m_whowas(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
} }
sendto_one_numeric(source_p, RPL_ENDOFWHOWAS, form_str(RPL_ENDOFWHOWAS), parv[1]); sendto_one_numeric(source_p, RPL_ENDOFWHOWAS, form_str(RPL_ENDOFWHOWAS), parv[1]);
return 0;
} }

View file

@ -54,17 +54,17 @@
static const char xline_desc[] = static const char xline_desc[] =
"Provides management of GECOS bans via (UN)XLINE command"; "Provides management of GECOS bans via (UN)XLINE command";
static int mo_xline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void mo_xline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int ms_xline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void ms_xline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int me_xline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static void me_xline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int mo_unxline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, static void mo_unxline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc,
const char *parv[]); const char *parv[]);
static int ms_unxline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, static void ms_unxline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc,
const char *parv[]); const char *parv[]);
static int me_unxline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, static void me_unxline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc,
const char *parv[]); const char *parv[]);
static int valid_xline(struct Client *, const char *, const char *); static bool valid_xline(struct Client *, const char *, const char *);
static void apply_xline(struct Client *client_p, const char *name, static void apply_xline(struct Client *client_p, const char *name,
const char *reason, int temp_time, int propagated); const char *reason, int temp_time, int propagated);
static void propagate_xline(struct Client *source_p, const char *target, static void propagate_xline(struct Client *source_p, const char *target,
@ -98,7 +98,7 @@ DECLARE_MODULE_AV2(xline, NULL, NULL, xline_clist, NULL, NULL, NULL, NULL, xline
* parv[2] - optional type/reason * parv[2] - optional type/reason
* parv[3] - reason * parv[3] - reason
*/ */
static int static void
mo_xline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_xline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
struct ConfItem *aconf; struct ConfItem *aconf;
@ -112,7 +112,7 @@ mo_xline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(!IsOperXline(source_p)) if(!IsOperXline(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "xline"); sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "xline");
return 0; return;
} }
if((temp_time = valid_temp_time(parv[loc])) >= 0) if((temp_time = valid_temp_time(parv[loc])) >= 0)
@ -131,7 +131,7 @@ mo_xline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "remoteban"); me.name, source_p->name, "remoteban");
return 0; return;
} }
target_server = parv[loc + 1]; target_server = parv[loc + 1];
@ -142,7 +142,7 @@ mo_xline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
me.name, source_p->name, "XLINE"); me.name, source_p->name, "XLINE");
return 0; return;
} }
reason = parv[loc]; reason = parv[loc];
@ -152,7 +152,7 @@ mo_xline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
propagate_xline(source_p, target_server, temp_time, name, "2", reason); propagate_xline(source_p, target_server, temp_time, name, "2", reason);
if(!match(target_server, me.name)) if(!match(target_server, me.name))
return 0; return;
/* Set as local-only. */ /* Set as local-only. */
propagated = 0; propagated = 0;
@ -164,28 +164,26 @@ mo_xline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
sendto_one(source_p, ":%s NOTICE %s :[%s] already X-Lined by [%s] - %s", sendto_one(source_p, ":%s NOTICE %s :[%s] already X-Lined by [%s] - %s",
me.name, source_p->name, name, aconf->host, aconf->passwd); me.name, source_p->name, name, aconf->host, aconf->passwd);
return 0; return;
} }
if(!valid_xline(source_p, name, reason)) if(!valid_xline(source_p, name, reason))
return 0; return;
if(propagated && temp_time == 0) if(propagated && temp_time == 0)
{ {
sendto_one_notice(source_p, ":Cannot set a permanent global ban"); sendto_one_notice(source_p, ":Cannot set a permanent global ban");
return 0; return;
} }
apply_xline(source_p, name, reason, temp_time, propagated); apply_xline(source_p, name, reason, temp_time, propagated);
return 0;
} }
/* ms_xline() /* ms_xline()
* *
* handles a remote xline * handles a remote xline
*/ */
static int static void
ms_xline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_xline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
/* parv[0] parv[1] parv[2] parv[3] parv[4] /* parv[0] parv[1] parv[2] parv[3] parv[4]
@ -194,25 +192,23 @@ ms_xline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
propagate_xline(source_p, parv[1], 0, parv[2], parv[3], parv[4]); propagate_xline(source_p, parv[1], 0, parv[2], parv[3], parv[4]);
if(!IsPerson(source_p)) if(!IsPerson(source_p))
return 0; return;
/* destined for me? */ /* destined for me? */
if(!match(parv[1], me.name)) if(!match(parv[1], me.name))
return 0; return;
handle_remote_xline(source_p, 0, parv[2], parv[4]); handle_remote_xline(source_p, 0, parv[2], parv[4]);
return 0;
} }
static int static void
me_xline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) me_xline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
/* time name type :reason */ /* time name type :reason */
if(!IsPerson(source_p)) if(!IsPerson(source_p))
return 0; return;
handle_remote_xline(source_p, atoi(parv[1]), parv[2], parv[4]); handle_remote_xline(source_p, atoi(parv[1]), parv[2], parv[4]);
return 0;
} }
static void static void
@ -245,14 +241,14 @@ handle_remote_xline(struct Client *source_p, int temp_time, const char *name, co
* outputs - * outputs -
* side effects - checks the xline for validity, erroring if needed * side effects - checks the xline for validity, erroring if needed
*/ */
static int static bool
valid_xline(struct Client *source_p, const char *gecos, const char *reason) valid_xline(struct Client *source_p, const char *gecos, const char *reason)
{ {
if(EmptyString(reason)) if(EmptyString(reason))
{ {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
get_id(&me, source_p), get_id(source_p, source_p), "XLINE"); get_id(&me, source_p), get_id(source_p, source_p), "XLINE");
return 0; return false;
} }
if(!valid_wild_card_simple(gecos)) if(!valid_wild_card_simple(gecos))
@ -261,10 +257,10 @@ valid_xline(struct Client *source_p, const char *gecos, const char *reason)
":Please include at least %d non-wildcard " ":Please include at least %d non-wildcard "
"characters with the xline", "characters with the xline",
ConfigFileEntry.min_nonwildcard_simple); ConfigFileEntry.min_nonwildcard_simple);
return 0; return false;
} }
return 1; return true;
} }
void void
@ -386,7 +382,7 @@ cluster_xline(struct Client *source_p, int temp_time, const char *name, const ch
* *
* parv[1] - thing to unxline * parv[1] - thing to unxline
*/ */
static int static void
mo_unxline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_unxline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
int propagated = 1; int propagated = 1;
@ -394,7 +390,7 @@ mo_unxline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
if(!IsOperXline(source_p)) if(!IsOperXline(source_p))
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "xline"); sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "xline");
return 0; return;
} }
if(parc == 4 && !(irccmp(parv[2], "ON"))) if(parc == 4 && !(irccmp(parv[2], "ON")))
@ -403,28 +399,26 @@ mo_unxline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
{ {
sendto_one(source_p, form_str(ERR_NOPRIVS), sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "remoteban"); me.name, source_p->name, "remoteban");
return 0; return;
} }
propagate_generic(source_p, "UNXLINE", parv[3], CAP_CLUSTER, "%s", parv[1]); propagate_generic(source_p, "UNXLINE", parv[3], CAP_CLUSTER, "%s", parv[1]);
if(match(parv[3], me.name) == 0) if(match(parv[3], me.name) == 0)
return 0; return;
propagated = 0; propagated = 0;
} }
/* cluster{} moved to remove_xline */ /* cluster{} moved to remove_xline */
remove_xline(source_p, parv[1], propagated); remove_xline(source_p, parv[1], propagated);
return 0;
} }
/* ms_unxline() /* ms_unxline()
* *
* handles a remote unxline * handles a remote unxline
*/ */
static int static void
ms_unxline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ms_unxline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
/* parv[0] parv[1] parv[2] /* parv[0] parv[1] parv[2]
@ -433,24 +427,22 @@ ms_unxline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
propagate_generic(source_p, "UNXLINE", parv[1], CAP_CLUSTER, "%s", parv[2]); propagate_generic(source_p, "UNXLINE", parv[1], CAP_CLUSTER, "%s", parv[2]);
if(!match(parv[1], me.name)) if(!match(parv[1], me.name))
return 0; return;
if(!IsPerson(source_p)) if(!IsPerson(source_p))
return 0; return;
handle_remote_unxline(source_p, parv[2]); handle_remote_unxline(source_p, parv[2]);
return 0;
} }
static int static void
me_unxline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) me_unxline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
/* name */ /* name */
if(!IsPerson(source_p)) if(!IsPerson(source_p))
return 0; return;
handle_remote_unxline(source_p, parv[1]); handle_remote_unxline(source_p, parv[1]);
return 0;
} }
static void static void
@ -461,8 +453,6 @@ handle_remote_unxline(struct Client *source_p, const char *name)
return; return;
remove_xline(source_p, name, 0); remove_xline(source_p, name, 0);
return;
} }
static void static void
@ -544,6 +534,4 @@ remove_xline(struct Client *source_p, const char *name, int propagated)
cluster_generic(source_p, "UNXLINE", SHARED_UNXLINE, CAP_CLUSTER, "%s", name); cluster_generic(source_p, "UNXLINE", SHARED_UNXLINE, CAP_CLUSTER, "%s", name);
sendto_one_notice(source_p, ":No X-Line for %s", name); sendto_one_notice(source_p, ":No X-Line for %s", name);
return;
} }