invite: rework the way can_invite hook is called

This commit is contained in:
Ariadne Conill 2020-06-26 19:55:12 +00:00
parent 4436a7ca73
commit 4371dcbd55

View file

@ -145,8 +145,6 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
return;
}
if (MyClient(source_p))
{
hdata.chptr = chptr;
hdata.msptr = msptr;
hdata.client = source_p;
@ -155,14 +153,19 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
call_hook(can_invite_hook, &hdata);
if (hdata.approved)
{
if (MyClient(target_p))
{
if (hdata.error)
sendto_one_numeric(source_p, hdata.approved, "%s", hdata.error);
else if (hdata.approved == ERR_CHANOPRIVSNEEDED)
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, parv[2]);
return;
add_reply_target(target_p, source_p);
}
return;
}
/* store invites when they could affect the ability to join