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

@ -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_umode_changed(hook_data_umode_changed *hdata);
static void h_hdl_whois(hook_data_client *hdata);
static int 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 int do_dehelper(struct Client *source_p, struct Client *target_p);
static void mo_dehelper(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void me_dehelper(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void do_dehelper(struct Client *source_p, struct Client *target_p);
mapi_hfn_list_av1 helpops_hfnlist[] = {
{ "doing_stats", (hookfn) h_hdl_stats_request },
@ -45,20 +45,21 @@ struct Message dehelper_msgtab = {
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;
if (!IsOperAdmin(source_p))
{
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])))
{
sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), parv[1]);
return 0;
return;
}
if(MyClient(target_p))
@ -66,31 +67,30 @@ static int mo_dehelper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct
else
sendto_one(target_p, ":%s ENCAP %s DEHELPER %s",
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]);
if(!target_p)
{
sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), parv[1]);
return 0;
return;
}
if(!MyClient(target_p))
return 0;
return;
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];
if(!(target_p->umodes & UMODE_HELPOPS))
return 0;
return;
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is using DEHELPER on %s",
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[3] = NULL;
user_mode(target_p, target_p, 3, fakeparv);
return 0;
}
static int