chmode: Move check_forward() to a boolean

This commit is contained in:
Matt Ullman 2016-03-24 14:42:54 -04:00
parent a383180a0a
commit e0a9b5d3bf

View file

@ -486,7 +486,7 @@ pretty_mask(const char *idmask)
* output - true if forwarding should be allowed * output - true if forwarding should be allowed
* side effects - numeric sent if not allowed * side effects - numeric sent if not allowed
*/ */
static int static bool
check_forward(struct Client *source_p, struct Channel *chptr, check_forward(struct Client *source_p, struct Channel *chptr,
const char *forward) const char *forward)
{ {
@ -497,20 +497,20 @@ check_forward(struct Client *source_p, struct Channel *chptr,
(MyClient(source_p) && (strlen(forward) > LOC_CHANNELLEN || hash_find_resv(forward)))) (MyClient(source_p) && (strlen(forward) > LOC_CHANNELLEN || hash_find_resv(forward))))
{ {
sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), forward); sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), forward);
return 0; return false;
} }
/* don't forward to inconsistent target -- jilles */ /* don't forward to inconsistent target -- jilles */
if(chptr->chname[0] == '#' && forward[0] == '&') if(chptr->chname[0] == '#' && forward[0] == '&')
{ {
sendto_one_numeric(source_p, ERR_BADCHANNAME, sendto_one_numeric(source_p, ERR_BADCHANNAME,
form_str(ERR_BADCHANNAME), forward); form_str(ERR_BADCHANNAME), forward);
return 0; return false;
} }
if(MyClient(source_p) && (targptr = find_channel(forward)) == NULL) if(MyClient(source_p) && (targptr = find_channel(forward)) == NULL)
{ {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), forward); form_str(ERR_NOSUCHCHANNEL), forward);
return 0; return false;
} }
if(MyClient(source_p) && !(targptr->mode.mode & MODE_FREETARGET)) if(MyClient(source_p) && !(targptr->mode.mode & MODE_FREETARGET))
{ {
@ -519,10 +519,10 @@ check_forward(struct Client *source_p, struct Channel *chptr,
{ {
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, targptr->chname); me.name, source_p->name, targptr->chname);
return 0; return false;
} }
} }
return 1; return true;
} }
/* fix_key() /* fix_key()